MediaWiki:Gadget-clippy.js: Difference between revisions

From RuneRealm Wiki
Jump to navigation Jump to search
Content added Content deleted
No edit summary
Tag: Manual revert
No edit summary
 
Line 1: Line 1:
"use strict";

/* globals $, mw, rswiki*/
/* globals $, mw, rswiki*/


Math.Vector = function (x,y) {
Math.Vector = function (x, y) {
this.x = x;
this.x = x;
this.y = y;
this.y = y;
}
};
Math.Vector.prototype = {
Math.Vector.prototype = {
clone: function () {
clone: function clone() {
return new Math.Vector(this.x, this.y);
return new Math.Vector(this.x, this.y);
},
},
negate: function () {
negate: function negate() {
this.x = -this.x;
this.x = -this.x;
this.y = -this.y;
this.y = -this.y;
return this;
return this;
},
},
neg: function () {
neg: function neg() {
return this.clone().negate();
return this.clone().negate();
},
},
addeq: function (v) {
addeq: function addeq(v) {
this.x += v.x;
this.x += v.x;
this.y += v.y;
this.y += v.y;
return this;
return this;
},
},
subeq: function (v) {
subeq: function subeq(v) {
return this.addeq(v.neg());
return this.addeq(v.neg());
},
},
add: function (v) {
add: function add(v) {
return this.clone().addeq(v);
return this.clone().addeq(v);
},
},
sub: function (v) {
sub: function sub(v) {
return this.clone().subeq(v);
return this.clone().subeq(v);
},
},
multeq: function (c) {
multeq: function multeq(c) {
this.x *= c;
this.x *= c;
this.y *= c;
this.y *= c;
return this;
return this;
},
},
diveq: function (c) {
diveq: function diveq(c) {
this.x /= c;
this.x /= c;
this.y /= c;
this.y /= c;
return this;
return this;
},
},
mult: function (c) {
mult: function mult(c) {
return this.clone().multeq(c);
return this.clone().multeq(c);
},
},
div: function (c) {
div: function div(c) {
return this.clone().diveq(c);
return this.clone().diveq(c);
},
},
dot: function dot(v) {
return this.x * v.x + this.y * v.y;
dot: function (v) {
},
return this.x * v.x + this.y * v.y;
length: function length() {
},
return Math.sqrt(this.dot(this));
length: function () {
},
return Math.sqrt(this.dot(this));
normal: function normal() {
},
return this.clone().diveq(this.length());
normal: function () {
}
return this.clone().diveq(this.length());
}
};
};
function evade(evt) {
function evade(evt) {
if(mouseStateDown && DDSenabled){
if (mouseStateDown && DDSenabled) {
var $this = $(this)
var $this = $(this);
var width, height, corner, mouseX, mouseY;

if ($this.prop("fixed") == "true") {
var width,height,corner,mouseX,mouseY
if($this.prop("fixed") == "true"){
width = $(window).width();
width = $(window).width()
height = $(window).height();
height = $(window).height()
corner = {
corner = {"left":parseFloat($this.css("left")),"top":parseFloat($this.css("top"))}
"left": parseFloat($this.css("left")),
mouseX = evt.clientX
"top": parseFloat($this.css("top"))
};
mouseY = evt.clientY
} else {
mouseX = evt.clientX;
width = $(document).width()
mouseY = evt.clientY;
} else {
height = $(document).height()
corner = $this.offset()
width = $(document).width();
mouseX = evt.pageX
height = $(document).height();
mouseY = evt.pageY
corner = $this.offset();
}
mouseX = evt.pageX;
mouseY = evt.pageY;
var center = {x: corner.left + $this.outerWidth() / 2, y: corner.top + $this.outerHeight() / 2}
}
var dist = new Math.Vector(center.x - mouseX, center.y - mouseY)
var closest = $this.outerWidth() / 2
var center = {
x: corner.left + $this.outerWidth() / 2,
$this.toggleClass('spinning',true)
y: corner.top + $this.outerHeight() / 2
};
var dist = new Math.Vector(center.x - mouseX, center.y - mouseY);
if (dist.length() >= closest) {
return;
var closest = $this.outerWidth() / 2;
$this.toggleClass('spinning', true);
}
if (dist.length() >= closest) {
return;
var delta = dist.normal().multeq(closest).sub(dist),
}
newCorner = {left: corner.left + delta.x, top: corner.top + delta.y};
var delta = dist.normal().multeq(closest).sub(dist),
newCorner = {
var padding = parseInt($this.css('padding-left'));
if (newCorner.left < -padding) {
left: corner.left + delta.x,
newCorner.left = -padding;
top: corner.top + delta.y
};
} else if (newCorner.left + $this.outerWidth() - padding > width) {
var padding = parseInt($this.css('padding-left'));
newCorner.left = width - $this.outerWidth() + padding;
}
if (newCorner.left < -padding) {
if (newCorner.top < -padding) {
newCorner.left = -padding;
} else if (newCorner.left + $this.outerWidth() - padding > width) {
newCorner.top = -padding;
} else if (newCorner.top + $this.outerHeight() - padding > height) {
newCorner.left = width - $this.outerWidth() + padding;
newCorner.top = height - $this.outerHeight() + padding;
}
$this.css("position","absolute");

if($this.prop("fixed") == "true"){
$this.css("left",newCorner.left)
$this.css("top",newCorner.top)
} else {
$this.offset(newCorner);
}
}
}
if (newCorner.top < -padding) {
newCorner.top = -padding;
} else if (newCorner.top + $this.outerHeight() - padding > height) {
newCorner.top = height - $this.outerHeight() + padding;
}
$this.css("position", "absolute");
if ($this.prop("fixed") == "true") {
$this.css("left", newCorner.left);
$this.css("top", newCorner.top);
} else {
$this.offset(newCorner);
}
}
}
}
function beginEvade() {
function beginEvade() {
$(this).on('mousemove', evade);
$(this).on('mousemove', evade);
}
}
function endEvade() {
function endEvade() {
$(this).off('mousemove', evade);
$(this).off('mousemove', evade);
$(this).toggleClass('spinning',false)
$(this).toggleClass('spinning', false);
}
}
function spinny() {
function spinny() {
if ($('.infobox-switch').length > 0 && $('.button-selected').length == 0 && $('select').length == 0) {

setTimeout(spinny, 250);
if($('.infobox-switch').length > 0 && $('.button-selected').length == 0 && $('select').length == 0) {
return;
setTimeout(spinny, 250);
}
return;
var wrapper = '<span class="hittabletop"><span class="hittable bumper spinny" /></span>';
var searchterm = '.mw-parser-output > .floatleft img, ' + '.mw-parser-output > .floatright img, ' + '.mw-parser-output > .rsw-synced-switch .floatleft img, ' + '.infobox-monster .infobox-image img, ' + '.infobox-npc .infobox-full-width-content img, ' + '.infobox-jagex img';
var excludeterm = '.leaflet-tile';
var title = mw.config.get('wgTitle');
var query = MD5(title);
if (query == "e8f65c7327e4ae90e767afc30a709419") {
wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>';
}
if (query == "7dd8d4d08aa31a5c516f21d40a03c8a5") {
wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>';
searchterm = '.infobox-monster .infobox-image img';
for (var key in TTJlist) {
$("#content").prepend('<img src="' + TTJlist[key] + '" width="1" height="1">');
}
}
}

if (query == "f06eb95413908c7a0be080f82e1f4d56") {
var wrapper = '<span class="hittabletop"><span class="hittable bumper spinny" /></span>'
wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>';
var searchterm =
'.mw-parser-output > .floatleft img, '+
searchterm = '.infobox-monster .infobox-image img';
}
'.mw-parser-output > .floatright img, '+
$(searchterm).not(excludeterm).wrap(wrapper);
'.mw-parser-output > .rsw-synced-switch .floatleft img, '+
if (query == "04f12d4923ec5069ac75e6d364b719cb" && load("apr-totalkills") >= 50) {
'.infobox-monster .infobox-image img, '+
$("#mw-content-text").empty();
'.infobox-npc .infobox-full-width-content img, '+
var width = $(window).width();
'.infobox-jagex img'
var excludeterm =
var height = $(window).height();
var resizeratio = Math.min(1, width / 1903 * height / 976);
'.leaflet-tile'
for (i = 0; i < resizeratio * 100; i++) {

var itemz = $('<img src="' + getFileURL('Cow (' + (Math.floor(Math.random() * 3) + 1) + ').png') + '" width="60" height="40">');
var title = mw.config.get('wgTitle')
itemz.css("transform", 'rotate(' + Math.random() + 'turn)');
var query = MD5(title)
itemz.prop("fixed", "true");
if(query == "e8f65c7327e4ae90e767afc30a709419"){
wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>'
var itema = $('<span class="hittable bumper spinny"></span>').append(itemz);
itema.css("left", Math.random() * (width - 60 - 300));
itema.css("top", Math.random() * (height - 60));
itema.css("position", "absolute");
var itemb = $('<span class="hittabletop"></span>').append(itema);
$("#mw-content-text").append(itemb);
}
}
}
if(query == "7dd8d4d08aa31a5c516f21d40a03c8a5"){
$('.bumper').on('mouseover', beginEvade);
wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>'
$('.bumper').on('mouseout', endEvade);
searchterm = '.infobox-monster .infobox-image img'
}
for(var key in TTJlist){
function load(name) {
$("#content").prepend('<img src="'+TTJlist[key]+'" width="1" height="1">')
}
var result;
if (!rswiki.hasLocalStorage()) {
console.warn('Browser does not support localStorage');
return undefined;
}
try {
result = JSON.parse(localStorage.getItem(name));
} catch (err) {
console.warn('Error loading from localStorage');
return undefined;
}
if (result === null) {
if (name == 'apr-weapon') {
return ['Bronze dagger', '0 0', 'red'];
}
}
if(query == "f06eb95413908c7a0be080f82e1f4d56"){
if (name == 'apr-weapon-inv') {
return [['Windows', '0 0', 'white']];
wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>'
searchterm = '.infobox-monster .infobox-image img'
}
}
if (name == 'apr-weapon-buy') {

return [[["Rune 2h sword", "0 0", "rgb(80, 106, 117)"], 50], [["Dragon defender", "0 0", "red"], 50], [["Dragon scimitar", "0 0", "red"], 50], [["Swift blade", "0 0", "rgb(205, 127, 50)"], 50], [["Toxic staff of the dead", "0 0", "rgb(154, 187, 74)"], 50], [["Armadyl godsword", "0 0", "silver"], 73], [["Kodai wand", "0 0", "blue"], 100], [["Ghrazi rapier", "0 0", "silver"], 100], [["3rd age longsword", "0 0", "silver"], 200], [["Twisted bow", "0 0", "black"], 200]];
$(searchterm).not(excludeterm).wrap(wrapper);

if(query == "04f12d4923ec5069ac75e6d364b719cb" && load("apr-totalkills")>=50){
$("#mw-content-text").empty()
var width = $(window).width()
var height = $(window).height()
var resizeratio = Math.min(1,width/1903*height/976)
for(i=0;i<resizeratio*100;i++){
var itemz = $('<img src="'+getFileURL('Cow ('+(Math.floor(Math.random()*3)+1)+').png')+'" width="60" height="40">')
itemz.css("transform",'rotate('+Math.random()+'turn)');
itemz.prop("fixed","true")
var itema = $('<span class="hittable bumper spinny"></span>').append(itemz)
itema.css("left",Math.random()*(width-60-300))
itema.css("top",Math.random()*(height-60))
itema.css("position","absolute")
var itemb = $('<span class="hittabletop"></span>').append(itema)
$("#mw-content-text").append(itemb)
}
}
}
if (name == 'apr-queststate') {

return 1;

$('.bumper').on('mouseover', beginEvade);
$('.bumper').on('mouseout', endEvade);
}

function load(name){
var result
if (!rswiki.hasLocalStorage()) {
console.warn('Browser does not support localStorage');
return undefined;
}
}
if (name == 'apr-slayerstate') {
try {
return 1;
result = JSON.parse(localStorage.getItem(name));
} catch (err) {
console.warn('Error loading from localStorage');
return undefined;
}
}
if (result === null) {
if (name == 'apr-lastslayermaster') {
return "Turael";
if(name == 'apr-weapon'){
return ['Bronze dagger','0 0','red']
}
if(name == 'apr-weapon-inv'){
return [['Windows','0 0','white']]
}
if(name == 'apr-weapon-buy'){
return [
[["Rune 2h sword","0 0","rgb(80, 106, 117)"],50],
[["Dragon defender","0 0","red"],50],
[["Dragon scimitar","0 0","red"],50],
[["Swift blade","0 0","rgb(205, 127, 50)"],50],
[["Toxic staff of the dead","0 0","rgb(154, 187, 74)"],50],
[["Armadyl godsword","0 0","silver"],73],
[["Kodai wand","0 0","blue"],100],
[["Ghrazi rapier","0 0","silver"],100],
[["3rd age longsword","0 0","silver"],200],
[["Twisted bow","0 0","black"],200]
]
}
if(name == 'apr-queststate'){
return 1
}
if(name == 'apr-slayerstate'){
return 1
}
if(name == 'apr-lastslayermaster'){
return "Turael"
}
if(name == 'apr-gp'){
return 0
}
if(name == 'apr-gp-total'){
return 0
}
if(name == 'apr-achievementlist'){
return {}
}
if(name == 'apr-totalkills'){
return 0
}
if(name == 'apr-lightdark'){
return [false,false]
}
if(name == 'apr-gadgetenabled'){
return true
}
}
}
if (name == 'apr-gp') {
return result
return 0;
}


function save(name,value){
if (!rswiki.hasLocalStorage()) {
console.warn('Browser does not support localStorage');
return undefined;
}
}
if (name == 'apr-gp-total') {
var result = localStorage.setItem(name,JSON.stringify(value));
try {
return 0;
}
var ret = JSON.parse(localStorage.getItem(value));
if(ret == result){
if (name == 'apr-achievementlist') {
return true;
return {};
}
}
if (name == 'apr-totalkills') {
console.warn('Error saving to localStorage');
return false;
return 0;
} catch (err) {
}
if (name == 'apr-lightdark') {
console.warn('Error saving to localStorage');
return false;
return [false, false];
}
if (name == 'apr-gadgetenabled') {
return true;
}
}
}
return result;
}
function save(name, value) {
if (!rswiki.hasLocalStorage()) {
console.warn('Browser does not support localStorage');
return undefined;
}
var result = localStorage.setItem(name, JSON.stringify(value));
try {
var ret = JSON.parse(localStorage.getItem(value));
if (ret == result) {
return true;
}
console.warn('Error saving to localStorage');
return false;
} catch (err) {
console.warn('Error saving to localStorage');
return false;
}
}
}

function getCookie(name) {
function getCookie(name) {
var value = "; " + document.cookie;
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
if (parts.length == 2) return parts.pop().split(";").shift();
return false
return false;
}
function MD5(d) {
result = M(V(Y(X(d), 8 * d.length)));
return result.toLowerCase();
}
;
function M(d) {
for (var _, m = "0123456789ABCDEF", f = "", r = 0; r < d.length; r++) _ = d.charCodeAt(r), f += m.charAt(_ >>> 4 & 15) + m.charAt(15 & _);
return f;
}
function X(d) {
for (var _ = Array(d.length >> 2), m = 0; m < _.length; m++) _[m] = 0;
for (m = 0; m < 8 * d.length; m += 8) _[m >> 5] |= (255 & d.charCodeAt(m / 8)) << m % 32;
return _;
}
function V(d) {
for (var _ = "", m = 0; m < 32 * d.length; m += 8) _ += String.fromCharCode(d[m >> 5] >>> m % 32 & 255);
return _;
}
function Y(d, _) {
d[_ >> 5] |= 128 << _ % 32, d[14 + (_ + 64 >>> 9 << 4)] = _;
for (var m = 1732584193, f = -271733879, r = -1732584194, i = 271733878, n = 0; n < d.length; n += 16) {
var h = m,
t = f,
g = r,
e = i;
f = md5_ii(f = md5_ii(f = md5_ii(f = md5_ii(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_ff(f = md5_ff(f = md5_ff(f = md5_ff(f, r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 0], 7, -680876936), f, r, d[n + 1], 12, -389564586), m, f, d[n + 2], 17, 606105819), i, m, d[n + 3], 22, -1044525330), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 4], 7, -176418897), f, r, d[n + 5], 12, 1200080426), m, f, d[n + 6], 17, -1473231341), i, m, d[n + 7], 22, -45705983), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 8], 7, 1770035416), f, r, d[n + 9], 12, -1958414417), m, f, d[n + 10], 17, -42063), i, m, d[n + 11], 22, -1990404162), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 12], 7, 1804603682), f, r, d[n + 13], 12, -40341101), m, f, d[n + 14], 17, -1502002290), i, m, d[n + 15], 22, 1236535329), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 1], 5, -165796510), f, r, d[n + 6], 9, -1069501632), m, f, d[n + 11], 14, 643717713), i, m, d[n + 0], 20, -373897302), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 5], 5, -701558691), f, r, d[n + 10], 9, 38016083), m, f, d[n + 15], 14, -660478335), i, m, d[n + 4], 20, -405537848), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 9], 5, 568446438), f, r, d[n + 14], 9, -1019803690), m, f, d[n + 3], 14, -187363961), i, m, d[n + 8], 20, 1163531501), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 13], 5, -1444681467), f, r, d[n + 2], 9, -51403784), m, f, d[n + 7], 14, 1735328473), i, m, d[n + 12], 20, -1926607734), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 5], 4, -378558), f, r, d[n + 8], 11, -2022574463), m, f, d[n + 11], 16, 1839030562), i, m, d[n + 14], 23, -35309556), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 1], 4, -1530992060), f, r, d[n + 4], 11, 1272893353), m, f, d[n + 7], 16, -155497632), i, m, d[n + 10], 23, -1094730640), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 13], 4, 681279174), f, r, d[n + 0], 11, -358537222), m, f, d[n + 3], 16, -722521979), i, m, d[n + 6], 23, 76029189), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 9], 4, -640364487), f, r, d[n + 12], 11, -421815835), m, f, d[n + 15], 16, 530742520), i, m, d[n + 2], 23, -995338651), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 0], 6, -198630844), f, r, d[n + 7], 10, 1126891415), m, f, d[n + 14], 15, -1416354905), i, m, d[n + 5], 21, -57434055), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 12], 6, 1700485571), f, r, d[n + 3], 10, -1894986606), m, f, d[n + 10], 15, -1051523), i, m, d[n + 1], 21, -2054922799), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 8], 6, 1873313359), f, r, d[n + 15], 10, -30611744), m, f, d[n + 6], 15, -1560198380), i, m, d[n + 13], 21, 1309151649), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 4], 6, -145523070), f, r, d[n + 11], 10, -1120210379), m, f, d[n + 2], 15, 718787259), i, m, d[n + 9], 21, -343485551), m = safe_add(m, h), f = safe_add(f, t), r = safe_add(r, g), i = safe_add(i, e);
}
return Array(m, f, r, i);
}
function md5_cmn(d, _, m, f, r, i) {
return safe_add(bit_rol(safe_add(safe_add(_, d), safe_add(f, i)), r), m);
}
function md5_ff(d, _, m, f, r, i, n) {
return md5_cmn(_ & m | ~_ & f, d, _, r, i, n);
}
function md5_gg(d, _, m, f, r, i, n) {
return md5_cmn(_ & f | m & ~f, d, _, r, i, n);
}
function md5_hh(d, _, m, f, r, i, n) {
return md5_cmn(_ ^ m ^ f, d, _, r, i, n);
}
function md5_ii(d, _, m, f, r, i, n) {
return md5_cmn(m ^ (_ | ~f), d, _, r, i, n);
}
function safe_add(d, _) {
var m = (65535 & d) + (65535 & _);
return (d >> 16) + (_ >> 16) + (m >> 16) << 16 | 65535 & m;
}
function bit_rol(d, _) {
return d << _ | d >>> 32 - _;
}
}

function MD5(d){result = M(V(Y(X(d),8*d.length)));return result.toLowerCase()};function M(d){for(var _,m="0123456789ABCDEF",f="",r=0;r<d.length;r++)_=d.charCodeAt(r),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _}function V(d){for(var _="",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,r=-1732584194,i=271733878,n=0;n<d.length;n+=16){var h=m,t=f,g=r,e=i;f=md5_ii(f=md5_ii(f=md5_ii(f=md5_ii(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_ff(f=md5_ff(f=md5_ff(f=md5_ff(f,r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+0],7,-680876936),f,r,d[n+1],12,-389564586),m,f,d[n+2],17,606105819),i,m,d[n+3],22,-1044525330),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+4],7,-176418897),f,r,d[n+5],12,1200080426),m,f,d[n+6],17,-1473231341),i,m,d[n+7],22,-45705983),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+8],7,1770035416),f,r,d[n+9],12,-1958414417),m,f,d[n+10],17,-42063),i,m,d[n+11],22,-1990404162),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+12],7,1804603682),f,r,d[n+13],12,-40341101),m,f,d[n+14],17,-1502002290),i,m,d[n+15],22,1236535329),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+1],5,-165796510),f,r,d[n+6],9,-1069501632),m,f,d[n+11],14,643717713),i,m,d[n+0],20,-373897302),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+5],5,-701558691),f,r,d[n+10],9,38016083),m,f,d[n+15],14,-660478335),i,m,d[n+4],20,-405537848),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+9],5,568446438),f,r,d[n+14],9,-1019803690),m,f,d[n+3],14,-187363961),i,m,d[n+8],20,1163531501),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+13],5,-1444681467),f,r,d[n+2],9,-51403784),m,f,d[n+7],14,1735328473),i,m,d[n+12],20,-1926607734),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+5],4,-378558),f,r,d[n+8],11,-2022574463),m,f,d[n+11],16,1839030562),i,m,d[n+14],23,-35309556),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+1],4,-1530992060),f,r,d[n+4],11,1272893353),m,f,d[n+7],16,-155497632),i,m,d[n+10],23,-1094730640),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+13],4,681279174),f,r,d[n+0],11,-358537222),m,f,d[n+3],16,-722521979),i,m,d[n+6],23,76029189),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+9],4,-640364487),f,r,d[n+12],11,-421815835),m,f,d[n+15],16,530742520),i,m,d[n+2],23,-995338651),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+0],6,-198630844),f,r,d[n+7],10,1126891415),m,f,d[n+14],15,-1416354905),i,m,d[n+5],21,-57434055),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+12],6,1700485571),f,r,d[n+3],10,-1894986606),m,f,d[n+10],15,-1051523),i,m,d[n+1],21,-2054922799),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+8],6,1873313359),f,r,d[n+15],10,-30611744),m,f,d[n+6],15,-1560198380),i,m,d[n+13],21,1309151649),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+4],6,-145523070),f,r,d[n+11],10,-1120210379),m,f,d[n+2],15,718787259),i,m,d[n+9],21,-343485551),m=safe_add(m,h),f=safe_add(f,t),r=safe_add(r,g),i=safe_add(i,e)}return Array(m,f,r,i)}function md5_cmn(d,_,m,f,r,i){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,i)),r),m)}function md5_ff(d,_,m,f,r,i,n){return md5_cmn(_&m|~_&f,d,_,r,i,n)}function md5_gg(d,_,m,f,r,i,n){return md5_cmn(_&f|m&~f,d,_,r,i,n)}function md5_hh(d,_,m,f,r,i,n){return md5_cmn(_^m^f,d,_,r,i,n)}function md5_ii(d,_,m,f,r,i,n){return md5_cmn(m^(_|~f),d,_,r,i,n)}function safe_add(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}

function getFileURL(filename) {
function getFileURL(filename) {
var base = window.location.origin;
var base = window.location.origin;
filename = filename.replace(/ /g,"_")
filename = filename.replace(/ /g, "_");
filename = filename.replace(/\(/g, '%28').replace(/\)/g, '%29')
filename = filename.replace(/\(/g, '%28').replace(/\)/g, '%29');
return base + '/images/' + filename + '?11112';
return base + '/images/' + filename + '?11112';
}
}
function getDist(x, y) {

return Math.sqrt(x * x + y * y);
function getDist(x,y){
return Math.sqrt(x*x+y*y)
}
}
function disableHighlight() {

if (window.getSelection) {
function disableHighlight(){
if (window.getSelection) {window.getSelection().removeAllRanges();}
window.getSelection().removeAllRanges();
else if (document.selection) {document.selection.empty();}
} else if (document.selection) {
document.selection.empty();
$('body').css("user-select","none")
}
$('body').css("user-select", "none");
}
}

var dialogue = {
var dialogue = {
"IntroPrompt": {
"IntroPrompt": {
Line 306: Line 324:
"initial": "You haven't visited me yet! Come to my page!",
"initial": "You haven't visited me yet! Come to my page!",
"questState": 90,
"questState": 90,
"options": ["I'll come now.","Remind me later","Stop bothering me!"],
"options": ["I'll come now.", "Remind me later", "Stop bothering me!"],
"effects": [{"questState":90},{"questState":75},{"questState":101}],
"effects": [{
"questState": 90
"response": ["Just head over to my wiki page, <a href='https://oldschool.runescape.wiki/w/Wise_Old_Man'>Wise Old Man</a>!","Okay! I'll come back later.","Fair enough... But if ever you change your mind just visit me on my wiki page, <a href='https://oldschool.runescape.wiki/w/Wise_Old_Man'>Wise Old Man</a>!"],
}, {
"questState": 75
}, {
"questState": 101
}],
"response": ["Just head over to my wiki page, <a href='https://oldschool.runescape.wiki/w/Wise_Old_Man'>Wise Old Man</a>!", "Okay! I'll come back later.", "Fair enough... But if ever you change your mind just visit me on my wiki page, <a href='https://oldschool.runescape.wiki/w/Wise_Old_Man'>Wise Old Man</a>!"],
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
"width": 78,
"width": 78,
Line 317: Line 341:
"questState": 101,
"questState": 101,
"options": ["Got it!"],
"options": ["Got it!"],
"effects": [{"questState":110}],
"effects": [{
"questState": 110
}],
"response": ["Good luck! Don't hesitate to talk to me if you get stuck!"],
"response": ["Good luck! Don't hesitate to talk to me if you get stuck!"],
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
Line 343: Line 369:
"Swamp": {
"Swamp": {
"initial": "You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?",
"initial": "You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?",
"options": ["Archer","Monk","Warrior","Wizard"],
"options": ["Archer", "Monk", "Warrior", "Wizard"],
"effects": [{
"effects": [{"redirect":"https://oldschool.runescape.wiki/w/Archer_(Lost_City)"},{"redirect":"https://oldschool.runescape.wiki/w/Monk_(Lost_City)"},{"redirect":"https://oldschool.runescape.wiki/w/Warrior_(Lost_City)"},{"redirect":"https://oldschool.runescape.wiki/w/Wizard_(Lost_City)"}],
"redirect": "https://oldschool.runescape.wiki/w/Archer_(Lost_City)"
"response": ["You talk to the archer.","You talk to the monk.","You talk to the warrior.","You talk to the wizard"],
}, {
"redirect": "https://oldschool.runescape.wiki/w/Monk_(Lost_City)"
}, {
"redirect": "https://oldschool.runescape.wiki/w/Warrior_(Lost_City)"
}, {
"redirect": "https://oldschool.runescape.wiki/w/Wizard_(Lost_City)"
}],
"response": ["You talk to the archer.", "You talk to the monk.", "You talk to the warrior.", "You talk to the wizard"],
"icon": "/images/Fire.gif?76ed2",
"icon": "/images/Fire.gif?76ed2",
"omitY":true,
"omitY": true,
"width": 64,
"width": 64,
"height": 95
"height": 95
Line 354: Line 388:
"initial": "?",
"initial": "?",
"options": ["Why are you guys hanging around here?"],
"options": ["Why are you guys hanging around here?"],
"effects": [{"dialogue":"Archer2"}],
"effects": [{
"dialogue": "Archer2"
}],
"response": ["(ahem)...'Guys'? And that's really none of your business."],
"response": ["(ahem)...'Guys'? And that's really none of your business."],
"icon": "/images/Archer_%28Lost_City%29_chathead.png?a7c88",
"icon": "/images/Archer_%28Lost_City%29_chathead.png?a7c88",
Line 363: Line 399:
"initial": "(ahem)...'Guys'? And that's really none of your business.",
"initial": "(ahem)...'Guys'? And that's really none of your business.",
"options": ["I'll talk to someone else then."],
"options": ["I'll talk to someone else then."],
"effects": [{"dialogue":"Swamp"}],
"effects": [{
"dialogue": "Swamp"
}],
"response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
"response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
"icon": "/images/Archer_%28Lost_City%29_chathead.png?a7c88",
"icon": "/images/Archer_%28Lost_City%29_chathead.png?a7c88",
Line 372: Line 410:
"initial": "?",
"initial": "?",
"options": ["Why are all of you standing around here?"],
"options": ["Why are all of you standing around here?"],
"effects": [{"dialogue":"Monk2"}],
"effects": [{
"dialogue": "Monk2"
}],
"response": ["None of your business. Get lost."],
"response": ["None of your business. Get lost."],
"icon": "/images/Monk_%28Lost_City%29_chathead.png?33896",
"icon": "/images/Monk_%28Lost_City%29_chathead.png?33896",
Line 381: Line 421:
"initial": "None of your business. Get lost.",
"initial": "None of your business. Get lost.",
"options": ["I'll talk to someone else then."],
"options": ["I'll talk to someone else then."],
"effects": [{"dialogue":"Swamp"}],
"effects": [{
"dialogue": "Swamp"
}],
"response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
"response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
"icon": "/images/Monk_%28Lost_City%29_chathead.png?33896",
"icon": "/images/Monk_%28Lost_City%29_chathead.png?33896",
Line 390: Line 432:
"initial": "?",
"initial": "?",
"options": ["Why are all of you standing around here?"],
"options": ["Why are all of you standing around here?"],
"effects": [{"dialogue":"Wizard2"}],
"effects": [{
"dialogue": "Wizard2"
}],
"response": ["Hahaha you dare talk to a mighty wizard such as myself? I bet you can't even cast windstrike yet amateur!"],
"response": ["Hahaha you dare talk to a mighty wizard such as myself? I bet you can't even cast windstrike yet amateur!"],
"icon": "/images/Wizard_%28Lost_City%29_chathead.png?25d4d",
"icon": "/images/Wizard_%28Lost_City%29_chathead.png?25d4d",
Line 399: Line 443:
"initial": "Hahaha you dare talk to a mighty wizard such as myself? I bet you can't even cast windstrike yet amateur!",
"initial": "Hahaha you dare talk to a mighty wizard such as myself? I bet you can't even cast windstrike yet amateur!",
"options": ["I'll talk to someone else then."],
"options": ["I'll talk to someone else then."],
"effects": [{"dialogue":"Swamp"}],
"effects": [{
"dialogue": "Swamp"
}],
"response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
"response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
"icon": "/images/Wizard_%28Lost_City%29_chathead.png?25d4d",
"icon": "/images/Wizard_%28Lost_City%29_chathead.png?25d4d",
Line 407: Line 453:
"Warrior": {
"Warrior": {
"initial": "Hello there traveller. We're looking for Zanaris...GAH! I mean we're not here for any particular reason at all.",
"initial": "Hello there traveller. We're looking for Zanaris...GAH! I mean we're not here for any particular reason at all.",
"options": ["Who's Zanaris?","What's Zanaris?","What makes you think it's out here?"],
"options": ["Who's Zanaris?", "What's Zanaris?", "What makes you think it's out here?"],
"effects": [{"dialogue":"Warrior2"},{},{"dialogue":"Warrior3"}],
"effects": [{
"dialogue": "Warrior2"
"response": ["Ahahahaha! Zanaris isn't a person! It's a magical hidden city filled with treasures and rich.. uh, nothing. It's nothing.","I don't think we want other people competing with us to find it. Forget I said anything.","Don't you know of the legends that tell of the magical city, hidden in the swam... Uh, no, you're right, we're wasting our time here."],
}, {}, {
"dialogue": "Warrior3"
}],
"response": ["Ahahahaha! Zanaris isn't a person! It's a magical hidden city filled with treasures and rich.. uh, nothing. It's nothing.", "I don't think we want other people competing with us to find it. Forget I said anything.", "Don't you know of the legends that tell of the magical city, hidden in the swam... Uh, no, you're right, we're wasting our time here."],
"icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
"icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
"width": 85,
"width": 85,
Line 416: Line 466:
"Warrior2": {
"Warrior2": {
"initial": "Ahahahaha! Zanaris isn't a person! It's a magical hidden city filled with treasures and rich.. uh, nothing. It's nothing.",
"initial": "Ahahahaha! Zanaris isn't a person! It's a magical hidden city filled with treasures and rich.. uh, nothing. It's nothing.",
"options": ["If it's hidden how are you planning to find it?","It looks to me like YOU don't know where it is seeing as you're all just sat around here."],
"options": ["If it's hidden how are you planning to find it?", "It looks to me like YOU don't know where it is seeing as you're all just sat around here."],
"effects": [{},{"questState":120}],
"effects": [{}, {
"questState": 120
"response": ["When we've found Zanaris you'll... GAH! I mean, we're not here for any particular reason at all.","Of course we know! We just haven't found which tree the stupid leprechaun's hiding in yet! GAH! I didn't mean to tell you that! Look, just forget I said anything okay?"],
}],
"response": ["When we've found Zanaris you'll... GAH! I mean, we're not here for any particular reason at all.", "Of course we know! We just haven't found which tree the stupid leprechaun's hiding in yet! GAH! I didn't mean to tell you that! Look, just forget I said anything okay?"],
"icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
"icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
"width": 85,
"width": 85,
Line 425: Line 477:
"Warrior3": {
"Warrior3": {
"initial": "Don't you know of the legends that tell of the magical city, hidden in the swam... Uh, no, you're right, we're wasting our time here.",
"initial": "Don't you know of the legends that tell of the magical city, hidden in the swam... Uh, no, you're right, we're wasting our time here.",
"options": ["If it's hidden how are you planning to find it?","It looks to me like YOU don't know where it is seeing as you're all just sat around here."],
"options": ["If it's hidden how are you planning to find it?", "It looks to me like YOU don't know where it is seeing as you're all just sat around here."],
"effects": [{},{"questState":120}],
"effects": [{}, {
"questState": 120
"response": ["When we've found Zanaris you'll... GAH! I mean, we're not here for any particular reason at all.","Of course we know! We just haven't found which tree the stupid leprechaun's hiding in yet! GAH! I didn't mean to tell you that! Look, just forget I said anything okay?"],
}],
"response": ["When we've found Zanaris you'll... GAH! I mean, we're not here for any particular reason at all.", "Of course we know! We just haven't found which tree the stupid leprechaun's hiding in yet! GAH! I didn't mean to tell you that! Look, just forget I said anything okay?"],
"icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
"icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
"width": 85,
"width": 85,
Line 453: Line 507:
"initial": "Ay yer big elephant! Yer've caught me, to be sure! What would an elephant like yer be wanting wid ol' Shamus then?",
"initial": "Ay yer big elephant! Yer've caught me, to be sure! What would an elephant like yer be wanting wid ol' Shamus then?",
"options": ["I want to find Zanaris."],
"options": ["I want to find Zanaris."],
"effects": [{"dialogue":"Shamus2"}],
"effects": [{
"dialogue": "Shamus2"
}],
"response": ["Zanaris is it now? Well well well... Yer'll be needing to be going to that funny little shed out there in the swamp, so you will."],
"response": ["Zanaris is it now? Well well well... Yer'll be needing to be going to that funny little shed out there in the swamp, so you will."],
"icon": "/images/Shamus_chathead.png?989e1",
"icon": "/images/Shamus_chathead.png?989e1",
Line 462: Line 518:
"initial": "Zanaris is it now? Well well well... Yer'll be needing to be going to that funny little shed out there in the swamp, so you will.",
"initial": "Zanaris is it now? Well well well... Yer'll be needing to be going to that funny little shed out there in the swamp, so you will.",
"options": ["...but... I thought... Zanaris was a city...?"],
"options": ["...but... I thought... Zanaris was a city...?"],
"effects": [{"dialogue":"Shamus3"}],
"effects": [{
"dialogue": "Shamus3"
}],
"response": ["Aye that it is!"],
"response": ["Aye that it is!"],
"icon": "/images/Shamus_chathead.png?989e1",
"icon": "/images/Shamus_chathead.png?989e1",
Line 470: Line 528:
"Shamus3": {
"Shamus3": {
"initial": "Aye that it is!",
"initial": "Aye that it is!",
"options": ["How does it fit in a shed then?","I've been in that shed, I didn't see a city."],
"options": ["How does it fit in a shed then?", "I've been in that shed, I didn't see a city."],
"effects": [{"dialogue":"Shamus4"},{"dialogue":"Shamus4"}],
"effects": [{
"dialogue": "Shamus4"
"response": ["Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed.","Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed."],
}, {
"dialogue": "Shamus4"
}],
"response": ["Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed.", "Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed."],
"icon": "/images/Shamus_chathead.png?989e1",
"icon": "/images/Shamus_chathead.png?989e1",
"width": 92,
"width": 92,
Line 480: Line 542:
"initial": "Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed.",
"initial": "Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed.",
"options": ["So where would I get a staff?"],
"options": ["So where would I get a staff?"],
"effects": [{"questState":130}],
"effects": [{
"questState": 130
}],
"response": ["Dramenwood staffs are crafted from branches of the Dramen tree, so they are. I hear there's a Dramen tree over on the island of Entrana in a cave or some such. There would probably be a good place for an elephant like yer to be starting looking I reckon. The monks are running a ship from Port Sarim to Entrana, I hear too. Now leave me alone yer elephant!"],
"response": ["Dramenwood staffs are crafted from branches of the Dramen tree, so they are. I hear there's a Dramen tree over on the island of Entrana in a cave or some such. There would probably be a good place for an elephant like yer to be starting looking I reckon. The monks are running a ship from Port Sarim to Entrana, I hear too. Now leave me alone yer elephant!"],
"icon": "/images/Shamus_chathead.png?989e1",
"icon": "/images/Shamus_chathead.png?989e1",
Line 497: Line 561:
"Shamus5": {
"Shamus5": {
"initial": "Ay yer big elephant! Yer've caught me, to be sure! What would an elephant like yer be wanting wid ol' Shamus then?",
"initial": "Ay yer big elephant! Yer've caught me, to be sure! What would an elephant like yer be wanting wid ol' Shamus then?",
"options": ["I'm not sure.","How do I get to Zanaris again?"],
"options": ["I'm not sure.", "How do I get to Zanaris again?"],
"effects": [{},{}],
"effects": [{}, {}],
"response": ["Ha! Look at yer! Look at the stupid elephant who tries to go catching a leprechaun when he don't even be knowing what he wants!","Yer stupid elephant! I'll tell yer again! Yer need to be entering the shed in the middle of the swamp while holding a dramenwood staff! Yer can make the Dramen staff from a dramen tree branch, and there's a Dramen tree on Entrana! You get to Entrana from Port Sarim! Now leave me alone yer great elephant!"],
"response": ["Ha! Look at yer! Look at the stupid elephant who tries to go catching a leprechaun when he don't even be knowing what he wants!", "Yer stupid elephant! I'll tell yer again! Yer need to be entering the shed in the middle of the swamp while holding a dramenwood staff! Yer can make the Dramen staff from a dramen tree branch, and there's a Dramen tree on Entrana! You get to Entrana from Port Sarim! Now leave me alone yer great elephant!"],
"icon": "/images/Shamus_chathead.png?989e1",
"icon": "/images/Shamus_chathead.png?989e1",
"width": 92,
"width": 92,
Line 506: Line 570:
"Sarim": {
"Sarim": {
"initial": "Do you seek passage to holy Entrana? If so, you must leave your weaponry and armour behind. This is Saradomin's will.",
"initial": "Do you seek passage to holy Entrana? If so, you must leave your weaponry and armour behind. This is Saradomin's will.",
"options": ["No, not right now","Yes, okay, I'm ready to go"],
"options": ["No, not right now", "Yes, okay, I'm ready to go"],
"effects": [{},{"dialogue":"Sarim2"}],
"effects": [{}, {
"dialogue": "Sarim2"
"response": ["Very well.","NO WEAPONS OR ARMOUR are permitted on holy Entrana AT ALL. We will not allow you to travel there in breach of mighty Saradomin's edict. Come back when you have laid down your Zamorakian instruments of death."],
}],
"response": ["Very well.", "NO WEAPONS OR ARMOUR are permitted on holy Entrana AT ALL. We will not allow you to travel there in breach of mighty Saradomin's edict. Come back when you have laid down your Zamorakian instruments of death."],
"icon": "/images/Monk_of_Entrana_chathead.png?33896",
"icon": "/images/Monk_of_Entrana_chathead.png?33896",
"width": 103,
"width": 103,
Line 516: Line 582:
"initial": "NO WEAPONS OR ARMOUR are permitted on holy Entrana AT ALL. We will not allow you to travel there in breach of mighty Saradomin's edict. Come back when you have laid down your Zamorakian instruments of death.",
"initial": "NO WEAPONS OR ARMOUR are permitted on holy Entrana AT ALL. We will not allow you to travel there in breach of mighty Saradomin's edict. Come back when you have laid down your Zamorakian instruments of death.",
"options": ["Okay, I'll drop my Bronze dagger."],
"options": ["Okay, I'll drop my Bronze dagger."],
"effects": [{
"effects": [{"questState":135,"trigger":8,"redirect":"https://oldschool.runescape.wiki/w/Entrana"}],
"questState": 135,
"trigger": 8,
"redirect": "https://oldschool.runescape.wiki/w/Entrana"
}],
"response": ["All is satisfactory. You may board the boat now. Welcome to Entrana."],
"response": ["All is satisfactory. You may board the boat now. Welcome to Entrana."],
"icon": "/images/Monk_of_Entrana_chathead.png?33896",
"icon": "/images/Monk_of_Entrana_chathead.png?33896",
Line 543: Line 613:
"initial": "Welcome to holy Entrana! Feel free to take a look around.",
"initial": "Welcome to holy Entrana! Feel free to take a look around.",
"options": ["Have you seen any dramen trees around?"],
"options": ["Have you seen any dramen trees around?"],
"effects": [{"questState":140}],
"effects": [{
"questState": 140
}],
"response": ["No, I haven't. I've heard legends that it only grows underground in dungeons. Talk to me again if you need any more help."],
"response": ["No, I haven't. I've heard legends that it only grows underground in dungeons. Talk to me again if you need any more help."],
"icon": "/images/Monk_chathead.png?02814",
"icon": "/images/Monk_chathead.png?02814",
Line 560: Line 632:
"CaveMonk": {
"CaveMonk": {
"initial": "The dramen tree is here in the Entrana dungeon. Be careful going in there! You are unarmed, and there is much evilness lurking down there! The evilness seems to block off our contact with our gods, so our prayers seem to have less effect down there.",
"initial": "The dramen tree is here in the Entrana dungeon. Be careful going in there! You are unarmed, and there is much evilness lurking down there! The evilness seems to block off our contact with our gods, so our prayers seem to have less effect down there.",
"options": ["I don't think I'm strong enough to enter then.","Well that is a risk I will have to take."],
"options": ["I don't think I'm strong enough to enter then.", "Well that is a risk I will have to take."],
"effects": [{"trigger":4},{"dialogue":"TreeSpirit"}],
"effects": [{
"response": ["",""],
"trigger": 4
}, {
"dialogue": "TreeSpirit"
}],
"response": ["", ""],
"icon": "/images/Cave_monk_chathead.png?17eff",
"icon": "/images/Cave_monk_chathead.png?17eff",
"width": 62,
"width": 62,
Line 569: Line 645:
"TreeSpirit": {
"TreeSpirit": {
"initial": "A tree spirit suddenly appears and attacks you!",
"initial": "A tree spirit suddenly appears and attacks you!",
"options": ["Fight back with melee.","Use Water Wave."],
"options": ["Fight back with melee.", "Use Water Wave."],
"effects": [{"trigger":6},{"dialogue":"DramenBranch"}],
"effects": [{
"trigger": 6
"response": ["Oh dear, you are dead.","You successfully defeat the tree spirit! You see the dramen tree nearby and grab a dramen branch."],
}, {
"dialogue": "DramenBranch"
}],
"response": ["Oh dear, you are dead.", "You successfully defeat the tree spirit! You see the dramen tree nearby and grab a dramen branch."],
"icon": "/images/thumb/Tree_spirit_%28Lost_City%29.png/150px-Tree_spirit_%28Lost_City%29.png?2446d",
"icon": "/images/thumb/Tree_spirit_%28Lost_City%29.png/150px-Tree_spirit_%28Lost_City%29.png?2446d",
"omitY":true,
"omitY": true,
"width": 150,
"width": 150,
"height": 283
"height": 283
Line 580: Line 660:
"initial": "You successfully defeat the tree spirit! You see the dramen tree nearby and grab a dramen branch.",
"initial": "You successfully defeat the tree spirit! You see the dramen tree nearby and grab a dramen branch.",
"options": ["Cut it with a knife."],
"options": ["Cut it with a knife."],
"effects": [{"questState":150,"trigger":9}],
"effects": [{
"questState": 150,
"trigger": 9
}],
"response": ["You have obtained a Dramen staff! Why don't you head to the shed to see what happens?"],
"response": ["You have obtained a Dramen staff! Why don't you head to the shed to see what happens?"],
"icon": "/images/thumb/Dramen_tree.png/200px-Dramen_tree.png?c073b",
"icon": "/images/thumb/Dramen_tree.png/200px-Dramen_tree.png?c073b",
"omitY":true,
"omitY": true,
"width": 200,
"width": 200,
"height": 331
"height": 331
Line 602: Line 685:
"response": [],
"response": [],
"icon": "/images/thumb/Dramen_staff_detail.png/150px-Dramen_staff_detail.png?83540",
"icon": "/images/thumb/Dramen_staff_detail.png/150px-Dramen_staff_detail.png?83540",
"omitY":true,
"omitY": true,
"width": 150,
"width": 150,
"height": 152
"height": 152
Line 608: Line 691:
"Swamp2": {
"Swamp2": {
"initial": "You approach the shed.",
"initial": "You approach the shed.",
"options": ["Equip the Dramen staff and then enter the shed.","Enter the shed and then equip the dramen staff"],
"options": ["Equip the Dramen staff and then enter the shed.", "Enter the shed and then equip the dramen staff"],
"effects": [{
"effects": [{"questState":160,"redirect":"https://oldschool.runescape.wiki/w/Zanaris"},{}],
"questState": 160,
"response": ["You enter the shed and everything starts to blur...","Nothing interesting happens."],
"redirect": "https://oldschool.runescape.wiki/w/Zanaris"
}, {}],
"response": ["You enter the shed and everything starts to blur...", "Nothing interesting happens."],
"icon": "/images/thumb/Dramen_staff_detail.png/150px-Dramen_staff_detail.png?83540",
"icon": "/images/thumb/Dramen_staff_detail.png/150px-Dramen_staff_detail.png?83540",
"omitY":true,
"omitY": true,
"width": 150,
"width": 150,
"height": 152
"height": 152
Line 619: Line 705:
"initial": "Congratulations! You found the Lost City of Zanaris! Why don't you head over to see Jukat in the Zanaris Market Area to buy a Dragon dagger?",
"initial": "Congratulations! You found the Lost City of Zanaris! Why don't you head over to see Jukat in the Zanaris Market Area to buy a Dragon dagger?",
"options": ["Ok"],
"options": ["Ok"],
"effects": [{"trigger":4}],
"effects": [{
"trigger": 4
}],
"response": [""],
"response": [""],
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
Line 627: Line 715:
"Jukat": {
"Jukat": {
"initial": "Dragon swords! Here, Dragon swords! Straight from Frenaskrae!",
"initial": "Dragon swords! Here, Dragon swords! Straight from Frenaskrae!",
"options": ["Yes please.","No thanks, I'm just browsing."],
"options": ["Yes please.", "No thanks, I'm just browsing."],
"effects": [{"dialogue":"Jukat2"},{}],
"effects": [{
"dialogue": "Jukat2"
"response": ["Looks like you have exactly 30K coins to buy a Dragon dagger. I'll even throw in some free Weapon poison++!","Okay. Please come back if you would like to buy something."],
}, {}],
"response": ["Looks like you have exactly 30K coins to buy a Dragon dagger. I'll even throw in some free Weapon poison++!", "Okay. Please come back if you would like to buy something."],
"icon": "/images/Jukat_chathead.png?185bb",
"icon": "/images/Jukat_chathead.png?185bb",
"width": 87,
"width": 87,
Line 637: Line 727:
"initial": "Looks like you have exactly 30K coins to buy a Dragon dagger. I'll even throw in some free Weapon poison++!",
"initial": "Looks like you have exactly 30K coins to buy a Dragon dagger. I'll even throw in some free Weapon poison++!",
"options": ["That sounds fine to me. Gimmie!"],
"options": ["That sounds fine to me. Gimmie!"],
"effects": [{"trigger":3,"questState":500,"dialogue":"Jukat3"}],
"effects": [{
"trigger": 3,
"questState": 500,
"dialogue": "Jukat3"
}],
"response": [""],
"response": [""],
"icon": "/images/Jukat_chathead.png?ba968",
"icon": "/images/Jukat_chathead.png?ba968",
Line 772: Line 866:
"Slayer": {
"Slayer": {
"initial": "'Ello, and what are you after then?",
"initial": "'Ello, and what are you after then?",
"options": ["I need another assignment.","Have you any rewards for me, or anything to trade?","Let's talk about the difficulty of my assignments.","Er... Nothing..."],
"options": ["I need another assignment.", "Have you any rewards for me, or anything to trade?", "Let's talk about the difficulty of my assignments.", "Er... Nothing..."],
"effects": [{},{},{},{"trigger":4}],
"effects": [{}, {}, {}, {
"trigger": 4
"response": ["","","The Slayer Masters may currently assign you any task in our lists, regardless of your combat level.",""],
}],
"response": ["", "", "The Slayer Masters may currently assign you any task in our lists, regardless of your combat level.", ""]
},
},
"Nieve": {
"Nieve": {
"initial": "...",
"initial": "...",
"options": ["..."],
"options": ["..."],
"effects": [{"trigger":4}],
"effects": [{
"trigger": 4
}],
"response": [""],
"response": [""],
"icon": "/images/thumb/Coffin_detail.png/130px-Coffin_detail.png?9d094",
"icon": "/images/thumb/Coffin_detail.png/130px-Coffin_detail.png?9d094",
Line 814: Line 912:
"Crab": {
"Crab": {
"initial": "Reset all quest and achievement data?",
"initial": "Reset all quest and achievement data?",
"options": ["Yes","No"],
"options": ["Yes", "No"],
"effects": [{"trigger":1},{}],
"effects": [{
"trigger": 1
"response": ["Done. Reload the page.","Okay, I won't."],
}, {}],
"response": ["Done. Reload the page.", "Okay, I won't."],
"icon": "/images/thumb/Crab.png/220px-Crab.png?e81ce",
"icon": "/images/thumb/Crab.png/220px-Crab.png?e81ce",
"width": 220,
"width": 220,
Line 856: Line 956:
"questState": 501,
"questState": 501,
"options": ["Got it!"],
"options": ["Got it!"],
"effects": [{"questState":502}],
"effects": [{
"questState": 502
}],
"response": ["Good luck! Don't hesitate to talk to me if you get stuck!"],
"response": ["Good luck! Don't hesitate to talk to me if you get stuck!"],
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
"width": 78,
"width": 78,
"height": 148
"height": 148
},
}
}
};
var masters = {
var masters = {
"Turael": {
"Turael": {
Line 903: Line 1,005:
"width": 66,
"width": 66,
"height": 102
"height": 102
},
}
};

function crab(conversationoverride, datum) {
}
$('#crob').remove();

function crab(conversationoverride,datum){
if (conversationoverride === undefined) {
var questState = load("apr-queststate");
$('#crob').remove();
if(conversationoverride === undefined){
if (questState === undefined) {
return;
var questState = load("apr-queststate")
if(questState === undefined){
return
}
if (mw.config.get('wgNamespaceNumber') != 0 && mw.config.get('wgNamespaceNumber') != 116) {
return;
}
}
}
if (mw.config.get('wgNamespaceNumber') != 0 && mw.config.get('wgNamespaceNumber') != 116) {

return;
var pagename = mw.config.get('wgTitle');
var namespace = mw.config.get('wgCanonicalNamespace');
var categories = mw.config.get('wgCategories');

var conversation = null;
if(conversationoverride in dialogue){
conversation = dialogue[conversationoverride];
if(conversationoverride == "Poor"){
conversation.initial = "You are too poor to afford that item! You need "+datum+",000 GP to buy this item."
}
if(conversationoverride == "DeadCucco"){
conversation.initial = "Oh dear, you are dead. You survived the onslaught of "+datum+" Cuccos."
}
if(conversationoverride == "CuccoEscape"){
conversation.initial = "You managed to run away from the Cuccos after "+datum+" Cuccos appeared!"
}
if(conversationoverride == "FireCape"){
if(achievementsOpen){return}
conversation.initial = "You even defeated TzTok-Jad, I am most impressed! Please accept this gift. Give cape back to me if you not want it. Your kill time was "+Math.floor(datum/100)/10+" seconds."
}
if(conversationoverride == "Invaders"){
conversation.initial = "Congratulations on defeating the Penance! It took you about "+Math.floor(datum/4)/10+" seconds!"
}
if(conversationoverride == "SlayerWin"){
if(achievementsOpen){return}
conversation.initial = "Human! You have defeated the Alchemical Hydra! Your kill time was "+Math.floor(datum/100)/10+" seconds."
}
} else {
if(questState === 1){
var WOMtime = (new Date).getTime();
var WOMchance = Math.max(0,Math.min(1,(WOMtime - 1585699200000)/86400000))
WOMchance = WOMchance*WOMchance+0.005
console.log(WOMchance)
if(Math.random()<WOMchance){
conversation = dialogue["IntroPrompt"]
}
}
if(questState > 1 && questState < 100) {
save("apr-queststate",questState + 1)
}
if(questState == 100){
conversation = dialogue["IntroReminder"]
}
if(questState > 1 && questState <= 101) {
if(pagename == "Wise Old Man"){
conversation = dialogue["WiseOldMan"]
}
}
if(questState == 110) {
if(pagename == "Wise Old Man"){
conversation = dialogue["WiseOldManHelp"]
}
if(pagename == "Lumbridge Swamp"){
conversation = dialogue["Swamp"]
}
if(pagename == "Archer (Lost City)"){
conversation = dialogue["Archer"]
}
if(pagename == "Monk (Lost City)"){
conversation = dialogue["Monk"]
}
if(pagename == "Wizard (Lost City)"){
conversation = dialogue["Wizard"]
}
if(pagename == "Warrior (Lost City)"){
conversation = dialogue["Warrior"]
}
}
if(questState == 120) {
if(pagename == "Wise Old Man"){
conversation = dialogue["WiseOldManHelp120"]
}
if(pagename == "Warrior (Lost City)"){
conversation = dialogue["Warrior4"]
}
if(pagename == "Shamus"){
conversation = dialogue["Shamus"]
}
}
if(questState == 130) {
if(pagename == "Wise Old Man"){
conversation = dialogue["WiseOldManHelp130"]
}
if(pagename == "Shamus"){
conversation = dialogue["Shamus5"]
}
if(pagename == "Port Sarim" || pagename == "Monk of Entrana"){
conversation = dialogue["Sarim"]
}
}
if(questState == 135) {
if(pagename == "Wise Old Man"){
conversation = dialogue["WiseOldManHelp135140"]
}
if(pagename == "Port Sarim" || pagename == "Monk of Entrana"){
conversation = dialogue["Sarim3"]
}
if(pagename == "Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)"){
conversation = dialogue["Entrana"]
}
}
if(questState == 140) {
if(pagename == "Wise Old Man"){
conversation = dialogue["WiseOldManHelp135140"]
}
if(pagename == "Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)"){
conversation = dialogue["Entrana2"]
}
if(pagename == "Cave monk" || pagename == "Entrana Dungeon" || pagename == "Tree spirit (Lost City)"){
conversation = dialogue["CaveMonk"]
}
}
if(questState == 150) {
if(pagename == "Wise Old Man"){
conversation = dialogue["WiseOldManHelp150"]
}
if(pagename == "Entrana" || pagename == "Monk of Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)" || pagename == "Cave monk" || pagename == "Entrana Dungeon" || pagename == "Dramen tree" || pagename == "Dramen staff" || pagename == "Dramen branch" || pagename == "Tree spirit (Lost City)"){
conversation = dialogue["DramenReminder"]
}
if(pagename == "Lumbridge Swamp"){
conversation = dialogue["Swamp2"]
}
}
if(questState == 160) {
if(pagename == "Zanaris" || pagename == "Wise Old Man"){
conversation = dialogue["Zanaris"]
}
if(pagename == "Jukat" || pagename == "Jukat (shop)"){
conversation = dialogue["Jukat"]
}
}
if(questState >= 101 && questState <= 200){
if(pagename == "Lost City" || pagename == "Lost City/Quick guide"){
conversation = dialogue["Judged"]
}
}
if(questState == 500){
if(pagename == "Wise Old Man" || Math.random()<0.2){
conversation = dialogue["SlashDDS"]
}
}
if(questState == 501){
if(pagename == "Wise Old Man" || Math.random()<0.05){
conversation = dialogue["SlashDDS"]
}
}
if(questState == 502){
if(pagename == "Wise Old Man"){
conversation = dialogue["SlashDDS"]
}
}
if(questState >= 1000){
var slayerState = load("apr-slayerstate")
if(slayerState <= 19){
if(pagename == "Nieve"){
conversation = dialogue["Nieve"]
}
}
if(slayerState >= 1 && slayerState <= 19 && pagename in masters){
conversation = dialogue["Slayer"]
if(slayerState == 1){
conversation.effects[0] = {"slayerState":2}
conversation.response[0] = "Excellent, you're doing great. Your new task is to kill 13 fever spiders."
} else if(slayerState >= 2 && slayerState <= 16) {
conversation.effects[0] = {}
var remaining = Math.min(13,17-slayerState)
conversation.response[0] = "You're still hunting fever spiders; you have "+remaining+" to go. Come back when you've finished your task."
} else if(slayerState == 17) {
conversation.effects[0] = {"slayerState":18}
conversation.response[0] = "Excellent, you're doing great. Your new task is to kill 1 Alchemical Hydra."
} else if(slayerState == 18) {
conversation.effects[0] = {}
conversation.response[0] = "You're still hunting Alchemical Hydras; you have 1 to go. Come back when you've finished your task."
} else if(slayerState == 19) {
conversation.effects[0] = {"slayerState":20}
conversation.response[0] = "Sorry, I don't have any more tasks for you right now. We need to practice sustainable Slaying to avoid depleting all the monsters in our environment."
}
if( (slayerState >= 1 && slayerState <= 2) || slayerState == 17 || slayerState == 19){
conversation.effects[1] = {}
conversation.response[1]= "I have quite a few rewards you can earn, and a wide variety of Slayer equipment for sale. Come back if you realize you need any equipment."
} else if(slayerState == 3){
conversation.effects[1] = {"slayerState":4}
conversation.response[1]= "I hear you've been having trouble against the Fever spiders. Equip these Slayer gloves to protect against disease. Don't forget to wash your hands and practice social distancing."
} else if(slayerState >= 4 && slayerState <= 16){
conversation.effects[1] = {}
conversation.response[1]= "I already gave you some Slayer gloves! This will allow you to kill the Fever spiders."
} else if(slayerState == 18){
conversation.effects[1] = {}
conversation.response[1]= "You already got Boots of brimstone from the Grand Exchange. Why are you looking at me?"
}
conversation.icon = masters[pagename].icon
conversation.width = masters[pagename].width
conversation.height = masters[pagename].height
save("apr-lastslayermaster",pagename)
}
if(slayerState == 3 && pagename == 'Slayer Equipment (shop)'){
pagename = load("apr-lastslayermaster")
conversation = dialogue["Slayer"]
conversation.response[0] = "You're still hunting fever spiders; you have 13 to go. Come back when you've finished your task."
conversation.effects[1] = {"slayerState":4}
conversation.response[1]= "I hear you've been having trouble against the Fever spiders. Equip these Slayer gloves to protect against disease. Don't forget to wash your hands and practice social distancing."
conversation.icon = masters[pagename].icon
conversation.width = masters[pagename].width
conversation.height = masters[pagename].height
}
if(pagename == "Crab"){
conversation = dialogue["Crab"]
}
if(MD5(pagename) == "da3daba59031da284264382eaa6171e2"){
conversation = dialogue["OldWOM"]
displayAchievement("OldWOM")
}
}
}
}
}
if(conversation === null){
var pagename = mw.config.get('wgTitle');
return
var namespace = mw.config.get('wgCanonicalNamespace');
var categories = mw.config.get('wgCategories');
var conversation = null;
if (conversationoverride in dialogue) {
conversation = dialogue[conversationoverride];
if (conversationoverride == "Poor") {
conversation.initial = "You are too poor to afford that item! You need " + datum + ",000 GP to buy this item.";
}
}
if (conversationoverride == "DeadCucco") {
conversation.initial = "Oh dear, you are dead. You survived the onslaught of " + datum + " Cuccos.";
var bubblex, chatboxx
if(conversation.bubblex === undefined){
bubblex = conversation.width
} else {
bubblex = conversation.bubblex
}
}
if(conversation.chatboxx === undefined){
if (conversationoverride == "CuccoEscape") {
conversation.initial = "You managed to run away from the Cuccos after " + datum + " Cuccos appeared!";
chatboxx = Math.max(200, bubblex+48)
} else {
chatboxx = conversation.chatboxx
}
}
if (conversationoverride == "FireCape") {
if (achievementsOpen) {
var ybubble = ''
return;
if(!("omitY" in conversation)){
}
ybubble = "<div id=\"crob-speech-arrow\" style=' width: 0; position: relative; bottom: 3px; left: "+bubblex+"px; border-top: 15px solid #FFFDCC; border-left: 0 solid transparent; border-right: 10px solid transparent; filter: drop-shadow(-1px 1px 0 #000) drop-shadow(0 1px 0 #000);'></div>"
conversation.initial = "You even defeated TzTok-Jad, I am most impressed! Please accept this gift. Give cape back to me if you not want it. Your kill time was " + Math.floor(datum / 100) / 10 + " seconds.";
}
}
if (conversationoverride == "Invaders") {

conversation.initial = "Congratulations on defeating the Penance! It took you about " + Math.floor(datum / 4) / 10 + " seconds!";
var $div = $("<div id=\"crob\" style='color: black; z-index: 999999999; position: fixed;bottom: 20px;left: 30px;'><div id=\"crob-speech\" style=' position: fixed;bottom: "+(36+conversation.height)+"px;left: 15px;background-color: #FFFDCC;width: "+chatboxx+"px;border: 1px solid black;border-radius: 7px;'><div id=\"crob-speech-text\" style=' margin: 7px 10px;font-family: Arial;font-size: 13px;'></div></div>"+ybubble+"<div id=\"crob-icon\" style=\"background: url("+conversation.icon+") no-repeat;height:"+conversation.height+"px;width:"+conversation.width+"px\"></div></div>")

var $buttons = $("<div id=\"crob-speech-buttons\" style=' font-family: Arial;font-size: 14px;position: relative;text-align: center;border-top: 1px solid #C2C2C2;bottom: 0;margin: 7px 7px 10px 7px;'></div>")

var $button = $("<button class=\"crob-button\" style=' background-color: #FFFDCC;border: 1px solid #C2C2C2;border-radius: 3px;padding: 5px 12px;margin: 10px 5px 0 5px;'>No</button>")

$('#firstHeading').after($div);
$("#crob-speech-text").html(conversation.initial);
if (conversation.options.length > 0) {
$("#crob-speech-text").after($buttons);
}
}
if("omitY" in conversation){
if (conversationoverride == "SlayerWin") {
if (achievementsOpen) {
$("crob-speech-arrow").remove()
return;
}
conversation.initial = "Human! You have defeated the Alchemical Hydra! Your kill time was " + Math.floor(datum / 100) / 10 + " seconds.";
}
}
} else {
if("omitIcon" in conversation){
if (questState === 1) {
$("crob-icon").remove()
var WOMtime = new Date().getTime();
var WOMchance = Math.max(0, Math.min(1, (WOMtime - 1585699200000) / 86400000));
WOMchance = WOMchance * WOMchance + 0.005;
console.log(WOMchance);
if (Math.random() < WOMchance) {
conversation = dialogue["IntroPrompt"];
}
}
}
if (questState > 1 && questState < 100) {

save("apr-queststate", questState + 1);
var onClick = function(event) {
}
$("#crob-speech-text").html($(event.target).attr('data-response'));
if (questState == 100) {
$("#crob-speech-buttons").remove();
conversation = dialogue["IntroReminder"];
if('questState' in event.data){
}
save("apr-queststate",event.data.questState)
if (questState > 1 && questState <= 101) {
if (pagename == "Wise Old Man") {
conversation = dialogue["WiseOldMan"];
}
}
if (questState == 110) {
if (pagename == "Wise Old Man") {
conversation = dialogue["WiseOldManHelp"];
}
if (pagename == "Lumbridge Swamp") {
conversation = dialogue["Swamp"];
}
if (pagename == "Archer (Lost City)") {
conversation = dialogue["Archer"];
}
if (pagename == "Monk (Lost City)") {
conversation = dialogue["Monk"];
}
if (pagename == "Wizard (Lost City)") {
conversation = dialogue["Wizard"];
}
if (pagename == "Warrior (Lost City)") {
conversation = dialogue["Warrior"];
}
}
if (questState == 120) {
if (pagename == "Wise Old Man") {
conversation = dialogue["WiseOldManHelp120"];
}
if (pagename == "Warrior (Lost City)") {
conversation = dialogue["Warrior4"];
}
if (pagename == "Shamus") {
conversation = dialogue["Shamus"];
}
}
if (questState == 130) {
if (pagename == "Wise Old Man") {
conversation = dialogue["WiseOldManHelp130"];
}
if (pagename == "Shamus") {
conversation = dialogue["Shamus5"];
}
if (pagename == "Port Sarim" || pagename == "Monk of Entrana") {
conversation = dialogue["Sarim"];
}
}
if (questState == 135) {
if (pagename == "Wise Old Man") {
conversation = dialogue["WiseOldManHelp135140"];
}
if (pagename == "Port Sarim" || pagename == "Monk of Entrana") {
conversation = dialogue["Sarim3"];
}
if (pagename == "Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)") {
conversation = dialogue["Entrana"];
}
}
if (questState == 140) {
if (pagename == "Wise Old Man") {
conversation = dialogue["WiseOldManHelp135140"];
}
if (pagename == "Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)") {
conversation = dialogue["Entrana2"];
}
if (pagename == "Cave monk" || pagename == "Entrana Dungeon" || pagename == "Tree spirit (Lost City)") {
conversation = dialogue["CaveMonk"];
}
}
if (questState == 150) {
if (pagename == "Wise Old Man") {
conversation = dialogue["WiseOldManHelp150"];
}
if (pagename == "Entrana" || pagename == "Monk of Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)" || pagename == "Cave monk" || pagename == "Entrana Dungeon" || pagename == "Dramen tree" || pagename == "Dramen staff" || pagename == "Dramen branch" || pagename == "Tree spirit (Lost City)") {
conversation = dialogue["DramenReminder"];
}
if (pagename == "Lumbridge Swamp") {
conversation = dialogue["Swamp2"];
}
}
if (questState == 160) {
if (pagename == "Zanaris" || pagename == "Wise Old Man") {
conversation = dialogue["Zanaris"];
}
if (pagename == "Jukat" || pagename == "Jukat (shop)") {
conversation = dialogue["Jukat"];
}
}
if (questState >= 101 && questState <= 200) {
if (pagename == "Lost City" || pagename == "Lost City/Quick guide") {
conversation = dialogue["Judged"];
}
}
if (questState == 500) {
if (pagename == "Wise Old Man" || Math.random() < 0.2) {
conversation = dialogue["SlashDDS"];
}
}
if (questState == 501) {
if (pagename == "Wise Old Man" || Math.random() < 0.05) {
conversation = dialogue["SlashDDS"];
}
}
if (questState == 502) {
if (pagename == "Wise Old Man") {
conversation = dialogue["SlashDDS"];
}
}
if (questState >= 1000) {
var slayerState = load("apr-slayerstate");
if (slayerState <= 19) {
if (pagename == "Nieve") {
conversation = dialogue["Nieve"];
}
}
}
if('slayerState' in event.data){
save("apr-slayerstate",event.data.slayerState)
if (slayerState >= 1 && slayerState <= 19 && pagename in masters) {
conversation = dialogue["Slayer"];
if (slayerState == 1) {
conversation.effects[0] = {
"slayerState": 2
};
conversation.response[0] = "Excellent, you're doing great. Your new task is to kill 13 fever spiders.";
} else if (slayerState >= 2 && slayerState <= 16) {
conversation.effects[0] = {};
var remaining = Math.min(13, 17 - slayerState);
conversation.response[0] = "You're still hunting fever spiders; you have " + remaining + " to go. Come back when you've finished your task.";
} else if (slayerState == 17) {
conversation.effects[0] = {
"slayerState": 18
};
conversation.response[0] = "Excellent, you're doing great. Your new task is to kill 1 Alchemical Hydra.";
} else if (slayerState == 18) {
conversation.effects[0] = {};
conversation.response[0] = "You're still hunting Alchemical Hydras; you have 1 to go. Come back when you've finished your task.";
} else if (slayerState == 19) {
conversation.effects[0] = {
"slayerState": 20
};
conversation.response[0] = "Sorry, I don't have any more tasks for you right now. We need to practice sustainable Slaying to avoid depleting all the monsters in our environment.";
}
}
if (slayerState >= 1 && slayerState <= 2 || slayerState == 17 || slayerState == 19) {
if('trigger' in event.data){
if(event.data.trigger == 1){
conversation.effects[1] = {};
conversation.response[1] = "I have quite a few rewards you can earn, and a wide variety of Slayer equipment for sale. Come back if you realize you need any equipment.";
localStorage.removeItem("apr-queststate")
} else if (slayerState == 3) {
localStorage.removeItem("apr-weapon")
conversation.effects[1] = {

localStorage.removeItem("apr-weapon-inv")
"slayerState": 4
};
localStorage.removeItem("apr-weapon-buy")
conversation.response[1] = "I hear you've been having trouble against the Fever spiders. Equip these Slayer gloves to protect against disease. Don't forget to wash your hands and practice social distancing.";

} else if (slayerState >= 4 && slayerState <= 16) {
localStorage.removeItem("apr-achievementlist")
conversation.effects[1] = {};
localStorage.removeItem("apr-totalkills")
conversation.response[1] = "I already gave you some Slayer gloves! This will allow you to kill the Fever spiders.";
localStorage.removeItem("apr-lightdark")
} else if (slayerState == 18) {
localStorage.removeItem("apr-gp")
conversation.effects[1] = {};
localStorage.removeItem("apr-gp-total")
conversation.response[1] = "You already got Boots of brimstone from the Grand Exchange. Why are you looking at me?";
localStorage.removeItem("apr-slayerstate")
localStorage.removeItem("apr-lastslayermaster")

localStorage.removeItem("apr-gadgetenabled")
} else if(event.data.trigger == 2){
save("apr-queststate",160)
localStorage.removeItem("apr-weapon")

localStorage.removeItem("apr-weapon-inv")
localStorage.removeItem("apr-weapon-buy")

localStorage.removeItem("apr-achievementlist")
localStorage.removeItem("apr-totalkills")
localStorage.removeItem("apr-lightdark")
localStorage.removeItem("apr-gp")
localStorage.removeItem("apr-gp-total")
localStorage.removeItem("apr-slayerstate")
localStorage.removeItem("apr-lastslayermaster")

localStorage.removeItem("apr-gadgetenabled")
} else if(event.data.trigger == 3){
save("apr-weapon",['Dragon dagger(p++)','0 0','red'])
enableDDS(['Dragon dagger(p++)','0 0','red']);
} else if(event.data.trigger == 4){
$("#crob-speech,#crob-speech-arrow").remove()
} else if(event.data.trigger == 6){
disableDDS(["/images/Skull_%28status%29_icon.png?fa6d8","13 0",'white'])
} else if(event.data.trigger == 7){
$('#crob').remove();
} else if(event.data.trigger == 8){
save("apr-weapon",['Windows','0 0','white'])
disableDDS(['Windows','0 0','white']);
} else if(event.data.trigger == 9){
save("apr-weapon",['Dramen staff','6 0','brown'])
disableDDS(['Dramen staff','6 0','brown']);
} else if(event.data.trigger == 11){
displayAchievement("FirstHit")
achievements.forEach(function(achievement,achievementref){
displayAchievement(achievementref)
})
}
}
if('dialogue' in event.data){
$('#crob').remove();
crab(event.data.dialogue)
}
if('redirect' in event.data){
window.location.href = event.data.redirect;
}
}
conversation.icon = masters[pagename].icon;
conversation.width = masters[pagename].width;
conversation.height = masters[pagename].height;
save("apr-lastslayermaster", pagename);
}
if (slayerState == 3 && pagename == 'Slayer Equipment (shop)') {
pagename = load("apr-lastslayermaster");
conversation = dialogue["Slayer"];
conversation.response[0] = "You're still hunting fever spiders; you have 13 to go. Come back when you've finished your task.";
conversation.effects[1] = {
"slayerState": 4
};
conversation.response[1] = "I hear you've been having trouble against the Fever spiders. Equip these Slayer gloves to protect against disease. Don't forget to wash your hands and practice social distancing.";
conversation.icon = masters[pagename].icon;
conversation.width = masters[pagename].width;
conversation.height = masters[pagename].height;
}
if (pagename == "Crab") {
conversation = dialogue["Crab"];
}
if (MD5(pagename) == "da3daba59031da284264382eaa6171e2") {
conversation = dialogue["OldWOM"];
displayAchievement("OldWOM");
}
}
}
}
for (var i = 0; i < conversation.options.length; i++) {
if (conversation === null) {
var butt = $button.clone();
return;
butt.text(conversation.options[i])
}
butt.attr("data-response", conversation.response[i])
var bubblex, chatboxx;
butt.click(conversation.effects[i],onClick);
if (conversation.bubblex === undefined) {
$("#crob-speech-buttons").append(butt);
bubblex = conversation.width;
} else {
bubblex = conversation.bubblex;
}
if (conversation.chatboxx === undefined) {
chatboxx = Math.max(200, bubblex + 48);
} else {
chatboxx = conversation.chatboxx;
}
var ybubble = '';
if (!("omitY" in conversation)) {
ybubble = "<div id=\"crob-speech-arrow\" style=' width: 0; position: relative; bottom: 3px; left: " + bubblex + "px; border-top: 15px solid #FFFDCC; border-left: 0 solid transparent; border-right: 10px solid transparent; filter: drop-shadow(-1px 1px 0 #000) drop-shadow(0 1px 0 #000);'></div>";
}
var $div = $("<div id=\"crob\" style='color: black; z-index: 999999999; position: fixed;bottom: 20px;left: 30px;'><div id=\"crob-speech\" style=' position: fixed;bottom: " + (36 + conversation.height) + "px;left: 15px;background-color: #FFFDCC;width: " + chatboxx + "px;border: 1px solid black;border-radius: 7px;'><div id=\"crob-speech-text\" style=' margin: 7px 10px;font-family: Arial;font-size: 13px;'></div></div>" + ybubble + "<div id=\"crob-icon\" style=\"background: url(" + conversation.icon + ") no-repeat;height:" + conversation.height + "px;width:" + conversation.width + "px\"></div></div>");
var $buttons = $("<div id=\"crob-speech-buttons\" style=' font-family: Arial;font-size: 14px;position: relative;text-align: center;border-top: 1px solid #C2C2C2;bottom: 0;margin: 7px 7px 10px 7px;'></div>");
var $button = $("<button class=\"crob-button\" style=' background-color: #FFFDCC;border: 1px solid #C2C2C2;border-radius: 3px;padding: 5px 12px;margin: 10px 5px 0 5px;'>No</button>");
$('#firstHeading').after($div);
$("#crob-speech-text").html(conversation.initial);
if (conversation.options.length > 0) {
$("#crob-speech-text").after($buttons);
}
if ("omitY" in conversation) {
$("crob-speech-arrow").remove();
}
if ("omitIcon" in conversation) {
$("crob-icon").remove();
}
var onClick = function onClick(event) {
$("#crob-speech-text").html($(event.target).attr('data-response'));
$("#crob-speech-buttons").remove();
if ('questState' in event.data) {
save("apr-queststate", event.data.questState);
}
}
if('questState' in conversation){
if ('slayerState' in event.data) {
save("apr-queststate",conversation.questState);
save("apr-slayerstate", event.data.slayerState);
}
}
if('trigger' in conversation){
if ('trigger' in event.data) {
if(conversation.trigger == 4){
if (event.data.trigger == 1) {
localStorage.removeItem("apr-queststate");
$("#crob-speech,#crob-speech-arrow").remove()
localStorage.removeItem("apr-weapon");
} else if(conversation.trigger == 5){
localStorage.removeItem("apr-weapon-inv");
disableDDS(["/images/Skull_%28status%29_icon.png?fa6d8","13 0","white"])
displayAchievement("Died");
localStorage.removeItem("apr-weapon-buy");
localStorage.removeItem("apr-achievementlist");
} else if(conversation.trigger == 10){
localStorage.removeItem("apr-totalkills");
$("#crob-speech,#crob-speech-arrow").remove()
localStorage.removeItem("apr-lightdark");
$('<div id="crob-X" style="width:23px;height:23px;left:414px;position:relative;top:50px;cursor:default;"></div>').appendTo($('div#crob > div')).click(function(){$('#crob').remove();})
localStorage.removeItem("apr-gp");
}
localStorage.removeItem("apr-gp-total");
localStorage.removeItem("apr-slayerstate");
localStorage.removeItem("apr-lastslayermaster");
localStorage.removeItem("apr-gadgetenabled");
} else if (event.data.trigger == 2) {
save("apr-queststate", 160);
localStorage.removeItem("apr-weapon");
localStorage.removeItem("apr-weapon-inv");
localStorage.removeItem("apr-weapon-buy");
localStorage.removeItem("apr-achievementlist");
localStorage.removeItem("apr-totalkills");
localStorage.removeItem("apr-lightdark");
localStorage.removeItem("apr-gp");
localStorage.removeItem("apr-gp-total");
localStorage.removeItem("apr-slayerstate");
localStorage.removeItem("apr-lastslayermaster");
localStorage.removeItem("apr-gadgetenabled");
} else if (event.data.trigger == 3) {
save("apr-weapon", ['Dragon dagger(p++)', '0 0', 'red']);
enableDDS(['Dragon dagger(p++)', '0 0', 'red']);
} else if (event.data.trigger == 4) {
$("#crob-speech,#crob-speech-arrow").remove();
} else if (event.data.trigger == 6) {
disableDDS(["/images/Skull_%28status%29_icon.png?fa6d8", "13 0", 'white']);
} else if (event.data.trigger == 7) {
$('#crob').remove();
} else if (event.data.trigger == 8) {
save("apr-weapon", ['Windows', '0 0', 'white']);
disableDDS(['Windows', '0 0', 'white']);
} else if (event.data.trigger == 9) {
save("apr-weapon", ['Dramen staff', '6 0', 'brown']);
disableDDS(['Dramen staff', '6 0', 'brown']);
} else if (event.data.trigger == 11) {
displayAchievement("FirstHit");
achievements.forEach(function (achievement, achievementref) {
displayAchievement(achievementref);
});
}
}
}
if ('dialogue' in event.data) {
$('#crob').remove();
crab(event.data.dialogue);
}
if ('redirect' in event.data) {
window.location.href = event.data.redirect;
}
};
for (var i = 0; i < conversation.options.length; i++) {
var butt = $button.clone();
butt.text(conversation.options[i]);
butt.attr("data-response", conversation.response[i]);
butt.click(conversation.effects[i], onClick);
$("#crob-speech-buttons").append(butt);
}
if ('questState' in conversation) {
save("apr-queststate", conversation.questState);
}
if ('trigger' in conversation) {
if (conversation.trigger == 4) {
$("#crob-speech,#crob-speech-arrow").remove();
} else if (conversation.trigger == 5) {
disableDDS(["/images/Skull_%28status%29_icon.png?fa6d8", "13 0", "white"]);
displayAchievement("Died");
} else if (conversation.trigger == 10) {
$("#crob-speech,#crob-speech-arrow").remove();
$('<div id="crob-X" style="width:23px;height:23px;left:414px;position:relative;top:50px;cursor:default;"></div>').appendTo($('div#crob > div')).click(function () {
$('#crob').remove();
});
}
}
}
}
function AH(npc) {

function AH(npc){
$(document).mouseleave(function () {
if (DDSenabled) {
$(document).mouseleave(function () {
if(DDSenabled){
DDSenabled = false;
crab("AHEscape");
DDSenabled = false
crab("AHEscape")
}
});

var AHRanged = function(npc,offsetx,offsety){
var startx = npc.dom.getBoundingClientRect().left + npc.width/2 + offsetx
var starty = npc.dom.getBoundingClientRect().top + npc.height/2 + offsety
projectileTracked("/images/Alchemical_Hydra_ranged_projectile.png?2a2bc","apr-hydra-ranged",80,80/1561*585,startx,starty,20,150,0)
}
}
});

var AHMagic = function(npc,offsetx,offsety){
var AHRanged = function AHRanged(npc, offsetx, offsety) {
var startx = npc.dom.getBoundingClientRect().left + npc.width/2 + offsetx
var startx = npc.dom.getBoundingClientRect().left + npc.width / 2 + offsetx;
var starty = npc.dom.getBoundingClientRect().top + npc.height/2 + offsety
var starty = npc.dom.getBoundingClientRect().top + npc.height / 2 + offsety;
projectileTracked("/images/Alchemical_Hydra_magic_projectile.png?2a2bc","apr-hydra-magic",50,50/1013*592,startx,starty,20,150,0.3914051281252104)
projectileTracked("/images/Alchemical_Hydra_ranged_projectile.png?2a2bc", "apr-hydra-ranged", 80, 80 / 1561 * 585, startx, starty, 20, 150, 0);
};
var AHMagic = function AHMagic(npc, offsetx, offsety) {
var startx = npc.dom.getBoundingClientRect().left + npc.width / 2 + offsetx;
var starty = npc.dom.getBoundingClientRect().top + npc.height / 2 + offsety;
projectileTracked("/images/Alchemical_Hydra_magic_projectile.png?2a2bc", "apr-hydra-magic", 50, 50 / 1013 * 592, startx, starty, 20, 150, 0.3914051281252104);
};
var _AHFire = function AHFire(npc, remaining) {
if (npc.phase == 3 || !DDSenabled) {
return;
}
}
var curX = lastX;

var AHFire = function(npc,remaining){
var curY = lastY;
setTimeout(burnOver, 900, "/images/Alchemical_Hydra_flame_wall_attack.png?2a2bc", "apr-hydra-burn", curX, curY, 250 * resizeratio, 250 * resizeratio, 300, 10000, true, "#protectMelee");
if(npc.phase == 3 || !DDSenabled){ return }
var curX = lastX
if (remaining > 0) {
var curY = lastY
setTimeout(_AHFire, 1200, npc, remaining - 1);
setTimeout(burnOver,900,"/images/Alchemical_Hydra_flame_wall_attack.png?2a2bc","apr-hydra-burn",curX,curY,250*resizeratio,250*resizeratio,300,10000,true,"#protectMelee")
if(remaining>0){
setTimeout(AHFire,1200,npc,remaining-1)
}
}
}
};

var AHTornado = function(startX,startY){
var AHTornado = function AHTornado(startX, startY) {
seekerMissile("/images/Alchemical_Hydra_lightning_attack.png?2a2bc","apr-hydra-tornado",250*resizeratio,250*resizeratio,startX,startY,300,20*resizeratio,250*resizeratio,600,-10)
seekerMissile("/images/Alchemical_Hydra_lightning_attack.png?2a2bc", "apr-hydra-tornado", 250 * resizeratio, 250 * resizeratio, startX, startY, 300, 20 * resizeratio, 250 * resizeratio, 600, -10);
};
var _AHAttack = function AHAttack(npc) {
if (width != $(window).width() || height != $(window).height()) {
crab("DeadBadWindow");
}
}
if (npc.skipattack > 0) {

npc.skipattack -= 1;
var AHAttack = function(npc){
} else if (npc.specialtimer == 0) {
if(width != $(window).width() || height != $(window).height()){
npc.specialtimer = 9;
crab("DeadBadWindow")
if (npc.phase == 0 || npc.phase == 3) {
burnOver("/images/Alchemical_Hydra_acid_pool_attack.png?2a2bc", "apr-hydra-poison", lastX, lastY, 250 * resizeratio, 250 * resizeratio, 600, 10000, true, "#protectMelee");
for (var i = 0; i < 4; i++) {
setTimeout(function () {
burnOver("/images/Alchemical_Hydra_acid_pool_attack.png?2a2bc", "apr-hydra-poison", Math.random() * width, Math.random() * height, 250 * resizeratio, 250 * resizeratio, 600, 10000, true, "#apr-hydra-vent-red");
}, 600);
}
}
}
if(npc.skipattack > 0){
npc.skipattack -= 1
if (npc.phase == 1) {
} else if(npc.specialtimer == 0){
i = 0;
npc.specialtimer = 9
var attempts = 0;
if(npc.phase == 0 || npc.phase == 3){
while (i < 4) {
var startX = Math.random() * width;
burnOver("/images/Alchemical_Hydra_acid_pool_attack.png?2a2bc","apr-hydra-poison",lastX,lastY,250*resizeratio,250*resizeratio,600,10000,true,"#protectMelee")
for (var i = 0; i < 4; i++) {
var startY = Math.random() * height;
setTimeout(function(){
var dist = getDist(startX - lastX, startY - lastY);
if (dist < 350) {
burnOver("/images/Alchemical_Hydra_acid_pool_attack.png?2a2bc","apr-hydra-poison",Math.random()*width,Math.random()*height,250*resizeratio,250*resizeratio,600,10000,true,"#apr-hydra-vent-red")
},600)
attempts += 1;
}
if (attempts > 1000) {
}
crab("Dead");
if(npc.phase == 1){
break;
i = 0
var attempts = 0
while(i<4){
var startX = Math.random()*width
var startY = Math.random()*height
var dist = getDist(startX-lastX,startY-lastY)
if(dist < 350){
attempts += 1
if(attempts > 1000){
crab("Dead")
break
}
} else {
i += 1
AHTornado(startX,startY)
}
}
}
if(npc.phase == 2){
AHFire(npc,11)
}
}
} else {
i += 1;
AHTornado(startX, startY);
}
}
}
if (npc.phase == 2) {
_AHFire(npc, 11);
}
} else {
npc.specialtimer -= 1;
if (npc.mainattackswitch == 0) {
npc.mainattack = 1 - npc.mainattack;
if (npc.phase == 3) {
npc.mainattackswitch = 1;
} else {
} else {
npc.specialtimer -= 1
npc.mainattackswitch = 3;

if(npc.mainattackswitch == 0){
npc.mainattack = 1-npc.mainattack
if(npc.phase == 3){
npc.mainattackswitch = 1
} else {
npc.mainattackswitch = 3
}
}
npc.mainattackswitch -= 1

if(npc.mainattack == 0){
prayerKillDelay("Ranged",600)
AHRanged(npc,43,-70)
if(npc.phase <= 1){
AHRanged(npc,0,0)
}

} else {
prayerKillDelay("Magic",600)
AHMagic(npc,-57,-90)
if(npc.phase <= 0){
AHMagic(npc,-100,-18)
}
}
}
}
}
if(DDSenabled && !npc.dead){
npc.mainattackswitch -= 1;
setTimeout(AHAttack,3600,npc)
if (npc.mainattack == 0) {
prayerKillDelay("Ranged", 600);
AHRanged(npc, 43, -70);
if (npc.phase <= 1) {
AHRanged(npc, 0, 0);
}
}
} else {
prayerKillDelay("Magic", 600);
AHMagic(npc, -57, -90);
if (npc.phase <= 0) {
AHMagic(npc, -100, -18);
}
}
}
}
if (DDSenabled && !npc.dead) {

setTimeout(_AHAttack, 3600, npc);
$('body').css("overflow","hidden")
var width = $(window).width()
var height = $(window).height()
var resizeratio = Math.max(1,Math.sqrt(width/1903*height/976))

if(width<1000){
crab("AHscreen")
DDSenabled = false;
return
}
}
};
if(height<500){
$('body').css("overflow", "hidden");
crab("AHscreen")
var width = $(window).width();
DDSenabled = false;
var height = $(window).height();
return
var resizeratio = Math.max(1, Math.sqrt(width / 1903 * height / 976));
}
if (width < 1000) {

crab("AHscreen");
var main = $('<div class="apr-hydra"/>').appendTo('body')
DDSenabled = false;
$(npc.dom).attr("src",ahimg[0])
return;
$(npc.dom.parentElement.parentElement).appendTo(main)
}
$(npc.dom.parentElement).css("left",(width-npc.width)/2)
if (height < 500) {
$(npc.dom.parentElement).css("top",(height-npc.height)/2)
crab("AHscreen");
$(npc.dom.parentElement).css("position","absolute")
DDSenabled = false;
$(npc.dom.parentElement).prop("fixed","true")
return;
$('<img id="apr-hydra-vent-red" class="apr-hydra-vent" src="/images/Alchemical_Hydra_red_vent.png?c2c96" style="left:0px;top:'+(height-250)+'px">').prependTo(main).prop("top",(height-200))
}
$('<img id="apr-hydra-vent-green" class="apr-hydra-vent" src="/images/Alchemical_Hydra_green_vent.png?c2c96" style="left:'+(width-250)+'px;top:0px">').prependTo(main).prop("left",(width-200))
var main = $('<div class="apr-hydra"/>').appendTo('body');
$('<img id="apr-hydra-vent-blue" class="apr-hydra-vent" src="/images/Alchemical_Hydra_blue_vent.png?c2c96" style="left:0px;top:0px">').prependTo(main)
$(npc.dom).attr("src", ahimg[0]);
$("#p-personal").remove()
$(npc.dom.parentElement.parentElement).appendTo(main);
$("div.menu").remove()
$(npc.dom.parentElement).css("left", (width - npc.width) / 2);
$("div.suggestions").remove()
$(npc.dom.parentElement).css("top", (height - npc.height) / 2);

$(npc.dom.parentElement).css("position", "absolute");
setupPrayer()
$(npc.dom.parentElement).prop("fixed", "true");

$('<img id="apr-hydra-vent-red" class="apr-hydra-vent" src="/images/Alchemical_Hydra_red_vent.png?c2c96" style="left:0px;top:' + (height - 250) + 'px">').prependTo(main).prop("top", height - 200);
AHAttack(npc)
$('<img id="apr-hydra-vent-green" class="apr-hydra-vent" src="/images/Alchemical_Hydra_green_vent.png?c2c96" style="left:' + (width - 250) + 'px;top:0px">').prependTo(main).prop("left", width - 200);

$('<img id="apr-hydra-vent-blue" class="apr-hydra-vent" src="/images/Alchemical_Hydra_blue_vent.png?c2c96" style="left:0px;top:0px">').prependTo(main);
$("#p-personal").remove();
$("div.menu").remove();
$("div.suggestions").remove();
setupPrayer();
_AHAttack(npc);
}
}
var ahimg = ["/images/thumb/Alchemical_Hydra_%28serpentine%29.png/272px-Alchemical_Hydra_%28serpentine%29.png?925dd", "/images/thumb/Alchemical_Hydra_%28electric%29.png/230px-Alchemical_Hydra_%28electric%29.png?925dd", "/images/thumb/Alchemical_Hydra_%28fire%29.png/234px-Alchemical_Hydra_%28fire%29.png?925dd", "/images/thumb/Alchemical_Hydra_%28extinguished%29.png/234px-Alchemical_Hydra_%28extinguished%29.png?925dd"];
var ahimg = [
function AHhit(npc) {
"/images/thumb/Alchemical_Hydra_%28serpentine%29.png/272px-Alchemical_Hydra_%28serpentine%29.png?925dd",
var left = parseFloat($(npc.dom.parentElement).css("left"));
"/images/thumb/Alchemical_Hydra_%28electric%29.png/230px-Alchemical_Hydra_%28electric%29.png?925dd",
var top = parseFloat($(npc.dom.parentElement).css("top"));
"/images/thumb/Alchemical_Hydra_%28fire%29.png/234px-Alchemical_Hydra_%28fire%29.png?925dd",
if (npc.accuracy == 0.25) {
"/images/thumb/Alchemical_Hydra_%28extinguished%29.png/234px-Alchemical_Hydra_%28extinguished%29.png?925dd"
if (npc.phase == 0) {
]
if (left < 200 && top + npc.height > $("#apr-hydra-vent-red").prop("top")) {
function AHhit(npc){
npc.accuracy = 1;
var left = parseFloat($(npc.dom.parentElement).css("left"))
}
var top = parseFloat($(npc.dom.parentElement).css("top"))

if(npc.accuracy == 0.25){
if(npc.phase == 0){
if(left<200 && (top+npc.height)>$("#apr-hydra-vent-red").prop("top")){
npc.accuracy = 1;
}
}
if(npc.phase == 1){
if(top<200 && (left+npc.width)>$("#apr-hydra-vent-green").prop("left")){
npc.accuracy = 1;
}
}
if(npc.phase == 2){
if(top<200 && left<200){
npc.accuracy = 1;
}
}
}
}
if (npc.phase == 1) {

if(npc.hits == (npc.phase+1)*80){
if (top < 200 && left + npc.width > $("#apr-hydra-vent-green").prop("left")) {
npc.phase = npc.hits/80
npc.accuracy = 1;
}
$(npc.dom).attr("src",ahimg[npc.phase])


npc.specialtimer = 3
if(npc.phase == 3){
npc.mainattackswitch = 0
npc.accuracy = 1
} else {
npc.accuracy = 0.25
}
npc.skipattack = 1
}
}
if (npc.phase == 2) {
if (top < 200 && left < 200) {
npc.accuracy = 1;
}
}
}
if (npc.hits == (npc.phase + 1) * 80) {
npc.phase = npc.hits / 80;
$(npc.dom).attr("src", ahimg[npc.phase]);
npc.specialtimer = 3;
if (npc.phase == 3) {
npc.mainattackswitch = 0;
npc.accuracy = 1;
} else {
npc.accuracy = 0.25;
}
npc.skipattack = 1;
}
}
}
function Cucco() {

$('body').css("overflow", "hidden");
function Cucco(){
var width = $(window).width();
$('body').css("overflow","hidden")
var width = $(window).width()
var height = $(window).height();
var height = $(window).height()
if (width / height > 0.25 && width / height < 4) {
var cuccoCount = 0;
if(width/height > 0.25 && width/height < 4){
var cuccoCount = 0
var cuccoSpawned = 0;
var basex = Math.floor(Math.sqrt(width * height / 100 / 1.35));
var cuccoSpawned = 0
var basex = Math.floor(Math.sqrt(width*height/100/1.35));
var basey = Math.floor(Math.sqrt(width * height / 100 / 1.35) * 1.35);
var body = $('body');
var basey = Math.floor(Math.sqrt(width*height/100/1.35)*1.35);
$("#p-personal").remove();
var body = $('body')
$("#p-personal").remove()
$("div.menu").remove();
$("div.menu").remove()
$("div.suggestions").remove();
$(document).mouseleave(function () {
$("div.suggestions").remove()
if (DDSenabled) {

$(document).mouseleave(function () {
DDSenabled = false;
if(DDSenabled){
crab("CuccoEscape", cuccoSpawned);
}
DDSenabled = false
});
crab("CuccoEscape",cuccoSpawned)
var _cuccoAttack = function cuccoAttack() {
}
cuccoCount += 1;
if (width != $(window).width() || height != $(window).height()) {
crab("DeadBadWindow");
}
if (Math.random() < 0.5) {
cuccoSpawned += 1;
var img = ['/images/thumb/Chicken_%281%29.png/89px-Chicken_%281%29.png?a7258', '/images/thumb/Chicken_%282%29.png/89px-Chicken_%282%29.png?ec54e', '/images/thumb/Chicken_%283%29.png/88px-Chicken_%283%29.png?22962', '/images/thumb/Chicken_%284%29.png/88px-Chicken_%284%29.png?e1827', '/images/thumb/Chicken_%285%29.png/88px-Chicken_%285%29.png?bf9d3', '/images/thumb/Chicken_%286%29.png/88px-Chicken_%286%29.png?0f7e8'];
var cucco = $("<img class='apr-cucco' src='" + img[Math.floor(Math.random() * 6)] + "'>");
cucco.css("position", "fixed");
cucco.css("top", Math.random() * height - basey / 2 + 'px');
cucco.css("left", -basey + 'px');
cucco.css("width", basex + 'px');
cucco.css("height", basey + 'px');
cucco.css("transform", 'rotate(' + Math.random() + 'turn)');
$('.mwe-popups').remove();
body.append(cucco);
cucco.hover(function () {
if (DDSenabled) {
crab("DeadCucco", cuccoSpawned);
}
});
});
}

var cuccoAttack = function(){
$('.apr-cucco').each(function () {
cuccoCount += 1
var newx = parseInt($(this).css("left")) + width / 80;
if(width != $(window).width() || height != $(window).height()){
if (newx > width + basex) {
crab("DeadBadWindow")
$(this).remove();
}
} else {
$(this).css("left", newx);

if(Math.random()<0.5){
cuccoSpawned += 1
var img = ['/images/thumb/Chicken_%281%29.png/89px-Chicken_%281%29.png?a7258','/images/thumb/Chicken_%282%29.png/89px-Chicken_%282%29.png?ec54e','/images/thumb/Chicken_%283%29.png/88px-Chicken_%283%29.png?22962','/images/thumb/Chicken_%284%29.png/88px-Chicken_%284%29.png?e1827','/images/thumb/Chicken_%285%29.png/88px-Chicken_%285%29.png?bf9d3','/images/thumb/Chicken_%286%29.png/88px-Chicken_%286%29.png?0f7e8']
var cucco = $("<img class='apr-cucco' src='"+img[Math.floor(Math.random()*6)]+"'>")
cucco.css("position","fixed");
cucco.css("top",Math.random()*height-basey/2+'px');
cucco.css("left",(-basey)+'px');
cucco.css("width",basex+'px');
cucco.css("height",basey+'px');
cucco.css("transform",'rotate('+Math.random()+'turn)');
$('.mwe-popups').remove()
body.append(cucco)
cucco.hover(function(){
if(DDSenabled){
crab("DeadCucco",cuccoSpawned)
}
})
}

$('.apr-cucco').each(function(){
var newx = parseInt($(this).css("left"))+width/80
if(newx>width+basex){
$(this).remove()
} else {
$(this).css("left",newx)
}
})


if(cuccoSpawned == 200){
displayAchievement("Cucco")
}

if(DDSenabled){
setTimeout(cuccoAttack,50)
}
}
}
});

cuccoAttack()
if (cuccoSpawned == 200) {
displayAchievement("Cucco");

} else {
}
crab("DeadBadWindow")
if (DDSenabled) {
setTimeout(_cuccoAttack, 50);
}
}
};
_cuccoAttack();
} else {
crab("DeadBadWindow");
}
}
}
function attackOver(icon, classname, sizex, sizey, duration) {

var attack = $("<img class='" + classname + "' src='" + icon + "'>");
function attackOver(icon,classname,sizex,sizey,duration){
var attack = $("<img class='"+classname+"' src='"+icon+"'>")
attack.css("position", "fixed");
attack.css("position","fixed");
attack.css("top", lastY - sizey / 2 + 'px');
attack.css("top",lastY-sizey/2+'px');
attack.css("left", lastX - sizex / 2 + 'px');
attack.css("left",lastX-sizex/2+'px');
attack.css("width", sizex + 'px');
attack.css("width",sizex+'px');
attack.css("height", sizey + 'px');
$('body').append(attack);
attack.css("height",sizey+'px');
setTimeout(function () {
$('body').append(attack)
setTimeout(function(){attack.remove()}, duration);
attack.remove();
}, duration);
}
}
function burnOver(icon,classname,x,y,sizex,sizey,hoverdelay,duration,randomrotation,jquerytarget){
function burnOver(icon, classname, x, y, sizex, sizey, hoverdelay, duration, randomrotation, jquerytarget) {
var attack = $("<img class='"+classname+"' src='"+icon+"'>")
var attack = $("<img class='" + classname + "' src='" + icon + "'>");
attack.css("position","fixed");
attack.css("position", "fixed");
attack.css("top",y-sizey/2+'px');
attack.css("top", y - sizey / 2 + 'px');
attack.css("left",x-sizex/2+'px');
attack.css("left", x - sizex / 2 + 'px');
attack.css("width",sizex+'px');
attack.css("width", sizex + 'px');
attack.css("height",sizey+'px');
attack.css("height", sizey + 'px');
if(randomrotation){
if (randomrotation) {
attack.css("transform","rotate("+Math.random()+"turn)")
attack.css("transform", "rotate(" + Math.random() + "turn)");
}
}
$(jquerytarget).after(attack)
$(jquerytarget).after(attack);
setTimeout(function(){
setTimeout(function () {
attack.detach()
attack.detach();
attack.addClass("apr-burndone")
attack.addClass("apr-burndone");
attack.hover(function(){
attack.hover(function () {
if(DDSenabled){
if (DDSenabled) {
crab("Dead")
crab("Dead");
}
}
})
});
$(jquerytarget).after(attack)
$(jquerytarget).after(attack);
},hoverdelay)
}, hoverdelay);
setTimeout(function(){attack.remove()},duration);
setTimeout(function () {
attack.remove();
}, duration);
}
}
function seekerMissile(icon, classname, sizex, sizey, startx, starty, frames, speed, diameter, durationout, baserotation) {

var attack = $("<img class='" + classname + "' src='" + icon + "'>");
function seekerMissile(icon,classname,sizex,sizey,startx,starty,frames,speed,diameter,durationout,baserotation){
var x = startx - sizex / 2;
var attack = $("<img class='"+classname+"' src='"+icon+"'>")
var x = startx-sizex/2
var y = starty - sizey / 2;
attack.css("position", "fixed");
var y = starty-sizey/2
attack.css("position","fixed");
attack.css("left", x + 'px');
attack.css("left",x+'px');
attack.css("top", y + 'px');
attack.css("top",y+'px');
attack.css("width", sizex + 'px');
attack.css("width",sizex+'px');
attack.css("height", sizey + 'px');
var deltax = lastX - sizex / 2 - x;
attack.css("height",sizey+'px');
var deltay = lastY - sizey / 2 - y;

if (baserotation != -10) {
var deltax = (lastX-sizex/2-x)
attack.css("transform", "rotate(" + (Math.atan2(deltay, deltax) + baserotation) + "rad)");
var deltay = (lastY-sizey/2-y)
}
if(baserotation!=-10){
$('body').append(attack);
attack.css("transform","rotate("+(Math.atan2(deltay,deltax)+baserotation)+"rad)")
var _seekerMissilePosition = function seekerMissilePosition(attack, sizex, sizey, x, y, frames, speed, radius, durationout, baserotation) {
var deltax = lastX - sizex / 2 - x;
var deltay = lastY - sizey / 2 - y;
var dist = getDist(deltax, deltay);
if (dist < speed) {
x = lastX;
y = lastY;
} else {
x = x + deltax / dist * speed;
y = y + deltay / dist * speed;
}
}
attack.css("left", x + 'px');

attack.css("top", y + 'px');
$('body').append(attack)
if (baserotation != -10) {

attack.css("transform", "rotate(" + (Math.atan2(deltay, deltax) + baserotation) + "rad)");

var seekerMissilePosition = function(attack,sizex,sizey,x,y,frames,speed,radius,durationout,baserotation){
var deltax = (lastX-sizex/2-x)
var deltay = (lastY-sizey/2-y)
var dist = getDist(deltax,deltay)
if(dist<speed){
x = lastX
y = lastY
} else {
x = x + deltax/dist*speed
y = y + deltay/dist*speed
}
attack.css("left",x+'px');
attack.css("top",y+'px');
if(baserotation!=-10){
attack.css("transform","rotate("+(Math.atan2(deltay,deltax)+baserotation)+"rad)")
}
if(dist<radius/2){
if(DDSenabled){
crab("Dead")
}
setTimeout(function(){attack.remove()}, durationout);
} else {
if(frames == 1){
setTimeout(function(){attack.remove()}, durationout);
} else {
setTimeout(seekerMissilePosition,33,attack,sizex,sizey,x,y,frames-1,speed,radius,durationout,baserotation);
}
}
}
}
if (dist < radius / 2) {

if (DDSenabled) {
setTimeout(seekerMissilePosition,33,attack,sizex,sizey,x,y,frames-1,speed,diameter/2,durationout,baserotation);
crab("Dead");
}
setTimeout(function () {
attack.remove();
}, durationout);
} else {
if (frames == 1) {
setTimeout(function () {
attack.remove();
}, durationout);
} else {
setTimeout(_seekerMissilePosition, 33, attack, sizex, sizey, x, y, frames - 1, speed, radius, durationout, baserotation);
}
}
};
setTimeout(_seekerMissilePosition, 33, attack, sizex, sizey, x, y, frames - 1, speed, diameter / 2, durationout, baserotation);
}
}
function projectileTracked(icon, classname, sizex, sizey, startx, starty, frames, durationout, baserotation) {

var attack = $("<img class='" + classname + "' src='" + icon + "'>");
function projectileTracked(icon,classname,sizex,sizey,startx,starty,frames,durationout,baserotation){
var x = startx - sizex / 2;
var attack = $("<img class='"+classname+"' src='"+icon+"'>")
var x = startx-sizex/2
var y = starty - sizey / 2;
attack.css("position", "fixed");
var y = starty-sizey/2
attack.css("position","fixed");
attack.css("left", x + 'px');
attack.css("left",x+'px');
attack.css("top", y + 'px');
var deltax = lastX - sizex / 2 - x;
attack.css("top",y+'px');
var deltay = lastY - sizey / 2 - y;

if (baserotation != -10) {
var deltax = (lastX-sizex/2-x)
attack.css("transform", "rotate(" + (Math.atan2(deltay, deltax) + baserotation) + "rad)");
var deltay = (lastY-sizey/2-y)
}
if(baserotation!=-10){
$('body').append(attack);
attack.css("transform","rotate("+(Math.atan2(deltay,deltax)+baserotation)+"rad)")
var _projectileTrackedPosition = function projectileTrackedPosition(attack, sizex, sizey, x, y, frames, durationout, baserotation) {
var deltax = (lastX - sizex / 2 - x) / frames;
var deltay = (lastY - sizey / 2 - y) / frames;
x = x + deltax;
y = y + deltay;
attack.css("left", x + 'px');
attack.css("top", y + 'px');
if (baserotation != -10) {
attack.css("transform", "rotate(" + (Math.atan2(deltay, deltax) + baserotation) + "rad)");
}
}
if (frames == 1) {

setTimeout(function () {
$('body').append(attack)
attack.remove();

}, durationout);

} else {
var projectileTrackedPosition = function(attack,sizex,sizey,x,y,frames,durationout,baserotation){
setTimeout(_projectileTrackedPosition, 33, attack, sizex, sizey, x, y, frames - 1, durationout, baserotation);
var deltax = (lastX-sizex/2-x)/frames
var deltay = (lastY-sizey/2-y)/frames
x = x + deltax
y = y + deltay
attack.css("left",x+'px');
attack.css("top",y+'px');
if(baserotation!=-10){
attack.css("transform","rotate("+(Math.atan2(deltay,deltax)+baserotation)+"rad)")
}
if(frames == 1){
setTimeout(function(){attack.remove()}, durationout);
} else {
setTimeout(projectileTrackedPosition,33,attack,sizex,sizey,x,y,frames-1,durationout,baserotation);
}
}
}
};

setTimeout(projectileTrackedPosition,33,attack,sizex,sizey,x,y,frames-1,durationout,baserotation);
setTimeout(_projectileTrackedPosition, 33, attack, sizex, sizey, x, y, frames - 1, durationout, baserotation);
}
}
function barrage(npc) {

var barra = $("<img class='apr-barrage' src='/images/Ice_Barrage_iceblock.png?b4915'>");
function barrage(npc){
barra.css("position", "fixed");
var barra = $("<img class='apr-barrage' src='/images/Ice_Barrage_iceblock.png?b4915'>")
barra.css("position","fixed");
barra.css("top", lastY - 173 / 2 + 'px');
barra.css("top",lastY-173/2+'px');
barra.css("left", lastX - 100 / 2 + 'px');
$('body').append(barra);
barra.css("left",lastX-100/2+'px');
crab("Dead");
$('body').append(barra)
displayAchievement("Wombat");
setTimeout(function () {
barra.remove();
}, 2000);
}
function prayerKill(style) {
if (curPrayer != style && DDSenabled) {
crab("Dead");
crab("Dead");
}
displayAchievement("Wombat")
setTimeout(function(){barra.remove()}, 2000);
}
}
function prayerKillDelay(style, timeout) {

if (curPrayer != style && DDSenabled) {
function prayerKill(style){
setTimeout(crab, timeout, "Dead");
if(curPrayer != style && DDSenabled){
}
crab("Dead")
}
}
}
var curPrayer = "";
function prayerKillDelay(style,timeout){
function setPrayer(e) {
if(curPrayer != style && DDSenabled){
$('.apr-prayer-highlight').css("opacity", 0);
setTimeout(crab,timeout,"Dead")
if (e.data == curPrayer) {
curPrayer = "";
} else {
curPrayer = e.data;
$('#apr-prayer-highlight-' + curPrayer).css("opacity", 1);
}
}
function setupPrayer() {
$('<div class="apr-prayer-background">').appendTo($('body'));
$('<div id="apr-prayer-highlight-Magic" class="apr-prayer apr-prayer-highlight" style="right:128px"></div><div id="protectMagic" class="apr-prayer apr-prayer-icon" style="right:128px;background-image:url(/images/Protect_from_Magic.png?5c9d8)"></div>').appendTo($('body')).click("Magic", setPrayer);
$('<div id="apr-prayer-highlight-Ranged" class="apr-prayer apr-prayer-highlight" style="right:92px"></div><div id="protectRanged" class="apr-prayer apr-prayer-icon" style="right:92px;background-image:url(/images/Protect_from_Missiles.png?686a4)"></div>').appendTo($('body')).click("Ranged", setPrayer);
$('<div id="apr-prayer-highlight-Melee" class="apr-prayer apr-prayer-highlight" style="right:56px"></div><div id="protectMelee" class="apr-prayer apr-prayer-icon" style="right:56px;background-image:url(/images/Protect_from_Melee.png?65856"></div>').appendTo($('body')).click("Melee", setPrayer);
}
var TTJlist = {
"Ma": "/images/TzTok-Jad_magic_attack.png?0b424",
"Me": "/images/TzTok-Jad_melee_attack.png?0b424",
"N": "/images/TzTok-Jad_neutral_pose.png?0b424",
"R1": "/images/TzTok-Jad_ranged_attack_part_1.png?0b424",
"R2": "/images/TzTok-Jad_ranged_attack_part_2.png?0b424"
};
var TTJhover = false;
function TTJ(npc) {
var TTJon = function TTJon() {
TTJhover = true;
};
var TTJoff = function TTJoff() {
TTJhover = false;
};
$(npc.dom).hover(TTJon, TTJoff);
setupPrayer();
var _TTJAttack = function TTJAttack(npc) {
var TTJNormalAnim = function TTJNormalAnim(npc) {
npc.dom.src = TTJlist["N"];
npc.dom.srcset = TTJlist["N"];
};
var TTJRange2Anim = function TTJRange2Anim(npc) {
npc.dom.src = TTJlist["R2"];
npc.dom.srcset = TTJlist["R2"];
};
var TTJMage = function TTJMage(npc) {
npc.dom.src = TTJlist["Ma"];
npc.dom.srcset = TTJlist["Ma"];
setTimeout(TTJNormalAnim, 2400, npc);
setTimeout(prayerKillDelay, 1800, "Magic", 1000);
setTimeout(function () {
var startx = npc.dom.getBoundingClientRect().left + 50;
var starty = npc.dom.getBoundingClientRect().top + 100;
projectileTracked("/images/TzTok-Jad_magic_projectile.png?c6ae1", "apr-ttj-magic", 100, 94, startx, starty, 30, 300, 0.7853981633974483);
}, 1800);
};
var TTJRange = function TTJRange(npc) {
npc.dom.src = TTJlist["R1"];
npc.dom.srcset = TTJlist["R1"];
setTimeout(TTJRange2Anim, 300, npc);
setTimeout(TTJNormalAnim, 600, npc);
setTimeout(prayerKillDelay, 1800, "Ranged", 600);
setTimeout(function () {
attackOver("/images/TzTok-Jad_ranged_projectile.png?c6ae1", "apr-ttj-ranged", 100, 193, 600);
}, 1800);
};
var TTJMelee = function TTJMelee(npc) {
npc.dom.src = TTJlist["Me"];
npc.dom.srcset = TTJlist["Me"];
setTimeout(TTJNormalAnim, 600, npc);
prayerKill("Melee");
};
if (npc.dead || !DDSenabled) {
return;
}
}
var atk = Math.random() * (2 + TTJhover);
}
if (atk < 1) {
var curPrayer = ""
TTJMage(npc);
function setPrayer(e){
} else if (atk < 2) {
$('.apr-prayer-highlight').css("opacity",0)
if(e.data == curPrayer){
TTJRange(npc);
curPrayer = ""
} else {
} else {
curPrayer = e.data
TTJMelee(npc);
$('#apr-prayer-highlight-'+curPrayer).css("opacity",1)
}
}
if (!npc.dead && DDSenabled) {
setTimeout(_TTJAttack, 4800, npc);
}
};
setTimeout(_TTJAttack, 1200, npc);
}
}
function setupPrayer(){
function NPC(dom) {
this.hp = 10;
$('<div class="apr-prayer-background">').appendTo($('body'))
this.accuracy = 1;
$('<div id="apr-prayer-highlight-Magic" class="apr-prayer apr-prayer-highlight" style="right:128px"></div><div id="protectMagic" class="apr-prayer apr-prayer-icon" style="right:128px;background-image:url(/images/Protect_from_Magic.png?5c9d8)"></div>').appendTo($('body')).click("Magic",setPrayer)
this.hits = 0;
$('<div id="apr-prayer-highlight-Ranged" class="apr-prayer apr-prayer-highlight" style="right:92px"></div><div id="protectRanged" class="apr-prayer apr-prayer-icon" style="right:92px;background-image:url(/images/Protect_from_Missiles.png?686a4)"></div>').appendTo($('body')).click("Ranged",setPrayer)
this.dead = false;
$('<div id="apr-prayer-highlight-Melee" class="apr-prayer apr-prayer-highlight" style="right:56px"></div><div id="protectMelee" class="apr-prayer apr-prayer-icon" style="right:56px;background-image:url(/images/Protect_from_Melee.png?65856"></div>').appendTo($('body')).click("Melee",setPrayer)
this.speed = 500;
}
this.dom = dom;

this.mechanics = false;
var TTJlist = {
if (achievementsOpen) {
"Ma":"/images/TzTok-Jad_magic_attack.png?0b424",
this.accuracy = 0.2;
"Me":"/images/TzTok-Jad_melee_attack.png?0b424",
this.hp = 5;
"N":"/images/TzTok-Jad_neutral_pose.png?0b424",
} else {
"R1":"/images/TzTok-Jad_ranged_attack_part_1.png?0b424",
var query = MD5(mw.config.get('wgTitle'));
"R2":"/images/TzTok-Jad_ranged_attack_part_2.png?0b424",
if (query == "4f66ec58eb4e9d48b01a7480c51c89b4") {
this.hp = 5;
if (load("apr-slayerstate") <= 3) {
this.accuracy = 0;
}
}
}
if (query == "09ec2c80c276b958ef255c6120cbe97a") {
var TTJhover = false
this.hp = 1;
function TTJ(npc){
var TTJon = function(){TTJhover = true}
this.speed = 1000;
}
var TTJoff = function(){TTJhover = false}
if (query == "e8f65c7327e4ae90e767afc30a709419") {
$(npc.dom).hover(TTJon,TTJoff)
this.accuracy = 0;

this.mechanics = 1;
setupPrayer()
this.angry = false;

var TTJAttack = function(npc){
var TTJNormalAnim = function(npc){
npc.dom.src = TTJlist["N"]
npc.dom.srcset = TTJlist["N"]
}
var TTJRange2Anim = function(npc){
npc.dom.src = TTJlist["R2"]
npc.dom.srcset = TTJlist["R2"]
}
var TTJMage = function(npc){
npc.dom.src = TTJlist["Ma"]
npc.dom.srcset = TTJlist["Ma"]
setTimeout(TTJNormalAnim,2400,npc)
setTimeout(prayerKillDelay,1800,"Magic",1000)
setTimeout(function(){
var startx = npc.dom.getBoundingClientRect().left + 50
var starty = npc.dom.getBoundingClientRect().top + 100
projectileTracked("/images/TzTok-Jad_magic_projectile.png?c6ae1","apr-ttj-magic",100,94,startx,starty,30,300,0.7853981633974483)
},1800)
}
var TTJRange = function(npc){
npc.dom.src = TTJlist["R1"]
npc.dom.srcset = TTJlist["R1"]
setTimeout(TTJRange2Anim,300,npc)
setTimeout(TTJNormalAnim,600,npc)
setTimeout(prayerKillDelay,1800,"Ranged",600)
setTimeout(function(){attackOver("/images/TzTok-Jad_ranged_projectile.png?c6ae1","apr-ttj-ranged",100,193,600)},1800)
}
var TTJMelee = function(npc){
npc.dom.src = TTJlist["Me"]
npc.dom.srcset = TTJlist["Me"]
setTimeout(TTJNormalAnim,600,npc)
prayerKill("Melee")
}


if(npc.dead || !DDSenabled){return}

var atk = Math.random()*(2+TTJhover)

if(atk<1){
TTJMage(npc)
} else if(atk<2){
TTJRange(npc)
} else {
TTJMelee(npc)
}

if(!npc.dead && DDSenabled){
setTimeout(TTJAttack,4800,npc)
}
}
}
if (query == "a9514f8884af954749b66932d8a95a76") {

this.accuracy = 0;
setTimeout(TTJAttack,1200,npc)
this.mechanics = 2;
}
this.angry = false;

disableHighlight();
function NPC(dom){
this.hp = 10
}
if (query == "b31eb4b7a63bfaa339c679b86445b700" || query == "789ef204f9b93cc224a4e25694691684") {
this.accuracy = 1
this.hits = 0
this.hp = 1;
this.dead = false
this.accuracy = 0.3;
this.speed = 500
this.dom = dom;
this.mechanics = false
if(achievementsOpen){
this.accuracy = 0.2
this.hp =5
} else {
var query = MD5(mw.config.get('wgTitle'))
if(query == "4f66ec58eb4e9d48b01a7480c51c89b4"){
this.hp = 5
if(load("apr-slayerstate")<=3){
this.accuracy = 0;
}
}
if(query == "09ec2c80c276b958ef255c6120cbe97a"){
this.hp = 1
this.speed = 1000
}
if(query == "e8f65c7327e4ae90e767afc30a709419"){
this.accuracy = 0;
this.mechanics = 1;
this.angry = false;
}
if(query == "a9514f8884af954749b66932d8a95a76"){
this.accuracy = 0;
this.mechanics = 2;
this.angry = false;
disableHighlight();
}
if(query == "b31eb4b7a63bfaa339c679b86445b700" || query == "789ef204f9b93cc224a4e25694691684"){
this.hp = 1
this.accuracy = 0.3
}
if(query == "7dd8d4d08aa31a5c516f21d40a03c8a5"){
this.hp = 60
this.accuracy = 0.5
this.angry = false;
this.mechanics = 3
this.speed = 2000
bossTimer = Date.now()
disableHighlight();
}
if(query == "b2df76532200e6522fd6da3967e7c94c" || query == "2586a16a520a2c20d7309b799a627f22"){
this.mechanics = 4;
this.angry = false;
disableHighlight();
}
if(query == "fd9cf477745dbeee730e23af6a81a887"){
this.hp = 50
}
if(query == "f06eb95413908c7a0be080f82e1f4d56"){
this.hp = 80*4;
this.mechanics = 5;
this.accuracy = 0.25
this.angry = false;
this.speed = 2000
this.phase = 0
this.mainattack = 0
this.mainattackswitch = 3
this.specialtimer = 3
this.skipattack = 1
this.width = 270
this.height = 298
bossTimer = Date.now()
disableHighlight();
}
if(query == "324696af5d4cb32efd2594c463cc56cc"){
this.hp = 1
this.speed = 1000
}
if(query == "04f12d4923ec5069ac75e6d364b719cb"){
this.hp = 1
this.speed = 1000
disableHighlight();
}
}
}
if (query == "7dd8d4d08aa31a5c516f21d40a03c8a5") {
this.hp = 60;
this.accuracy = 0.5;
this.angry = false;
this.mechanics = 3;
this.speed = 2000;
bossTimer = Date.now();
disableHighlight();
}
if (query == "b2df76532200e6522fd6da3967e7c94c" || query == "2586a16a520a2c20d7309b799a627f22") {
this.mechanics = 4;
this.angry = false;
disableHighlight();
}
if (query == "fd9cf477745dbeee730e23af6a81a887") {
this.hp = 50;
}
if (query == "f06eb95413908c7a0be080f82e1f4d56") {
this.hp = 80 * 4;
this.mechanics = 5;
this.accuracy = 0.25;
this.angry = false;
this.speed = 2000;
this.phase = 0;
this.mainattack = 0;
this.mainattackswitch = 3;
this.specialtimer = 3;
this.skipattack = 1;
this.width = 270;
this.height = 298;
bossTimer = Date.now();
disableHighlight();
}
if (query == "324696af5d4cb32efd2594c463cc56cc") {
this.hp = 1;
this.speed = 1000;
}
if (query == "04f12d4923ec5069ac75e6d364b719cb") {
this.hp = 1;
this.speed = 1000;
disableHighlight();
}
}
}
}
var wepcolor = 'red';

var wepcolor = 'red'
function linedraw(x1, y1, x2, y2) {
function linedraw(x1, y1, x2, y2) {
var tmp
var tmp;
if (x2 < x1) {
if (x2 < x1) {
tmp = x2 ; x2 = x1 ; x1 = tmp
tmp = x2;
tmp = y2 ; y2 = y1 ; y1 = tmp
x2 = x1;
}
x1 = tmp;
tmp = y2;

y2 = y1;
var lineLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
var m = (y2 - y1) / (x2 - x1)
y1 = tmp;
}

var degree = Math.atan(m) * 180 / Math.PI
var lineLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
var m = (y2 - y1) / (x2 - x1);

var degree = Math.atan(m) * 180 / Math.PI;
$('body').append("<div class='osrs_dds line' style='transform-origin: top left; transform: rotate(" + degree + "deg); width: " + lineLength + "px; height: 1px; background: "+wepcolor+"; position: absolute; top: " + y1 + "px; left: " + x1 + "px;'></div>")
$('body').append("<div class='osrs_dds line' style='transform-origin: top left; transform: rotate(" + degree + "deg); width: " + lineLength + "px; height: 1px; background: " + wepcolor + "; position: absolute; top: " + y1 + "px; left: " + x1 + "px;'></div>");
}
}
function mouseDown(e) {

if (e.which == 1) {

mouseStateDown = true;
function mouseDown(e){
}
if(e.which == 1){
mouseStateDown=true;
}
}
}
function mouseUp(e){
function mouseUp(e) {
if(e.which == 1){
if (e.which == 1) {
mouseStateDown=false;
mouseStateDown = false;
$(".osrs_dds").remove();
$(".osrs_dds").remove();
}
}
}
}
function killNPC(npc, el ) {
function killNPC(npc, el) {
npc.dead = true;
npc.dead = true;
save("apr-totalkills",load("apr-totalkills")+1)
save("apr-totalkills", load("apr-totalkills") + 1);
updateDarkModeAchievement();

checkAchievementKillCount();
updateDarkModeAchievement();
loggedInAchievement();
checkAchievementKillCount();
checkAchievementSimples(npc);
loggedInAchievement();
slayerAchievements();
checkAchievementSimples(npc);
var seconds = npc.speed / 1000;
slayerAchievements();
var children = $(el).children("img");

var seconds = npc.speed/1000;
children.css("transition", "opacity " + seconds + "s ease");
var children = $(el).children("img");
children.css("opacity", 0);
setTimeout(function () {
children.css("transition","opacity "+seconds+"s ease")
$(el.parentElement).remove();
children.css("opacity",0)
}, npc.speed);
setTimeout(function() {
$(el.parentElement).remove();
}, npc.speed);
}
}
var lastX = 0;

var lastX = 0
var lastY = 0;
function mouseMove(e) {
var lastY = 0
lastX = e.clientX;
function mouseMove(e){
lastX = e.clientX
lastY = e.clientY;
if (mouseStateDown && DDSenabled) {
lastY = e.clientY
linedraw(e.pageX - e.movementX, e.pageY - e.movementY, e.pageX, e.pageY);
if(mouseStateDown && DDSenabled){
if (e.target.parentElement.classList.contains("hittable")) {
linedraw(e.pageX-e.movementX,e.pageY-e.movementY,e.pageX,e.pageY)
var curTime = Date.now();
if(e.target.parentElement.classList.contains("hittable")){
var curTime = Date.now()
if (lastHit + 200 < curTime) {
if(lastHit+200<curTime){
lastHit = curTime;
if (typeof e.target.npcid === "undefined") {
lastHit = curTime
if(typeof e.target.npcid === "undefined"){
e.target.npcid = NPCarray.length;
e.target.npcid = NPCarray.length
NPCarray[NPCarray.length] = new NPC(e.target);
}
NPCarray[NPCarray.length] = new NPC(e.target)
}
var npc = NPCarray[e.target.npcid];
if (npc.mechanics == 3 && !npc.angry) {

var npc = NPCarray[e.target.npcid];
npc.angry = true;
TTJ(npc);

if(npc.mechanics == 3 && !npc.angry){
} else if (npc.mechanics == 5 && !npc.angry) {
npc.angry = true;
if (load("apr-slayerstate") <= 17) {
TTJ(npc);
crab("AHDead");
return;
} else if(npc.mechanics == 5 && !npc.angry){
if(load("apr-slayerstate")<=17){
} else {
crab("AHDead")
npc.angry = true;
return
AH(npc);
} else {
}
}
npc.angry = true;
AH(npc);
if (npc.accuracy > Math.random()) {
}
displayAchievement("FirstHit");
}
npc.hits += 1;
var splat;

if(npc.accuracy>Math.random()){
if (npc.hits >= npc.hp) {
displayAchievement("FirstHit");
if (!npc.dead) {
splat = $("<img class='apr-hitsplat' style='left:" + (e.target.parentElement.offsetWidth * Math.random() - 12) + "px;top:" + (e.target.parentElement.offsetHeight * Math.random() - 12) + "px' src='/images/73.png?ba00a'>").appendTo(e.target.parentElement).prop("npcid", e.target.npcid);
npc.hits += 1
var splat
setTimeout(function () {
if(npc.hits >= npc.hp){
splat.remove();
if(!npc.dead){
}, 6000);
killNPC(npc, e.target.parentElement);
splat = $("<img class='apr-hitsplat' style='left:"+(e.target.parentElement.offsetWidth*Math.random()-12)+"px;top:"+(e.target.parentElement.offsetHeight*Math.random()-12)+"px' src='/images/73.png?ba00a'>").appendTo(e.target.parentElement).prop("npcid",e.target.npcid)
setTimeout(function(){splat.remove()},6000)
killNPC(npc,e.target.parentElement)
}
} else {
splat = $("<img class='apr-hitsplat' style='left:"+(e.target.parentElement.offsetWidth*Math.random()-12)+"px;top:"+(e.target.parentElement.offsetHeight*Math.random()-12)+"px' src='/images/73.png?ba00a'>").appendTo(e.target.parentElement).prop("npcid",e.target.npcid)
setTimeout(function(){splat.remove()},6000)
if(npc.mechanics == 4 && !npc.angry){
npc.angry = true;
npc.dom.parentElement.remove()
Invaders()
} else if(npc.mechanics == 5 && npc.angry){
AHhit(npc)
}
}
} else {
splat = $("<img class='apr-hitsplat' style='left:"+(e.target.parentElement.offsetWidth*Math.random()-12)+"px;top:"+(e.target.parentElement.offsetHeight*Math.random()-12)+"px' src='/images/Zero_hitsplat.png?482dd'>").appendTo(e.target.parentElement).prop("npcid",e.target.npcid)
setTimeout(function(){splat.remove()},6000)
if(MD5(mw.config.get('wgTitle')) == "4f66ec58eb4e9d48b01a7480c51c89b4"){
var slayerState = load("apr-slayerstate")
if(slayerState <= 3){
if(slayerState >= 2){
save("apr-slayerstate",3)
crab("SpiderDead");
} else {
crab("Dead");
}
}
}
if(npc.mechanics == 1 && !npc.angry){
npc.angry = true;
setTimeout(barrage, 4000, npc);
}
if(npc.mechanics == 2 && !npc.angry){
npc.angry = true;
Cucco();
}
}
}
}
} else {
splat = $("<img class='apr-hitsplat' style='left:" + (e.target.parentElement.offsetWidth * Math.random() - 12) + "px;top:" + (e.target.parentElement.offsetHeight * Math.random() - 12) + "px' src='/images/73.png?ba00a'>").appendTo(e.target.parentElement).prop("npcid", e.target.npcid);
setTimeout(function () {
splat.remove();
}, 6000);
if (npc.mechanics == 4 && !npc.angry) {
npc.angry = true;
npc.dom.parentElement.remove();
Invaders();
} else if (npc.mechanics == 5 && npc.angry) {
AHhit(npc);
}
}
} else {
splat = $("<img class='apr-hitsplat' style='left:" + (e.target.parentElement.offsetWidth * Math.random() - 12) + "px;top:" + (e.target.parentElement.offsetHeight * Math.random() - 12) + "px' src='/images/Zero_hitsplat.png?482dd'>").appendTo(e.target.parentElement).prop("npcid", e.target.npcid);
setTimeout(function () {
splat.remove();
}, 6000);
if (MD5(mw.config.get('wgTitle')) == "4f66ec58eb4e9d48b01a7480c51c89b4") {
var slayerState = load("apr-slayerstate");
if (slayerState <= 3) {
if (slayerState >= 2) {
save("apr-slayerstate", 3);
crab("SpiderDead");
} else {
crab("Dead");
}
}
}
if (npc.mechanics == 1 && !npc.angry) {
npc.angry = true;
setTimeout(barrage, 4000, npc);
}
if (npc.mechanics == 2 && !npc.angry) {
npc.angry = true;
Cucco();
}
}
}
}
}
}
}
}
}
function enableDDS(weapon) {

DDSenabled = true;
function enableDDS(weapon){
setWeapon(weapon, false);
DDSenabled = true;
setWeapon(weapon,false)
}
}
function disableDDS(weapon){
function disableDDS(weapon) {
DDSenabled = false;
setWeapon(weapon, false);
}
function setWeapon(weapon, checkBye) {
wepcolor = weapon[2];
if (weapon[0] == 'Windows') {
$('body').css('cursor', '');
DDSenabled = false;
DDSenabled = false;
if (load('apr-queststate') >= 1000 && checkBye) {
setWeapon(weapon,false)
setTimeout(crab, 50, "CursorBye");
}
} else if (weapon[0][0] == '/') {
$('body').css('cursor', 'url(' + weapon[0] + ') ' + weapon[1] + ',pointer');
} else {
$('body').css('cursor', 'url(' + getFileURL(weapon[0] + ' cursor.png') + ') ' + weapon[1] + ',pointer');
}
}
}
function setWeapon(weapon,checkBye){
function checkAchievementKillCount() {
wepcolor = weapon[2];
var pagekills = 0;
var totalkills = load("apr-totalkills");
if(weapon[0]=='Windows'){
$('body').css('cursor','')
for (var i = 0; i < NPCarray.length; i++) {
pagekills += NPCarray[i].dead;
DDSenabled = false;
}
if(load('apr-queststate')>=1000 && checkBye){
if (totalkills >= 1000) {
setTimeout(crab,50,"CursorBye")
displayAchievement("Total1000Kill");
}
} else if(weapon[0][0] == '/') {
} else if (totalkills >= 50) {
displayAchievement("Total100Kill");
$('body').css('cursor','url('+weapon[0]+') '+weapon[1]+',pointer')
} else {
} else if (totalkills >= 10) {
displayAchievement("Total10Kill");
$('body').css('cursor','url('+getFileURL(weapon[0]+' cursor.png')+') '+weapon[1]+',pointer')
}
if (pagekills >= 5) {
displayAchievement("Page5Kill");
}
}
function updateDarkModeAchievement() {
var mode = getCookie("darkmode");
var lightdark = load("apr-lightdark");
if (mode === false || mode === "false") {
lightdark[0] = true;
} else {
lightdark[1] = true;
}
save("apr-lightdark", lightdark);
if (lightdark[0] && lightdark[1]) {
displayAchievement("LightDark");
}
}
function slayerAchievements() {
var slayerState = load("apr-slayerstate");
if (slayerState >= 4) {
if (MD5(mw.config.get('wgTitle')) == "4f66ec58eb4e9d48b01a7480c51c89b4") {
if (slayerState < 17) {
slayerState += 1;
save("apr-slayerstate", slayerState);
var width = $(window).width();
var height = $(window).height();
var itemz = $('<img src="' + getFileURL(mw.config.get('wgTitle') + '.png') + '" width="60" height="40">');
itemz.css("transform", 'rotate(' + Math.random() + 'turn)');
itemz.prop("fixed", "true");
var itema = $('<span class="hittable bumper spinny"></span>').append(itemz);
itema.css("left", Math.random() * (width - 60 - 300));
itema.css("top", Math.random() * (height - 60));
itema.css("position", "absolute");
var itemb = $('<span class="hittabletop"></span>').append(itema);
$(".mw-parser-output").append(itemb);
}
if (slayerState >= 17) {
displayAchievement("Slayer");
}
}
}
}
if (slayerState >= 18) {
if (MD5(mw.config.get('wgTitle')) == "f06eb95413908c7a0be080f82e1f4d56") {
if (slayerState == 18) {
slayerState += 1;
save("apr-slayerstate", slayerState);
}
if (slayerState >= 19) {
crab("SlayerWin", Date.now() - bossTimer);
displayAchievement("Slayer2");
}
}
}
}
}
function loggedInAchievement() {

if (mw.config.get("wgUserName")) {
function checkAchievementKillCount(){
displayAchievement("LoggedIn");
var pagekills = 0
}
var totalkills = load("apr-totalkills")
}
for(var i=0; i<NPCarray.length; i++){
function checkAchievementSimples(npc) {
pagekills += NPCarray[i].dead
if (achievementsOpen) {
displayAchievement("Inception");
} else {
var query = MD5(mw.config.get('wgTitle'));
if (query == "a8e0286c13b376010251a761326a4b61" || query == "78698ef9be047049e324fbf8762e49e3" || query == "3e3411dc9821e95190da5b609451029f" || query == "e138090effb008476982705d2a74857d") {
displayAchievement("CerealKiller");
}
}
if (query == "09ec2c80c276b958ef255c6120cbe97a") {
if(totalkills>=1000){
displayAchievement("Total1000Kill");
displayAchievement("73");
} else if(totalkills>=50){
displayAchievement("Total100Kill");
} else if(totalkills>=10){
displayAchievement("Total10Kill");
}
}
if (query == "50b168de95e4814306c14fb2b14fb8d2" || query == "0bedb1f1643387b05f11d102b6652815") {
if(pagekills >= 5){
displayAchievement("Page5Kill");
displayAchievement("HandBite");
}
}
if (query == "b31eb4b7a63bfaa339c679b86445b700" || query == "789ef204f9b93cc224a4e25694691684") {

var wep = load("apr-weapon");
}
if (wep[0] == "Dragon dagger(p++)") {
function updateDarkModeAchievement(){
save("apr-weapon", ['Dragon dagger', '0 0', 'red']);
var mode = getCookie("darkmode")
enableDDS(['Dragon dagger', '0 0', 'red']);
var lightdark = load("apr-lightdark")
displayAchievement("Dishwasher");
if(mode === false || mode === "false"){
lightdark[0] = true;
}
} else {
lightdark[1] = true;
}
}
if (query == "5fdea4b55ecfc08b41b2e00f20e0e77e" || query == "0a671d6817c73446d1f2603796ba243a" || query == "9d41e8047e0a8e8b4434f117b4f1aa7d") {
save("apr-lightdark",lightdark)
var wep2 = load("apr-weapon");
if(lightdark[0] && lightdark[1]){
if (wep2[0] == "Dragon dagger") {
displayAchievement("LightDark")
save("apr-weapon", ['Dragon dagger(p++)', '0 0', 'red']);
enableDDS(['Dragon dagger(p++)', '0 0', 'red']);
displayAchievement("Herbalist");
}
}
}
if (query == "7dd8d4d08aa31a5c516f21d40a03c8a5") {
}
crab("FireCape", Date.now() - bossTimer);
function slayerAchievements(){
displayAchievement("FireCape");
var slayerState = load("apr-slayerstate")
if(slayerState >= 4){
if(MD5(mw.config.get('wgTitle')) == "4f66ec58eb4e9d48b01a7480c51c89b4") {
if(slayerState < 17){
slayerState += 1
save("apr-slayerstate",slayerState)
var width = $(window).width()
var height = $(window).height()
var itemz = $('<img src="'+getFileURL(mw.config.get('wgTitle')+'.png')+'" width="60" height="40">')
itemz.css("transform",'rotate('+Math.random()+'turn)');
itemz.prop("fixed","true")
var itema = $('<span class="hittable bumper spinny"></span>').append(itemz)
itema.css("left",Math.random()*(width-60-300))
itema.css("top",Math.random()*(height-60))
itema.css("position","absolute")
var itemb = $('<span class="hittabletop"></span>').append(itema)
$(".mw-parser-output").append(itemb)
}
if(slayerState>=17){
displayAchievement("Slayer")
}
}
}
}
if (query == "1f54189f4d37bb3eeacf73027c8d6667") {
if(slayerState >= 18){
displayAchievement("Announce");
if(MD5(mw.config.get('wgTitle')) == "f06eb95413908c7a0be080f82e1f4d56") {
if(slayerState == 18){
slayerState += 1
save("apr-slayerstate",slayerState)
}
if(slayerState>=19){
crab("SlayerWin",Date.now() - bossTimer)
displayAchievement("Slayer2")
}
}
}
}
if (MD5(query) == "1885ba58ea6e51744e1938e166151112") {
}
var wep3 = MD5(load("apr-weapon")[0]);

if (wep3 == "5c4f94f3be5e790ad8d5c058b69c037f" || wep3 == "b60c371438a43749555f0a4cbaeceeff") {
function loggedInAchievement(){
displayAchievement("Uncle");
if(mw.config.get("wgUserName")){
}
displayAchievement("LoggedIn")
}
}
if (query == "324696af5d4cb32efd2594c463cc56cc") {
}
var wep4 = load("apr-weapon");

if (wep4[0] == "Dragon scimitar") {
function checkAchievementSimples(npc){
save("apr-weapon", ['Dragon scimitar (or)', '0 0', 'rgb(183,137,21)']);
if(achievementsOpen){
enableDDS(['Dragon scimitar (or)', '0 0', 'rgb(183,137,21)']);
displayAchievement("Inception")
displayAchievement("Trimmed");
} else {
} else if (wep4[0] == "Dragon scimitar (or)") {
var query = MD5(mw.config.get('wgTitle'))
save("apr-weapon", ["Dragon scimitar", "0 0", "red"]);
if(query == "a8e0286c13b376010251a761326a4b61" || query == "78698ef9be047049e324fbf8762e49e3" || query == "3e3411dc9821e95190da5b609451029f" || query == "e138090effb008476982705d2a74857d") {
enableDDS(["Dragon scimitar", "0 0", "red"]);
displayAchievement("CerealKiller")
}
displayAchievement("Trimmed");
}
if(query == "09ec2c80c276b958ef255c6120cbe97a"){
displayAchievement("73")
}
if(query == "50b168de95e4814306c14fb2b14fb8d2" || query == "0bedb1f1643387b05f11d102b6652815"){
displayAchievement("HandBite")
}
if(query == "b31eb4b7a63bfaa339c679b86445b700" || query == "789ef204f9b93cc224a4e25694691684"){
var wep = load("apr-weapon")
if(wep[0] == "Dragon dagger(p++)"){
save("apr-weapon",['Dragon dagger','0 0','red'])
enableDDS(['Dragon dagger','0 0','red']);
displayAchievement("Dishwasher")
}
}
if(query == "5fdea4b55ecfc08b41b2e00f20e0e77e" || query == "0a671d6817c73446d1f2603796ba243a" || query == "9d41e8047e0a8e8b4434f117b4f1aa7d"){
var wep2 = load("apr-weapon")
if(wep2[0] == "Dragon dagger"){
save("apr-weapon",['Dragon dagger(p++)','0 0','red'])
enableDDS(['Dragon dagger(p++)','0 0','red']);
displayAchievement("Herbalist")
}
}
if(query == "7dd8d4d08aa31a5c516f21d40a03c8a5"){
crab("FireCape",Date.now() - bossTimer)
displayAchievement("FireCape")
}
if(query == "1f54189f4d37bb3eeacf73027c8d6667"){
displayAchievement("Announce")
}
if(MD5(query) == "1885ba58ea6e51744e1938e166151112"){
var wep3 = MD5(load("apr-weapon")[0])
if(wep3 == "5c4f94f3be5e790ad8d5c058b69c037f" || wep3 == "b60c371438a43749555f0a4cbaeceeff"){
displayAchievement("Uncle")
}
}
if(query == "324696af5d4cb32efd2594c463cc56cc"){
var wep4 = load("apr-weapon")
if(wep4[0] == "Dragon scimitar"){
save("apr-weapon",['Dragon scimitar (or)','0 0','rgb(183,137,21)'])
enableDDS(['Dragon scimitar (or)','0 0','rgb(183,137,21)']);
displayAchievement("Trimmed")
} else if(wep4[0] == "Dragon scimitar (or)"){
save("apr-weapon",["Dragon scimitar","0 0","red"])
enableDDS(["Dragon scimitar","0 0","red"]);
displayAchievement("Trimmed")
}
}
if(query == "fd9cf477745dbeee730e23af6a81a887"){
displayAchievement("GetBond")
}
}
}
if (query == "fd9cf477745dbeee730e23af6a81a887") {
displayAchievement("GetBond");
}
}
}
}

var mouseStateDown = false;
var mouseStateDown = false;
var DDSenabled = false;
var DDSenabled = false;
var lastHit = 0;
var lastHit = 0;
var bossTimer = 0;
var bossTimer = 0;

var NPCarray = [];
var NPCarray = [];
function Invaders() {

function Invaders(){
function getHeight(i) {
if (i < 2) {

return 6;
function getHeight(i){
if(i<2){
return 6
}
return 4
}
}
return 4;
function updateDom(enemy){
}
if(enemy.y < 0){
function updateDom(enemy) {
enemy.dom.css("display","none")
} else {
if (enemy.y < 0) {
enemy.dom.css("left",leftoffset+blocksize*enemy.x)
enemy.dom.css("display", "none");
} else {
enemy.dom.css("top",topoffset+blocksize*enemy.y)
enemy.dom.css("left", leftoffset + blocksize * enemy.x);
}
enemy.dom.css("top", topoffset + blocksize * enemy.y);
}
}
}

function InvaderEnemy(type,i,j){
function InvaderEnemy(type, i, j) {
this.x = 3+j*4
this.x = 3 + j * 4;
if(i<=2){
if (i <= 2) {
this.y = 0+i*8
this.y = 0 + i * 8;
} else {
} else {
this.y = 16+(i-2)*6
this.y = 16 + (i - 2) * 6;
}

var img
var tall
var wide = 2
if(type == "healer"){
img = "/images/Penance_Healer_front_angle.png?69c56"
tall = 6
} else {
img = "/images/Penance_Runner_front_angle.png?69c56"
tall = 4
}

this.dom = $('<img id="'+i+'MOB'+j+'" class="apr-invader-mob" src="'+img+'" style="height'+(tall*blocksize)+':px;width:'+(wide*blocksize)+'px;">')
this.dom.appendTo('.apr-invader')

updateDom(this)
}
}
function Cannon(){
var img;
this.x = 0
var tall;
this.y = 39
var wide = 2;
if (type == "healer") {
this.dom = $('<img id="cannonMOB" class="apr-invader-mob" src="/images/Egg_launcher_top_view.png?3b932" style="height'+(3.13703703704*blocksize)+':px;width:'+(2*blocksize)+'px;">')
img = "/images/Penance_Healer_front_angle.png?69c56";
this.dom.appendTo('.apr-invader')
updateDom(this)
tall = 6;
} else {
img = "/images/Penance_Runner_front_angle.png?69c56";
tall = 4;
}
}
this.dom = $('<img id="' + i + 'MOB' + j + '" class="apr-invader-mob" src="' + img + '" style="height' + tall * blocksize + ':px;width:' + wide * blocksize + 'px;">');
function Egg(){
this.x = -1
this.dom.appendTo('.apr-invader');
this.y = -1
updateDom(this);
}
this.dom = $('<img id="eggMOB" class="apr-invader-mob" src="/images/thumb/Red_egg_detail.png/160px-Red_egg_detail.png?e0ce4" style="height'+(1.49375*blocksize)+':px;width:'+blocksize+'px;">')
function Cannon() {
this.dom.appendTo('.apr-invader')
this.x = 0;
updateDom(this)
this.y = 39;
this.dom = $('<img id="cannonMOB" class="apr-invader-mob" src="/images/Egg_launcher_top_view.png?3b932" style="height' + 3.13703703704 * blocksize + ':px;width:' + 2 * blocksize + 'px;">');
this.dom.appendTo('.apr-invader');
updateDom(this);
}
function Egg() {
this.x = -1;
this.y = -1;
this.dom = $('<img id="eggMOB" class="apr-invader-mob" src="/images/thumb/Red_egg_detail.png/160px-Red_egg_detail.png?e0ce4" style="height' + 1.49375 * blocksize + ':px;width:' + blocksize + 'px;">');
this.dom.appendTo('.apr-invader');
updateDom(this);
}
function mainLoop() {
if (direction == 0) {
enemyArray[currenti][currentj].x += 1;
if (enemyArray[currenti][currentj].x == 42) {
nextDirection = 1;
}
} else if (direction == 1 || direction == 3) {
enemyArray[currenti][currentj].y += 1;
var deathrow = 40 - getHeight(currenti);
if (enemyArray[currenti][currentj].y == deathrow) {
crab("Rah");
gameEnabled = false;
}
} else if (direction == 2) {
enemyArray[currenti][currentj].x -= 1;
if (enemyArray[currenti][currentj].x == 0) {
nextDirection = 3;
}
}
}
updateDom(enemyArray[currenti][currentj]);

cannon.x = Math.min(43, Math.max(0, Math.floor((lastX - leftoffset) / blocksize))) - 0.5;
function mainLoop(){
updateDom(cannon);
if(direction == 0){
lastShot -= 1;
enemyArray[currenti][currentj].x += 1
if (lastShot <= 0 && mouseStateDown) {
if(enemyArray[currenti][currentj].x == 42){
nextDirection = 1
egg.x = cannon.x + 0.5;
}
egg.y = cannon.y;
lastShot = 40;
} else if(direction == 1 || direction == 3){
egg.dom.css("display", "inline");
enemyArray[currenti][currentj].y += 1
}

egg.y -= 1;
var deathrow = 40-getHeight(currenti)
var i, j;
if(enemyArray[currenti][currentj].y == deathrow){
var height;
crab("Rah")
gameEnabled = false;
for (i = 0; i < 4; i++) {
}
height = getHeight(i);
} else if(direction == 2){
for (j = 0; j < 10; j++) {
enemyArray[currenti][currentj].x -= 1
if (enemyArray[i][j]) {
if(enemyArray[currenti][currentj].x == 0){
if (egg.x >= enemyArray[i][j].x && egg.x < enemyArray[i][j].x + 2 && egg.y >= enemyArray[i][j].y && egg.y < enemyArray[i][j].y + height) {
nextDirection = 3
egg.y = -1;
}
enemyArray[i][j].dom.remove();
enemyArray[i][j] = false;
kills += 1;
}
}
}
}
updateDom(enemyArray[currenti][currentj])
}

updateDom(egg);
cannon.x = Math.min(43,Math.max(0,Math.floor((lastX-leftoffset)/blocksize)))-0.5
do {
updateDom(cannon)
if (kills == 40) {

lastShot -= 1
break;
}
if(lastShot <= 0 && mouseStateDown){
egg.x = cannon.x+0.5
currentj += 1;
egg.y = cannon.y
if (currentj == 10) {
lastShot = 40
currentj = 0;
currenti -= 1;
egg.dom.css("display","inline")
}
if (currenti == -1) {
egg.y -= 1
currenti = 3;
direction = nextDirection;

if (direction == 1 || direction == 3) {
var i,j
nextDirection = 3 - direction;
var height
for (i = 0; i < 4; i++) {
}
height = getHeight(i)
for (j = 0; j < 10; j++) {
if(enemyArray[i][j]){
if(egg.x >= enemyArray[i][j].x && egg.x < enemyArray[i][j].x+2 && egg.y >= enemyArray[i][j].y && egg.y < enemyArray[i][j].y+height){
egg.y=-1
enemyArray[i][j].dom.remove()
enemyArray[i][j] = false
kills += 1
}
}
}
}

updateDom(egg)

do{
if(kills == 40){
break
}
currentj+=1
if(currentj==10){
currentj=0
currenti-=1
if(currenti==-1){
currenti=3
direction=nextDirection
if(direction == 1 || direction == 3){
nextDirection = 3-direction
}
}
}
}
while(!enemyArray[currenti][currentj])

gameTicks += 1

if(gameEnabled && kills < 40){
setTimeout(mainLoop,25)
}
if(kills == 40){
displayAchievement("Invaders")
crab("Invaders",gameTicks)
}
}
}
} while (!enemyArray[currenti][currentj]);
gameTicks += 1;
if (gameEnabled && kills < 40) {
setTimeout(mainLoop, 25);
}
}
if (kills == 40) {

displayAchievement("Invaders");
var width = $(window).width()
crab("Invaders", gameTicks);
var height = $(window).height()

var leftoffset = 0
var topoffset = 0
var blocksize
if(width>height){
leftoffset = (width-height)/2
blocksize = height/44
} else {
topoffset = (height-width)/2
blocksize = width/44
}
}
}

var width = $(window).width();

var height = $(window).height();
disableDDS(['/images/Attacker_icon.png?f5946','3 0','red'])
var leftoffset = 0;
var topoffset = 0;
$('body').append('<div class="apr-invader" style="background:url(/images/thumb/Barbarian_Assault_Field.png/600px-Barbarian_Assault_Field.png?91094);background-size:cover;left:'+leftoffset+'px;top:'+topoffset+'px;width:'+(blocksize*44)+'px;height:'+(blocksize*44)+'px"/>')
var blocksize;

if (width > height) {
var i,j
leftoffset = (width - height) / 2;
var enemyArray = []
var type = "healer"
blocksize = height / 44;
} else {
for (i = 0; i < 4; i++) {
if(i==2){
topoffset = (height - width) / 2;
blocksize = width / 44;
type = "runner"
}
}
disableDDS(['/images/Attacker_icon.png?f5946', '3 0', 'red']);
enemyArray[i]=[]
$('body').append('<div class="apr-invader" style="background:url(/images/thumb/Barbarian_Assault_Field.png/600px-Barbarian_Assault_Field.png?91094);background-size:cover;left:' + leftoffset + 'px;top:' + topoffset + 'px;width:' + blocksize * 44 + 'px;height:' + blocksize * 44 + 'px"/>');
for (j = 0; j < 10; j++) {
var i, j;
enemyArray[i][j] = new InvaderEnemy(type,i,j)
}
var enemyArray = [];
var type = "healer";
for (i = 0; i < 4; i++) {
if (i == 2) {
type = "runner";
}
}
var cannon = new Cannon()
enemyArray[i] = [];
var egg = new Egg()
for (j = 0; j < 10; j++) {
enemyArray[i][j] = new InvaderEnemy(type, i, j);

}
var direction = 0
}
var nextDirection = 0
var cannon = new Cannon();

var currentj = 0
var egg = new Egg();
var currenti = 3
var direction = 0;
var kills = 0
var nextDirection = 0;
var currentj = 0;

var lastShot = 10
var currenti = 3;
var gameEnabled = true
var kills = 0;
var lastShot = 10;

var gameTicks = 0
var gameEnabled = true;
var gameTicks = 0;

mainLoop();
mainLoop();

}
}
var achievementTimeOut = 0;

function displayAchievement(achievementref) {
var achievementTimeOut = 0
var achievementList = load('apr-achievementlist');
function displayAchievement(achievementref){
if (achievementref in achievementList) {

return;
var achievementList = load('apr-achievementlist')
}
if(achievementref in achievementList){
if (achievementref != "FirstHit" && !("FirstHit" in achievementList)) {
return
return;
}
if (achievementsOpen && !(achievementref == "Total10Kill" || achievementref == "Total100Kill" || achievementref == "Total1000Kill" || achievementref == "Page5Kill" || achievementref == "Inception" || achievementref == "LoggedIn")) {
return;
}
var curTime = Date.now();
if (achievementTimeOut + 5000 < curTime) {
achievementTimeOut = curTime;
var achievement = achievements.get(achievementref);
achievementList[achievementref] = true;
save('apr-achievementlist', achievementList);
save('apr-gp', load('apr-gp') + achievement.points);
save('apr-gp-total', load('apr-gp-total') + achievement.points);
var toppx = 52;
if (window.chrome) {
toppx = 12;
}
}
$('body').append("<div class='achievement-banner'>" + "<div class='achievement-icon'>" + "<span class='icon'><span class='icon-trophy'><img style='position:absolute;top:" + toppx + "px;left:-20px;width:40px;height:40px;' src='" + achievement.icon + "'</img></span></span>" + "</div>" + "<div class='achievement-text'>" + "<p class='achievement-notification'>Achievement unlocked</p>" + "<p class='achievement-name'>" + achievement.points + "k GP &ndash; " + achievement.name + "</p>" + "</div>" + "</div>");
if(achievementref != "FirstHit" && !("FirstHit" in achievementList)){
if (achievementref == "FirstHit") {
return
achievementButton();
crab("FirstBlood");
}
}
if (achievementsOpen) {
if(achievementsOpen && !(achievementref == "Total10Kill" || achievementref == "Total100Kill" || achievementref == "Total1000Kill" || achievementref == "Page5Kill" || achievementref == "Inception" || achievementref == "LoggedIn")){
return
drawAchievementList();
drawAchievementList();
}

var curTime = Date.now()
if(achievementTimeOut+5000<curTime){
achievementTimeOut = curTime

var achievement = achievements.get(achievementref)
achievementList[achievementref]=true;
save('apr-achievementlist',achievementList)
save('apr-gp',load('apr-gp')+achievement.points)
save('apr-gp-total',load('apr-gp-total')+achievement.points)

var toppx=52
if(window.chrome){
toppx=12
}

$('body').append("<div class='achievement-banner'>"+
"<div class='achievement-icon'>"+
"<span class='icon'><span class='icon-trophy'><img style='position:absolute;top:"+toppx+"px;left:-20px;width:40px;height:40px;' src='"+achievement.icon+"'</img></span></span>"+
"</div>"+
"<div class='achievement-text'>"+
"<p class='achievement-notification'>Achievement unlocked</p>"+
"<p class='achievement-name'>"+achievement.points+"k GP &ndash; "+achievement.name+"</p>"+
"</div>"+
"</div>")
if(achievementref == "FirstHit"){
achievementButton();
crab("FirstBlood");
}
if(achievementsOpen){
drawAchievementList()
drawAchievementList()
}
} else {
setTimeout(displayAchievement, 250, achievementref);
}
}
} else {
setTimeout(displayAchievement, 250, achievementref);
}
}
}


var achievementsOpen = false;
var achievementsOpen = false;
var pageTitle, pageBody;
var pageTitle, pageBody;
var selectedTab;
var selectedTab;
function drawAchievementList(){
function drawAchievementList() {
if(achievementsOpen){
if (achievementsOpen) {
achievementsOpen = false;
achievementsOpen = false;
$('#' + selectedTab).addClass('selected');
$('#' + selectedTab).addClass('selected');
$('#apr-achievement-button').removeClass('selected');
$('#apr-achievement-button').removeClass('selected');
$('#firstHeading').text(pageTitle);
$('#firstHeading').text(pageTitle);
$('#bodyContent').remove();
$('#bodyContent').remove();
$('#content').append(pageBody);
} else {
$('#content').append(pageBody)
selectedTab = $('#p-namespaces ul > li.selected').attr('id');
achievementsOpen = true;
var achievementList = load('apr-achievementlist');
$('#' + selectedTab).removeClass('selected');
$('#apr-achievement-button').addClass('selected');
pageTitle = $('#firstHeading').text();
$('#firstHeading').text("Achievements");
$('#crob').remove();
pageBody = $('#bodyContent').detach();
$('#content').append('<div id="bodyContent" class="mw-body-content"></div>');
var body = $('#bodyContent');
var maxgp = load('apr-gp-total');
var curgp = load('apr-gp');
if (maxgp == 0) {
maxgp = "0";
} else {
} else {
maxgp += ",000";
selectedTab = $('#p-namespaces ul > li.selected').attr('id');

achievementsOpen = true;
var achievementList = load('apr-achievementlist');

$('#' + selectedTab).removeClass('selected');
$('#apr-achievement-button').addClass('selected');
pageTitle = $('#firstHeading').text()
$('#firstHeading').text("Achievements");
$('#crob').remove();
pageBody = $('#bodyContent').detach();
$('#content').append('<div id="bodyContent" class="mw-body-content"></div>')
var body = $('#bodyContent')

var maxgp = load('apr-gp-total')
var curgp = load('apr-gp')
if(maxgp == 0){
maxgp = "0"
} else {
maxgp += ",000"
}
if(curgp == 0){
curgp = "0"
} else {
curgp += ",000"
}

body.append("<p>Welcome to the achievements tab! So far, you have obtained a total of <b><span class='maxgp'>"+maxgp+"<span> GP</b>! You have <b><span class='curgp'>"+curgp+"</span> GP</b> left to spend. You have <b>"+load('apr-totalkills')+" kills</b> in total.</p>")

var myweps = load('apr-weapon-inv')

if(myweps.length > 0){
body.append("<h2><span class='mw-headline'>Available cosmetic weapons</span></h2>")
var mywepsd = $('<div class="apr-weapon-big"/>')
body.append(mywepsd)
for (var i = 0; i < myweps.length; i++) {
var item = $("<div class='apr-weapon'><img src='"+getFileURL(myweps[i][0]+' cursor.png')+"'></div>")
item.click([i,myweps],function(e){
var i = e.data[0]
var myweps = e.data[1]
var curwep = load("apr-weapon")
save("apr-weapon",myweps[i])
setWeapon(myweps[i],true)
myweps[i] = curwep
save("apr-weapon-inv",myweps)
drawAchievementList()
drawAchievementList()
})
item.css("cursor","default")
mywepsd.append(item)
}
}


var buyweps = load('apr-weapon-buy')

if(buyweps.length > 0){
body.append("<h2><span class='mw-headline'>Cosmetic weapons for sale</span></h2><p>Buy any of the weapons for the listed price.</p>")
var buywepsd = $('<div class="apr-weapon-big" style="height:60px"/>')
body.append(buywepsd)
for (i = 0; i < buyweps.length; i++) {
var item2 = $("<div class='apr-weapon'><div class='apr-weapon-icon'><img src='"+getFileURL(buyweps[i][0][0]+' cursor.png')+"'></div><div class='apr-weapon-price'>"+buyweps[i][1]+"k</div></div>")
item2.click([i,buyweps],function(e){
var i = e.data[0];
var buyweps = e.data[1]
var curgp = load('apr-gp')
var price = buyweps[i][1]
if(curgp>=price){
var curwep = load("apr-weapon")
myweps.unshift(curwep)
save("apr-weapon-inv",myweps)
save("apr-weapon",buyweps[i][0])
setWeapon(buyweps[i][0],true)
buyweps.splice(i,1)
save("apr-weapon-buy",buyweps)
save("apr-gp",curgp-price)
drawAchievementList()
drawAchievementList()
} else {
crab("Poor",price)
}
})
item2.css("cursor","default")
buywepsd.append(item2)
}
}

body.append("<h2><span class='mw-headline'>Achievements list</span></h2>")
body.append('<div class="apr-achievement-container"></div>')
achievements.forEach(function(achievement,achievementref){
var icon
var achieved = ''
var filler = ''
if(achievementref in achievementList){
icon = getFileURL('Clippy_Achievement '+achievement.name+'.png');
achieved = 'achieved';
filler = achievement.filler;
} else {
icon = '/images/Clippy_Achievement_none.jpg?779d5'
}
$('.apr-achievement-container').append(
'<div class="apr-achievement '+achieved+'">'+
'<div class="apr-achievement-icon">'+
'<span class="hittable bumper spinny"><img src="'+icon+'"></span>'+
'</div>'+
'<div class="apr-achievement-text">'+
'<div class="apr-achievement-title">'+achievement.name+'</div>'+
'<div class="apr-achievement-desc">'+achievement.desc+'</div>'+
'<div class="apr-achievement-filler">'+filler+'</div>'+
'</div>'+
'<div class="apr-achievement-points">'+achievement.points+',000 GP</div>'+
'</div>')
})
}
}
if (curgp == 0) {
}
curgp = "0";

function achievementButton(){
var achievementList = load('apr-achievementlist')
if('FirstHit' in achievementList){
$('#p-namespaces ul').append(
'<li id="apr-achievement-button">'+
'<span>'+
'<a'+
' href="javascript:void(0)"'+
' title="View your Achievements">'+
'Toggle Achievements'+
'</a>'+
'</span>'+
'</li>')
$('#apr-achievement-button').click(drawAchievementList);
}
}

function toggleApr(){
var gadgetEnabled = load("apr-gadgetenabled")
if(gadgetEnabled){
save("apr-gadgetenabled",false)
$('#apr-toggle-button > a').text("Enable cursor")
crab("DisableCursor")
} else {
} else {
save("apr-gadgetenabled",true)
curgp += ",000";
$('#apr-toggle-button > a').text("Disable cursor")
crab("EnableCursor")
}
}
body.append("<p>Welcome to the achievements tab! So far, you have obtained a total of <b><span class='maxgp'>" + maxgp + "<span> GP</b>! You have <b><span class='curgp'>" + curgp + "</span> GP</b> left to spend. You have <b>" + load('apr-totalkills') + " kills</b> in total.</p>");
var myweps = load('apr-weapon-inv');
if (myweps.length > 0) {
body.append("<h2><span class='mw-headline'>Available cosmetic weapons</span></h2>");
var mywepsd = $('<div class="apr-weapon-big"/>');
body.append(mywepsd);
for (var i = 0; i < myweps.length; i++) {
var item = $("<div class='apr-weapon'><img src='" + getFileURL(myweps[i][0] + ' cursor.png') + "'></div>");
item.click([i, myweps], function (e) {
var i = e.data[0];
var myweps = e.data[1];
var curwep = load("apr-weapon");
save("apr-weapon", myweps[i]);
setWeapon(myweps[i], true);
myweps[i] = curwep;
save("apr-weapon-inv", myweps);
drawAchievementList();
drawAchievementList();
});
item.css("cursor", "default");
mywepsd.append(item);
}
}
var buyweps = load('apr-weapon-buy');
if (buyweps.length > 0) {
body.append("<h2><span class='mw-headline'>Cosmetic weapons for sale</span></h2><p>Buy any of the weapons for the listed price.</p>");
var buywepsd = $('<div class="apr-weapon-big" style="height:60px"/>');
body.append(buywepsd);
for (i = 0; i < buyweps.length; i++) {
var item2 = $("<div class='apr-weapon'><div class='apr-weapon-icon'><img src='" + getFileURL(buyweps[i][0][0] + ' cursor.png') + "'></div><div class='apr-weapon-price'>" + buyweps[i][1] + "k</div></div>");
item2.click([i, buyweps], function (e) {
var i = e.data[0];
var buyweps = e.data[1];
var curgp = load('apr-gp');
var price = buyweps[i][1];
if (curgp >= price) {
var curwep = load("apr-weapon");
myweps.unshift(curwep);
save("apr-weapon-inv", myweps);
save("apr-weapon", buyweps[i][0]);
setWeapon(buyweps[i][0], true);
buyweps.splice(i, 1);
save("apr-weapon-buy", buyweps);
save("apr-gp", curgp - price);
drawAchievementList();
drawAchievementList();
} else {
crab("Poor", price);
}
});
item2.css("cursor", "default");
buywepsd.append(item2);
}
}
body.append("<h2><span class='mw-headline'>Achievements list</span></h2>");
body.append('<div class="apr-achievement-container"></div>');
achievements.forEach(function (achievement, achievementref) {
var icon;
var achieved = '';
var filler = '';
if (achievementref in achievementList) {
icon = getFileURL('Clippy_Achievement ' + achievement.name + '.png');
achieved = 'achieved';
filler = achievement.filler;
} else {
icon = '/images/Clippy_Achievement_none.jpg?779d5';
}
$('.apr-achievement-container').append('<div class="apr-achievement ' + achieved + '">' + '<div class="apr-achievement-icon">' + '<span class="hittable bumper spinny"><img src="' + icon + '"></span>' + '</div>' + '<div class="apr-achievement-text">' + '<div class="apr-achievement-title">' + achievement.name + '</div>' + '<div class="apr-achievement-desc">' + achievement.desc + '</div>' + '<div class="apr-achievement-filler">' + filler + '</div>' + '</div>' + '<div class="apr-achievement-points">' + achievement.points + ',000 GP</div>' + '</div>');
});
}
}
}
function achievementButton() {

var achievementList = load('apr-achievementlist');
function enableDisableButton(){
if ('FirstHit' in achievementList) {
var fillertext
$('#p-namespaces ul').append('<li id="apr-achievement-button">' + '<span>' + '<a' + ' href="javascript:void(0)"' + ' title="View your Achievements">' + 'Toggle Achievements' + '</a>' + '</span>' + '</li>');
if(load("apr-gadgetenabled")){
$('#apr-achievement-button').click(drawAchievementList);
fillertext = "Disable cursor"
}
}
function toggleApr() {
var gadgetEnabled = load("apr-gadgetenabled");
if (gadgetEnabled) {
save("apr-gadgetenabled", false);
$('#apr-toggle-button > a').text("Enable cursor");
crab("DisableCursor");
} else {
save("apr-gadgetenabled", true);
$('#apr-toggle-button > a').text("Disable cursor");
crab("EnableCursor");
}
}
function enableDisableButton() {
var fillertext;
if (load("apr-gadgetenabled")) {
fillertext = "Disable cursor";
} else {
fillertext = "Enable cursor";
}
$('#t-gadget-newpage').after('<li id="apr-toggle-button"><a href="javascript:void(0)" title="Enable or disable the cursor">' + fillertext + '</a></li>');
$('#apr-toggle-button').click(toggleApr);
}
var achievements = new Map([["FirstHit", {
"name": "First Blood",
"desc": "Attack something!",
"filler": 'A cold-blooded "accident".',
"points": 10
}], ["Total10Kill", {
"name": "Amateur Killer",
"desc": "Kill 10 targets.",
"filler": "Does anyone got a runez scazmatar they dont need?",
"points": 10
}], ["Total100Kill", {
"name": "Dedicated Killer",
"desc": "Kill 50 targets!",
"filler": "Level 50. Halfway to 99! You've unlocked the <a href='https://oldschool.runescape.wiki/w/Slaughterhouse'>slaughterhouse!</a>",
"points": 25
}], ["Total1000Kill", {
"name": "Professional Killer",
"desc": "Kill 1,000 targets!! Trigger-happy much?",
"filler": "Grinding as hard as in actual OSRS. Congratulations!",
"points": 100
}], ["Page5Kill", {
"name": "Serial Killer",
"desc": "Kill 5 targets on the same page.",
"filler": "Heads up! Enemy UAV spotted!",
"points": 25
}], ["CerealKiller", {
"name": "Cereal Killer",
"desc": "Kill someone's breakfast.",
"filler": "Are you Sam-I-Am?",
"points": 25
}], ["73", {
"name": "73 Re-enactment",
"desc": "Ahhhahahaha!",
"filler": "Never forget.",
"points": 73
}], ["LightDark", {
"name": "Change of Heart",
"desc": "Kill in the Light and in the Dark.",
"filler": "Perfectly balanced. As all things should be.",
"points": 25
}], ["GetBond", {
"name": "GET BOND",
"desc": "Get a bond.",
"filler": "Look out for future One Small Wiki Favour tasks!",
"points": 10
}], ["HandBite", {
"name": "The Hand that Feeds",
"desc": "Test your blade on a blue-haired fairy.",
"filler": "Your heart, it is black and it's hollow and it's cold.",
"points": 10
}], ["Inception", {
"name": "Inception",
"desc": "Achievement an achievement.",
"filler": "If you're going to perform inception, you need imagination.",
"points": 25
}], ["Died", {
"name": "Lumbridge",
"desc": "Visit Lumbridge.",
"filler": "Oh... THAT kind of visit.",
"points": 10
}], ["LoggedIn", {
"name": "The Wikian",
"desc": "Kill something while logged in.",
"filler": "🎶 People doing things, and editing things, and doing things. That's the wiki! 🎶",
"points": 50
}], ["Wombat", {
"name": "WOMbat",
"desc": "?????",
"filler": "Batted away by the WOM!",
"points": 10
}], ["Announce", {
"name": "An Important Announcement",
"desc": "Become an anti-RWT specialist.",
"filler": "Enjoy your lambo.",
"points": 25
}], ["Uncle", {
"name": "Monkey's Uncle",
"desc": "Surprise a shopkeeper with a special weapon.",
"filler": "Seriously, you'll be a monkey's uncle before you'll ever hold this.",
"points": 25
}], ["Trimmed", {
"name": "Trimmed",
"desc": "Trim your weapon.",
"filler": "Phr44 armour tr1mming!",
"points": 25
}], ["Dishwasher", {
"name": "Dishwasher",
"desc": "Clean your dagger.",
"filler": "Needs more weapon poison.",
"points": 25
}], ["Herbalist", {
"name": "Herbalist",
"desc": "Fix your dagger.",
"filler": "Needs less weapon poison.",
"points": 25
}], ["Cucco", {
"name": "20 Hearts",
"desc": "Survive against 200 members of the Cucco's Revenge Squad.",
"filler": "It's dangerous to go alone! Take this!",
"points": 100
}], ["Invaders", {
"name": "Torso Hunter",
"desc": "Get your first Fighter torso by killing a Penance creature as a Defender or Healer.",
"filler": "(1) Join Casual BA to hunt for Pet penance queen.<br>(2) Participate in Casual BA raids and plank like IgnobleSolid.<br>(3) ??? (4) Profit.",
"points": 50
}], ["FireCape", {
"name": "Starter Cape",
"desc": "Get your first Fire Cape.",
"filler": "Gotta post your first fire cape to Reddit, as is tradition.",
"points": 100
}], ["Slayer", {
"name": "Slayer Beginner",
"desc": "Complete a slayer assignment.",
"filler": "On the way to being a chad...",
"points": 50
}], ["Slayer2", {
"name": "Slayer Master",
"desc": "Complete 2 slayer assignments.",
"filler": "*When Nieve finds out you have 99 Slayer*",
"points": 150
}], ["OldWOM", {
"name": "Credits",
"desc": "Go Sailing with the Wise Old Man.",
"filler": "Thanks for playing! ~Gau Cho (gaucho#9471, u/gauchoob)",
"points": 10
}]]);
function april() {
console.log("Bronze Dagger - v72 - by Gau Cho");
var gadgetEnabled = load("apr-gadgetenabled");
if (gadgetEnabled) {
spinny();
crab();
var weapon = load("apr-weapon");
if (load("apr-queststate") >= 500) {
enableDDS(weapon);
} else {
} else {
disableDDS(weapon);
fillertext = "Enable cursor"
}
}
document.body.addEventListener('mousedown', mouseDown);
$('#t-gadget-newpage').after('<li id="apr-toggle-button"><a href="javascript:void(0)" title="Enable or disable the cursor">'+fillertext+'</a></li>')
document.body.addEventListener('mousemove', mouseMove);
$('#apr-toggle-button').click(toggleApr);
document.body.addEventListener('mouseup', mouseUp);

achievementButton();
}
enableDisableButton();
}
}
function waitForElement() {

if (typeof rswiki !== "undefined" && typeof rswiki.hasLocalStorage !== "undefined") {
var achievements = new Map([
["FirstHit", {
april();
} else {
"name": "First Blood",
setTimeout(waitForElement, 250);
"desc": "Attack something!",
}
"filler": 'A cold-blooded "accident".',
"points": 10,
}],
["Total10Kill", {
"name": "Amateur Killer",
"desc": "Kill 10 targets.",
"filler": "Does anyone got a runez scazmatar they dont need?",
"points": 10,
}],
["Total100Kill", {
"name": "Dedicated Killer",
"desc": "Kill 50 targets!",
"filler": "Level 50. Halfway to 99! You've unlocked the <a href='https://oldschool.runescape.wiki/w/Slaughterhouse'>slaughterhouse!</a>",
"points": 25,
}],
["Total1000Kill", {
"name": "Professional Killer",
"desc": "Kill 1,000 targets!! Trigger-happy much?",
"filler": "Grinding as hard as in actual OSRS. Congratulations!",
"points": 100,
}],
["Page5Kill", {
"name": "Serial Killer",
"desc": "Kill 5 targets on the same page.",
"filler": "Heads up! Enemy UAV spotted!",
"points": 25,
}],
["CerealKiller", {
"name": "Cereal Killer",
"desc": "Kill someone's breakfast.",
"filler": "Are you Sam-I-Am?",
"points": 25,
}],
["73", {
"name": "73 Re-enactment",
"desc": "Ahhhahahaha!",
"filler": "Never forget.",
"points": 73,
}],
["LightDark", {
"name": "Change of Heart",
"desc": "Kill in the Light and in the Dark.",
"filler": "Perfectly balanced. As all things should be.",
"points": 25,
}],
["GetBond", {
"name": "GET BOND",
"desc": "Get a bond.",
"filler": "Look out for future One Small Wiki Favour tasks!",
"points": 10,
}],
["HandBite", {
"name": "The Hand that Feeds",
"desc": "Test your blade on a blue-haired fairy.",
"filler": "Your heart, it is black and it's hollow and it's cold.",
"points": 10,
}],
["Inception", {
"name": "Inception",
"desc": "Achievement an achievement.",
"filler": "If you're going to perform inception, you need imagination.",
"points": 25,
}],
["Died", {
"name": "Lumbridge",
"desc": "Visit Lumbridge.",
"filler": "Oh... THAT kind of visit.",
"points": 10,
}],
["LoggedIn", {
"name": "The Wikian",
"desc": "Kill something while logged in.",
"filler": "🎶 People doing things, and editing things, and doing things. That's the wiki! 🎶",
"points": 50,
}],
["Wombat", {
"name": "WOMbat",
"desc": "?????",
"filler": "Batted away by the WOM!",
"points": 10,
}],
["Announce", {
"name": "An Important Announcement",
"desc": "Become an anti-RWT specialist.",
"filler": "Enjoy your lambo.",
"points": 25,
}],
["Uncle", {
"name": "Monkey's Uncle",
"desc": "Surprise a shopkeeper with a special weapon.",
"filler": "Seriously, you'll be a monkey's uncle before you'll ever hold this.",
"points": 25,
}],
["Trimmed", {
"name": "Trimmed",
"desc": "Trim your weapon.",
"filler": "Phr44 armour tr1mming!",
"points": 25,
}],
["Dishwasher", {
"name": "Dishwasher",
"desc": "Clean your dagger.",
"filler": "Needs more weapon poison.",
"points": 25,
}],
["Herbalist", {
"name": "Herbalist",
"desc": "Fix your dagger.",
"filler": "Needs less weapon poison.",
"points": 25,
}],
["Cucco", {
"name": "20 Hearts",
"desc": "Survive against 200 members of the Cucco's Revenge Squad.",
"filler": "It's dangerous to go alone! Take this!",
"points": 100,
}],
["Invaders", {
"name": "Torso Hunter",
"desc": "Get your first Fighter torso by killing a Penance creature as a Defender or Healer.",
"filler": "(1) Join Casual BA to hunt for Pet penance queen.<br>(2) Participate in Casual BA raids and plank like IgnobleSolid.<br>(3) ??? (4) Profit.",
"points": 50,
}],
["FireCape", {
"name": "Starter Cape",
"desc": "Get your first Fire Cape.",
"filler": "Gotta post your first fire cape to Reddit, as is tradition.",
"points": 100,
}],
["Slayer", {
"name": "Slayer Beginner",
"desc": "Complete a slayer assignment.",
"filler": "On the way to being a chad...",
"points": 50,
}],
["Slayer2", {
"name": "Slayer Master",
"desc": "Complete 2 slayer assignments.",
"filler": "*When Nieve finds out you have 99 Slayer*",
"points": 150,
}],
["OldWOM", {
"name": "Credits",
"desc": "Go Sailing with the Wise Old Man.",
"filler": "Thanks for playing! ~Gau Cho (gaucho#9471, u/gauchoob)",
"points": 10,
}],
])

function april(){
console.log("Bronze Dagger - v72 - by Gau Cho")
var gadgetEnabled = load("apr-gadgetenabled")
if(gadgetEnabled){
spinny();

crab();

var weapon = load("apr-weapon")
if(load("apr-queststate")>=500){
enableDDS(weapon);
} else {
disableDDS(weapon);
}
document.body.addEventListener('mousedown',mouseDown);
document.body.addEventListener('mousemove',mouseMove);
document.body.addEventListener('mouseup',mouseUp);

achievementButton();
}
enableDisableButton();
}

function waitForElement(){
if(typeof rswiki !== "undefined" && typeof rswiki.hasLocalStorage !== "undefined"){
april();
}
else{
setTimeout(waitForElement, 250);
}
}
}
waitForElement();
waitForElement();

Latest revision as of 12:06, 20 October 2024

"use strict";

/* globals $, mw, rswiki*/

Math.Vector = function (x, y) {
  this.x = x;
  this.y = y;
};
Math.Vector.prototype = {
  clone: function clone() {
    return new Math.Vector(this.x, this.y);
  },
  negate: function negate() {
    this.x = -this.x;
    this.y = -this.y;
    return this;
  },
  neg: function neg() {
    return this.clone().negate();
  },
  addeq: function addeq(v) {
    this.x += v.x;
    this.y += v.y;
    return this;
  },
  subeq: function subeq(v) {
    return this.addeq(v.neg());
  },
  add: function add(v) {
    return this.clone().addeq(v);
  },
  sub: function sub(v) {
    return this.clone().subeq(v);
  },
  multeq: function multeq(c) {
    this.x *= c;
    this.y *= c;
    return this;
  },
  diveq: function diveq(c) {
    this.x /= c;
    this.y /= c;
    return this;
  },
  mult: function mult(c) {
    return this.clone().multeq(c);
  },
  div: function div(c) {
    return this.clone().diveq(c);
  },
  dot: function dot(v) {
    return this.x * v.x + this.y * v.y;
  },
  length: function length() {
    return Math.sqrt(this.dot(this));
  },
  normal: function normal() {
    return this.clone().diveq(this.length());
  }
};
function evade(evt) {
  if (mouseStateDown && DDSenabled) {
    var $this = $(this);
    var width, height, corner, mouseX, mouseY;
    if ($this.prop("fixed") == "true") {
      width = $(window).width();
      height = $(window).height();
      corner = {
        "left": parseFloat($this.css("left")),
        "top": parseFloat($this.css("top"))
      };
      mouseX = evt.clientX;
      mouseY = evt.clientY;
    } else {
      width = $(document).width();
      height = $(document).height();
      corner = $this.offset();
      mouseX = evt.pageX;
      mouseY = evt.pageY;
    }
    var center = {
      x: corner.left + $this.outerWidth() / 2,
      y: corner.top + $this.outerHeight() / 2
    };
    var dist = new Math.Vector(center.x - mouseX, center.y - mouseY);
    var closest = $this.outerWidth() / 2;
    $this.toggleClass('spinning', true);
    if (dist.length() >= closest) {
      return;
    }
    var delta = dist.normal().multeq(closest).sub(dist),
      newCorner = {
        left: corner.left + delta.x,
        top: corner.top + delta.y
      };
    var padding = parseInt($this.css('padding-left'));
    if (newCorner.left < -padding) {
      newCorner.left = -padding;
    } else if (newCorner.left + $this.outerWidth() - padding > width) {
      newCorner.left = width - $this.outerWidth() + padding;
    }
    if (newCorner.top < -padding) {
      newCorner.top = -padding;
    } else if (newCorner.top + $this.outerHeight() - padding > height) {
      newCorner.top = height - $this.outerHeight() + padding;
    }
    $this.css("position", "absolute");
    if ($this.prop("fixed") == "true") {
      $this.css("left", newCorner.left);
      $this.css("top", newCorner.top);
    } else {
      $this.offset(newCorner);
    }
  }
}
function beginEvade() {
  $(this).on('mousemove', evade);
}
function endEvade() {
  $(this).off('mousemove', evade);
  $(this).toggleClass('spinning', false);
}
function spinny() {
  if ($('.infobox-switch').length > 0 && $('.button-selected').length == 0 && $('select').length == 0) {
    setTimeout(spinny, 250);
    return;
  }
  var wrapper = '<span class="hittabletop"><span class="hittable bumper spinny" /></span>';
  var searchterm = '.mw-parser-output > .floatleft img, ' + '.mw-parser-output > .floatright img, ' + '.mw-parser-output > .rsw-synced-switch .floatleft img, ' + '.infobox-monster .infobox-image img, ' + '.infobox-npc .infobox-full-width-content img, ' + '.infobox-jagex img';
  var excludeterm = '.leaflet-tile';
  var title = mw.config.get('wgTitle');
  var query = MD5(title);
  if (query == "e8f65c7327e4ae90e767afc30a709419") {
    wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>';
  }
  if (query == "7dd8d4d08aa31a5c516f21d40a03c8a5") {
    wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>';
    searchterm = '.infobox-monster .infobox-image img';
    for (var key in TTJlist) {
      $("#content").prepend('<img src="' + TTJlist[key] + '" width="1" height="1">');
    }
  }
  if (query == "f06eb95413908c7a0be080f82e1f4d56") {
    wrapper = '<span class="hittabletop"><span class="hittable bumper" /></span>';
    searchterm = '.infobox-monster .infobox-image img';
  }
  $(searchterm).not(excludeterm).wrap(wrapper);
  if (query == "04f12d4923ec5069ac75e6d364b719cb" && load("apr-totalkills") >= 50) {
    $("#mw-content-text").empty();
    var width = $(window).width();
    var height = $(window).height();
    var resizeratio = Math.min(1, width / 1903 * height / 976);
    for (i = 0; i < resizeratio * 100; i++) {
      var itemz = $('<img src="' + getFileURL('Cow (' + (Math.floor(Math.random() * 3) + 1) + ').png') + '" width="60" height="40">');
      itemz.css("transform", 'rotate(' + Math.random() + 'turn)');
      itemz.prop("fixed", "true");
      var itema = $('<span class="hittable bumper spinny"></span>').append(itemz);
      itema.css("left", Math.random() * (width - 60 - 300));
      itema.css("top", Math.random() * (height - 60));
      itema.css("position", "absolute");
      var itemb = $('<span class="hittabletop"></span>').append(itema);
      $("#mw-content-text").append(itemb);
    }
  }
  $('.bumper').on('mouseover', beginEvade);
  $('.bumper').on('mouseout', endEvade);
}
function load(name) {
  var result;
  if (!rswiki.hasLocalStorage()) {
    console.warn('Browser does not support localStorage');
    return undefined;
  }
  try {
    result = JSON.parse(localStorage.getItem(name));
  } catch (err) {
    console.warn('Error loading from localStorage');
    return undefined;
  }
  if (result === null) {
    if (name == 'apr-weapon') {
      return ['Bronze dagger', '0 0', 'red'];
    }
    if (name == 'apr-weapon-inv') {
      return [['Windows', '0 0', 'white']];
    }
    if (name == 'apr-weapon-buy') {
      return [[["Rune 2h sword", "0 0", "rgb(80, 106, 117)"], 50], [["Dragon defender", "0 0", "red"], 50], [["Dragon scimitar", "0 0", "red"], 50], [["Swift blade", "0 0", "rgb(205, 127, 50)"], 50], [["Toxic staff of the dead", "0 0", "rgb(154, 187, 74)"], 50], [["Armadyl godsword", "0 0", "silver"], 73], [["Kodai wand", "0 0", "blue"], 100], [["Ghrazi rapier", "0 0", "silver"], 100], [["3rd age longsword", "0 0", "silver"], 200], [["Twisted bow", "0 0", "black"], 200]];
    }
    if (name == 'apr-queststate') {
      return 1;
    }
    if (name == 'apr-slayerstate') {
      return 1;
    }
    if (name == 'apr-lastslayermaster') {
      return "Turael";
    }
    if (name == 'apr-gp') {
      return 0;
    }
    if (name == 'apr-gp-total') {
      return 0;
    }
    if (name == 'apr-achievementlist') {
      return {};
    }
    if (name == 'apr-totalkills') {
      return 0;
    }
    if (name == 'apr-lightdark') {
      return [false, false];
    }
    if (name == 'apr-gadgetenabled') {
      return true;
    }
  }
  return result;
}
function save(name, value) {
  if (!rswiki.hasLocalStorage()) {
    console.warn('Browser does not support localStorage');
    return undefined;
  }
  var result = localStorage.setItem(name, JSON.stringify(value));
  try {
    var ret = JSON.parse(localStorage.getItem(value));
    if (ret == result) {
      return true;
    }
    console.warn('Error saving to localStorage');
    return false;
  } catch (err) {
    console.warn('Error saving to localStorage');
    return false;
  }
}
function getCookie(name) {
  var value = "; " + document.cookie;
  var parts = value.split("; " + name + "=");
  if (parts.length == 2) return parts.pop().split(";").shift();
  return false;
}
function MD5(d) {
  result = M(V(Y(X(d), 8 * d.length)));
  return result.toLowerCase();
}
;
function M(d) {
  for (var _, m = "0123456789ABCDEF", f = "", r = 0; r < d.length; r++) _ = d.charCodeAt(r), f += m.charAt(_ >>> 4 & 15) + m.charAt(15 & _);
  return f;
}
function X(d) {
  for (var _ = Array(d.length >> 2), m = 0; m < _.length; m++) _[m] = 0;
  for (m = 0; m < 8 * d.length; m += 8) _[m >> 5] |= (255 & d.charCodeAt(m / 8)) << m % 32;
  return _;
}
function V(d) {
  for (var _ = "", m = 0; m < 32 * d.length; m += 8) _ += String.fromCharCode(d[m >> 5] >>> m % 32 & 255);
  return _;
}
function Y(d, _) {
  d[_ >> 5] |= 128 << _ % 32, d[14 + (_ + 64 >>> 9 << 4)] = _;
  for (var m = 1732584193, f = -271733879, r = -1732584194, i = 271733878, n = 0; n < d.length; n += 16) {
    var h = m,
      t = f,
      g = r,
      e = i;
    f = md5_ii(f = md5_ii(f = md5_ii(f = md5_ii(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_ff(f = md5_ff(f = md5_ff(f = md5_ff(f, r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 0], 7, -680876936), f, r, d[n + 1], 12, -389564586), m, f, d[n + 2], 17, 606105819), i, m, d[n + 3], 22, -1044525330), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 4], 7, -176418897), f, r, d[n + 5], 12, 1200080426), m, f, d[n + 6], 17, -1473231341), i, m, d[n + 7], 22, -45705983), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 8], 7, 1770035416), f, r, d[n + 9], 12, -1958414417), m, f, d[n + 10], 17, -42063), i, m, d[n + 11], 22, -1990404162), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 12], 7, 1804603682), f, r, d[n + 13], 12, -40341101), m, f, d[n + 14], 17, -1502002290), i, m, d[n + 15], 22, 1236535329), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 1], 5, -165796510), f, r, d[n + 6], 9, -1069501632), m, f, d[n + 11], 14, 643717713), i, m, d[n + 0], 20, -373897302), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 5], 5, -701558691), f, r, d[n + 10], 9, 38016083), m, f, d[n + 15], 14, -660478335), i, m, d[n + 4], 20, -405537848), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 9], 5, 568446438), f, r, d[n + 14], 9, -1019803690), m, f, d[n + 3], 14, -187363961), i, m, d[n + 8], 20, 1163531501), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 13], 5, -1444681467), f, r, d[n + 2], 9, -51403784), m, f, d[n + 7], 14, 1735328473), i, m, d[n + 12], 20, -1926607734), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 5], 4, -378558), f, r, d[n + 8], 11, -2022574463), m, f, d[n + 11], 16, 1839030562), i, m, d[n + 14], 23, -35309556), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 1], 4, -1530992060), f, r, d[n + 4], 11, 1272893353), m, f, d[n + 7], 16, -155497632), i, m, d[n + 10], 23, -1094730640), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 13], 4, 681279174), f, r, d[n + 0], 11, -358537222), m, f, d[n + 3], 16, -722521979), i, m, d[n + 6], 23, 76029189), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 9], 4, -640364487), f, r, d[n + 12], 11, -421815835), m, f, d[n + 15], 16, 530742520), i, m, d[n + 2], 23, -995338651), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 0], 6, -198630844), f, r, d[n + 7], 10, 1126891415), m, f, d[n + 14], 15, -1416354905), i, m, d[n + 5], 21, -57434055), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 12], 6, 1700485571), f, r, d[n + 3], 10, -1894986606), m, f, d[n + 10], 15, -1051523), i, m, d[n + 1], 21, -2054922799), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 8], 6, 1873313359), f, r, d[n + 15], 10, -30611744), m, f, d[n + 6], 15, -1560198380), i, m, d[n + 13], 21, 1309151649), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 4], 6, -145523070), f, r, d[n + 11], 10, -1120210379), m, f, d[n + 2], 15, 718787259), i, m, d[n + 9], 21, -343485551), m = safe_add(m, h), f = safe_add(f, t), r = safe_add(r, g), i = safe_add(i, e);
  }
  return Array(m, f, r, i);
}
function md5_cmn(d, _, m, f, r, i) {
  return safe_add(bit_rol(safe_add(safe_add(_, d), safe_add(f, i)), r), m);
}
function md5_ff(d, _, m, f, r, i, n) {
  return md5_cmn(_ & m | ~_ & f, d, _, r, i, n);
}
function md5_gg(d, _, m, f, r, i, n) {
  return md5_cmn(_ & f | m & ~f, d, _, r, i, n);
}
function md5_hh(d, _, m, f, r, i, n) {
  return md5_cmn(_ ^ m ^ f, d, _, r, i, n);
}
function md5_ii(d, _, m, f, r, i, n) {
  return md5_cmn(m ^ (_ | ~f), d, _, r, i, n);
}
function safe_add(d, _) {
  var m = (65535 & d) + (65535 & _);
  return (d >> 16) + (_ >> 16) + (m >> 16) << 16 | 65535 & m;
}
function bit_rol(d, _) {
  return d << _ | d >>> 32 - _;
}
function getFileURL(filename) {
  var base = window.location.origin;
  filename = filename.replace(/ /g, "_");
  filename = filename.replace(/\(/g, '%28').replace(/\)/g, '%29');
  return base + '/images/' + filename + '?11112';
}
function getDist(x, y) {
  return Math.sqrt(x * x + y * y);
}
function disableHighlight() {
  if (window.getSelection) {
    window.getSelection().removeAllRanges();
  } else if (document.selection) {
    document.selection.empty();
  }
  $('body').css("user-select", "none");
}
var dialogue = {
  "IntroPrompt": {
    "initial": "Hey! Come visit me on my page! I have a quest for you!",
    "questState": 90,
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "IntroReminder": {
    "initial": "You haven't visited me yet! Come to my page!",
    "questState": 90,
    "options": ["I'll come now.", "Remind me later", "Stop bothering me!"],
    "effects": [{
      "questState": 90
    }, {
      "questState": 75
    }, {
      "questState": 101
    }],
    "response": ["Just head over to my wiki page, <a href='https://oldschool.runescape.wiki/w/Wise_Old_Man'>Wise Old Man</a>!", "Okay! I'll come back later.", "Fair enough... But if ever you change your mind just visit me on my wiki page, <a href='https://oldschool.runescape.wiki/w/Wise_Old_Man'>Wise Old Man</a>!"],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "WiseOldMan": {
    "initial": "Welcome to my page! I hear you've been looking to upgrade that Bronze dagger of yours! Luckily for you, I've heard of a legendary lost city filled with wonders and powerful weapons! I recommend that you head to the Lumbridge Swamp to see if you can find any clues! I hear there's a camp there somewhere.",
    "questState": 101,
    "options": ["Got it!"],
    "effects": [{
      "questState": 110
    }],
    "response": ["Good luck! Don't hesitate to talk to me if you get stuck!"],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "WiseOldManHelp": {
    "initial": "You should head to the Lumbridge Swamp to see if you can find anyone to talk to about the lost city!",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "Judged": {
    "initial": "Hey, what are you doing here? I see what you're doing. At least I didn't make you do Mourning's End Part II... If you're stuck, go back to talk to the last person you talked with.",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "Swamp": {
    "initial": "You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?",
    "options": ["Archer", "Monk", "Warrior", "Wizard"],
    "effects": [{
      "redirect": "https://oldschool.runescape.wiki/w/Archer_(Lost_City)"
    }, {
      "redirect": "https://oldschool.runescape.wiki/w/Monk_(Lost_City)"
    }, {
      "redirect": "https://oldschool.runescape.wiki/w/Warrior_(Lost_City)"
    }, {
      "redirect": "https://oldschool.runescape.wiki/w/Wizard_(Lost_City)"
    }],
    "response": ["You talk to the archer.", "You talk to the monk.", "You talk to the warrior.", "You talk to the wizard"],
    "icon": "/images/Fire.gif?76ed2",
    "omitY": true,
    "width": 64,
    "height": 95
  },
  "Archer": {
    "initial": "?",
    "options": ["Why are you guys hanging around here?"],
    "effects": [{
      "dialogue": "Archer2"
    }],
    "response": ["(ahem)...'Guys'? And that's really none of your business."],
    "icon": "/images/Archer_%28Lost_City%29_chathead.png?a7c88",
    "width": 85,
    "height": 119
  },
  "Archer2": {
    "initial": "(ahem)...'Guys'? And that's really none of your business.",
    "options": ["I'll talk to someone else then."],
    "effects": [{
      "dialogue": "Swamp"
    }],
    "response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
    "icon": "/images/Archer_%28Lost_City%29_chathead.png?a7c88",
    "width": 85,
    "height": 119
  },
  "Monk": {
    "initial": "?",
    "options": ["Why are all of you standing around here?"],
    "effects": [{
      "dialogue": "Monk2"
    }],
    "response": ["None of your business. Get lost."],
    "icon": "/images/Monk_%28Lost_City%29_chathead.png?33896",
    "width": 85,
    "height": 119
  },
  "Monk2": {
    "initial": "None of your business. Get lost.",
    "options": ["I'll talk to someone else then."],
    "effects": [{
      "dialogue": "Swamp"
    }],
    "response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
    "icon": "/images/Monk_%28Lost_City%29_chathead.png?33896",
    "width": 85,
    "height": 119
  },
  "Wizard": {
    "initial": "?",
    "options": ["Why are all of you standing around here?"],
    "effects": [{
      "dialogue": "Wizard2"
    }],
    "response": ["Hahaha you dare talk to a mighty wizard such as myself? I bet you can't even cast windstrike yet amateur!"],
    "icon": "/images/Wizard_%28Lost_City%29_chathead.png?25d4d",
    "width": 119,
    "height": 164
  },
  "Wizard2": {
    "initial": "Hahaha you dare talk to a mighty wizard such as myself? I bet you can't even cast windstrike yet amateur!",
    "options": ["I'll talk to someone else then."],
    "effects": [{
      "dialogue": "Swamp"
    }],
    "response": ["You see a fire burning nearby. There are four adventurers around the fire. Who would you like to speak to?"],
    "icon": "/images/Wizard_%28Lost_City%29_chathead.png?25d4d",
    "width": 119,
    "height": 164
  },
  "Warrior": {
    "initial": "Hello there traveller. We're looking for Zanaris...GAH! I mean we're not here for any particular reason at all.",
    "options": ["Who's Zanaris?", "What's Zanaris?", "What makes you think it's out here?"],
    "effects": [{
      "dialogue": "Warrior2"
    }, {}, {
      "dialogue": "Warrior3"
    }],
    "response": ["Ahahahaha! Zanaris isn't a person! It's a magical hidden city filled with treasures and rich.. uh, nothing. It's nothing.", "I don't think we want other people competing with us to find it. Forget I said anything.", "Don't you know of the legends that tell of the magical city, hidden in the swam... Uh, no, you're right, we're wasting our time here."],
    "icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
    "width": 85,
    "height": 129
  },
  "Warrior2": {
    "initial": "Ahahahaha! Zanaris isn't a person! It's a magical hidden city filled with treasures and rich.. uh, nothing. It's nothing.",
    "options": ["If it's hidden how are you planning to find it?", "It looks to me like YOU don't know where it is seeing as you're all just sat around here."],
    "effects": [{}, {
      "questState": 120
    }],
    "response": ["When we've found Zanaris you'll... GAH! I mean, we're not here for any particular reason at all.", "Of course we know! We just haven't found which tree the stupid leprechaun's hiding in yet! GAH! I didn't mean to tell you that! Look, just forget I said anything okay?"],
    "icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
    "width": 85,
    "height": 129
  },
  "Warrior3": {
    "initial": "Don't you know of the legends that tell of the magical city, hidden in the swam... Uh, no, you're right, we're wasting our time here.",
    "options": ["If it's hidden how are you planning to find it?", "It looks to me like YOU don't know where it is seeing as you're all just sat around here."],
    "effects": [{}, {
      "questState": 120
    }],
    "response": ["When we've found Zanaris you'll... GAH! I mean, we're not here for any particular reason at all.", "Of course we know! We just haven't found which tree the stupid leprechaun's hiding in yet! GAH! I didn't mean to tell you that! Look, just forget I said anything okay?"],
    "icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
    "width": 85,
    "height": 129
  },
  "WiseOldManHelp120": {
    "initial": "If you're stuck, go back to the Warrior in the Lumbridge Swamp for more advice.",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "Warrior4": {
    "initial": "...",
    "options": ["So let me get this straight: I need to search the trees around here for a leprechaun; and then when I find him, he will tell me where this 'Zanaris' is?"],
    "effects": [{}],
    "response": ["What? How did you know that? Uh... I mean, no, no you're very wrong. Very wrong, and not right at all, and I definitely didn't tell you about Shamus the leprechaun at all."],
    "icon": "/images/Warrior_%28Lost_City%29_chathead.png?937cb",
    "width": 85,
    "height": 129
  },
  "Shamus": {
    "initial": "Ay yer big elephant! Yer've caught me, to be sure! What would an elephant like yer be wanting wid ol' Shamus then?",
    "options": ["I want to find Zanaris."],
    "effects": [{
      "dialogue": "Shamus2"
    }],
    "response": ["Zanaris is it now? Well well well... Yer'll be needing to be going to that funny little shed out there in the swamp, so you will."],
    "icon": "/images/Shamus_chathead.png?989e1",
    "width": 92,
    "height": 123
  },
  "Shamus2": {
    "initial": "Zanaris is it now? Well well well... Yer'll be needing to be going to that funny little shed out there in the swamp, so you will.",
    "options": ["...but... I thought... Zanaris was a city...?"],
    "effects": [{
      "dialogue": "Shamus3"
    }],
    "response": ["Aye that it is!"],
    "icon": "/images/Shamus_chathead.png?989e1",
    "width": 92,
    "height": 123
  },
  "Shamus3": {
    "initial": "Aye that it is!",
    "options": ["How does it fit in a shed then?", "I've been in that shed, I didn't see a city."],
    "effects": [{
      "dialogue": "Shamus4"
    }, {
      "dialogue": "Shamus4"
    }],
    "response": ["Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed.", "Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed."],
    "icon": "/images/Shamus_chathead.png?989e1",
    "width": 92,
    "height": 123
  },
  "Shamus4": {
    "initial": "Oh, was I fergetting to say? Yer need to be carrying a Dramenwood staff to be getting there! Otherwise Yer'll just be ending up in the shed.",
    "options": ["So where would I get a staff?"],
    "effects": [{
      "questState": 130
    }],
    "response": ["Dramenwood staffs are crafted from branches of the Dramen tree, so they are. I hear there's a Dramen tree over on the island of Entrana in a cave or some such. There would probably be a good place for an elephant like yer to be starting looking I reckon. The monks are running a ship from Port Sarim to Entrana, I hear too. Now leave me alone yer elephant!"],
    "icon": "/images/Shamus_chathead.png?989e1",
    "width": 92,
    "height": 123
  },
  "WiseOldManHelp130": {
    "initial": "If you're stuck, double-check with Shamus the Leprechaun what you should be doing!",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "Shamus5": {
    "initial": "Ay yer big elephant! Yer've caught me, to be sure! What would an elephant like yer be wanting wid ol' Shamus then?",
    "options": ["I'm not sure.", "How do I get to Zanaris again?"],
    "effects": [{}, {}],
    "response": ["Ha! Look at yer! Look at the stupid elephant who tries to go catching a leprechaun when he don't even be knowing what he wants!", "Yer stupid elephant! I'll tell yer again! Yer need to be entering the shed in the middle of the swamp while holding a dramenwood staff! Yer can make the Dramen staff from a dramen tree branch, and there's a Dramen tree on Entrana! You get to Entrana from Port Sarim! Now leave me alone yer great elephant!"],
    "icon": "/images/Shamus_chathead.png?989e1",
    "width": 92,
    "height": 123
  },
  "Sarim": {
    "initial": "Do you seek passage to holy Entrana? If so, you must leave your weaponry and armour behind. This is Saradomin's will.",
    "options": ["No, not right now", "Yes, okay, I'm ready to go"],
    "effects": [{}, {
      "dialogue": "Sarim2"
    }],
    "response": ["Very well.", "NO WEAPONS OR ARMOUR are permitted on holy Entrana AT ALL. We will not allow you to travel there in breach of mighty Saradomin's edict. Come back when you have laid down your Zamorakian instruments of death."],
    "icon": "/images/Monk_of_Entrana_chathead.png?33896",
    "width": 103,
    "height": 102
  },
  "Sarim2": {
    "initial": "NO WEAPONS OR ARMOUR are permitted on holy Entrana AT ALL. We will not allow you to travel there in breach of mighty Saradomin's edict. Come back when you have laid down your Zamorakian instruments of death.",
    "options": ["Okay, I'll drop my Bronze dagger."],
    "effects": [{
      "questState": 135,
      "trigger": 8,
      "redirect": "https://oldschool.runescape.wiki/w/Entrana"
    }],
    "response": ["All is satisfactory. You may board the boat now. Welcome to Entrana."],
    "icon": "/images/Monk_of_Entrana_chathead.png?33896",
    "width": 103,
    "height": 102
  },
  "WiseOldManHelp135140": {
    "initial": "You should head to Entrana to talk to the monks there!",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "Sarim3": {
    "initial": "I just operate the boat. Why don't you talk to an actual 'Monk' on Entrana for help?",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Monk_of_Entrana_chathead.png?33896",
    "width": 103,
    "height": 102
  },
  "Entrana": {
    "initial": "Welcome to holy Entrana! Feel free to take a look around.",
    "options": ["Have you seen any dramen trees around?"],
    "effects": [{
      "questState": 140
    }],
    "response": ["No, I haven't. I've heard legends that it only grows underground in dungeons. Talk to me again if you need any more help."],
    "icon": "/images/Monk_chathead.png?02814",
    "width": 62,
    "height": 81
  },
  "Entrana2": {
    "initial": "I hope you're enjoying your stay in holy Entrana away from the violence of the mainland.",
    "options": ["Do you know who I could ask about dramen trees?"],
    "effects": [{}],
    "response": ["I would try talking to the Cave monk who lives north of here. If anyone, he would know something."],
    "icon": "/images/Monk_chathead.png?02814",
    "width": 62,
    "height": 81
  },
  "CaveMonk": {
    "initial": "The dramen tree is here in the Entrana dungeon. Be careful going in there! You are unarmed, and there is much evilness lurking down there! The evilness seems to block off our contact with our gods, so our prayers seem to have less effect down there.",
    "options": ["I don't think I'm strong enough to enter then.", "Well that is a risk I will have to take."],
    "effects": [{
      "trigger": 4
    }, {
      "dialogue": "TreeSpirit"
    }],
    "response": ["", ""],
    "icon": "/images/Cave_monk_chathead.png?17eff",
    "width": 62,
    "height": 81
  },
  "TreeSpirit": {
    "initial": "A tree spirit suddenly appears and attacks you!",
    "options": ["Fight back with melee.", "Use Water Wave."],
    "effects": [{
      "trigger": 6
    }, {
      "dialogue": "DramenBranch"
    }],
    "response": ["Oh dear, you are dead.", "You successfully defeat the tree spirit! You see the dramen tree nearby and grab a dramen branch."],
    "icon": "/images/thumb/Tree_spirit_%28Lost_City%29.png/150px-Tree_spirit_%28Lost_City%29.png?2446d",
    "omitY": true,
    "width": 150,
    "height": 283
  },
  "DramenBranch": {
    "initial": "You successfully defeat the tree spirit! You see the dramen tree nearby and grab a dramen branch.",
    "options": ["Cut it with a knife."],
    "effects": [{
      "questState": 150,
      "trigger": 9
    }],
    "response": ["You have obtained a Dramen staff! Why don't you head to the shed to see what happens?"],
    "icon": "/images/thumb/Dramen_tree.png/200px-Dramen_tree.png?c073b",
    "omitY": true,
    "width": 200,
    "height": 331
  },
  "WiseOldManHelp150": {
    "initial": "Congratulations on getting the Dramen staff! Why don't you head to the shed to see what happens? The shed is located in the Lumbridge Swamp.",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "DramenReminder": {
    "initial": "You have obtained the Dramen staff! Why don't you head to the shed to see what happens? The shed is located in the Lumbridge Swamp.",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/thumb/Dramen_staff_detail.png/150px-Dramen_staff_detail.png?83540",
    "omitY": true,
    "width": 150,
    "height": 152
  },
  "Swamp2": {
    "initial": "You approach the shed.",
    "options": ["Equip the Dramen staff and then enter the shed.", "Enter the shed and then equip the dramen staff"],
    "effects": [{
      "questState": 160,
      "redirect": "https://oldschool.runescape.wiki/w/Zanaris"
    }, {}],
    "response": ["You enter the shed and everything starts to blur...", "Nothing interesting happens."],
    "icon": "/images/thumb/Dramen_staff_detail.png/150px-Dramen_staff_detail.png?83540",
    "omitY": true,
    "width": 150,
    "height": 152
  },
  "Zanaris": {
    "initial": "Congratulations! You found the Lost City of Zanaris! Why don't you head over to see Jukat in the Zanaris Market Area to buy a Dragon dagger?",
    "options": ["Ok"],
    "effects": [{
      "trigger": 4
    }],
    "response": [""],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "Jukat": {
    "initial": "Dragon swords! Here, Dragon swords! Straight from Frenaskrae!",
    "options": ["Yes please.", "No thanks, I'm just browsing."],
    "effects": [{
      "dialogue": "Jukat2"
    }, {}],
    "response": ["Looks like you have exactly 30K coins to buy a Dragon dagger. I'll even throw in some free Weapon poison++!", "Okay. Please come back if you would like to buy something."],
    "icon": "/images/Jukat_chathead.png?185bb",
    "width": 87,
    "height": 141
  },
  "Jukat2": {
    "initial": "Looks like you have exactly 30K coins to buy a Dragon dagger. I'll even throw in some free Weapon poison++!",
    "options": ["That sounds fine to me. Gimmie!"],
    "effects": [{
      "trigger": 3,
      "questState": 500,
      "dialogue": "Jukat3"
    }],
    "response": [""],
    "icon": "/images/Jukat_chathead.png?ba968",
    "width": 87,
    "height": 141
  },
  "Jukat3": {
    "initial": "",
    "trigger": 10,
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Lost_City_reward_scroll.png?1819e",
    "omitY": true,
    "width": 488,
    "height": 320
  },
  "Poor": {
    "initial": "",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "OldWOM": {
    "initial": "Happy April Fools! Designed by Gau Cho for 2020 over the course of 1-2 weeks.",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "FirstBlood": {
    "initial": "Holy Sherlock!",
    "questState": 1000,
    "options": ["Oups?"],
    "effects": [{}],
    "response": ["Looks like you unlocked an Achievement button at the top of the page!"],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "SpiderDead": {
    "initial": "Oh dear, you are dead. Maybe you should get some Slayer gloves to avoid catching the Disease?",
    "trigger": 5,
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/thumb/Death.png/145px-Death.png?71945",
    "width": 145,
    "height": 300
  },
  "AHDead": {
    "initial": "Oh dear, you are dead. Your Slayer level is not yet high enough to defeat this monster.",
    "trigger": 5,
    "options": [],
    "effects": [{}],
    "response": [],
    "icon": "/images/thumb/Death.png/145px-Death.png?71945",
    "width": 145,
    "height": 300
  },
  "Dead": {
    "initial": "Oh dear, you are dead.",
    "trigger": 5,
    "options": [],
    "effects": [{}],
    "response": [],
    "icon": "/images/thumb/Death.png/145px-Death.png?71945",
    "width": 145,
    "height": 300
  },
  "DeadBadWindow": {
    "initial": "Oh dear, you are dead. Your browser window dimensions seemed to have suddenly changed, making you trip and fall on your own sword.",
    "trigger": 5,
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/thumb/Death.png/145px-Death.png?71945",
    "width": 145,
    "height": 300
  },
  "DeadCucco": {
    "initial": "",
    "trigger": 5,
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/thumb/Death.png/145px-Death.png?71945",
    "width": 145,
    "height": 300
  },
  "CuccoEscape": {
    "initial": "",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/thumb/Chicken_%281%29.png/120px-Chicken_%281%29.png?a7258",
    "omitY": true,
    "width": 120,
    "height": 161
  },
  "AHEscape": {
    "initial": "You managed to teleport away from the Alchemical Hydra!",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Orrvor_quo_Maten_chathead.png?f2e37",
    "width": 67,
    "height": 72
  },
  "SlayerWin": {
    "initial": "",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Orrvor_quo_Maten_chathead.png?f2e37",
    "width": 67,
    "height": 72
  },
  "Rah": {
    "initial": "Raaa!",
    "trigger": 5,
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/thumb/Penance_Runner_%28wave_1%29.png/180px-Penance_Runner_%28wave_1%29.png?97e46",
    "width": 180,
    "height": 326
  },
  "Slayer": {
    "initial": "'Ello, and what are you after then?",
    "options": ["I need another assignment.", "Have you any rewards for me, or anything to trade?", "Let's talk about the difficulty of my assignments.", "Er... Nothing..."],
    "effects": [{}, {}, {}, {
      "trigger": 4
    }],
    "response": ["", "", "The Slayer Masters may currently assign you any task in our lists, regardless of your combat level.", ""]
  },
  "Nieve": {
    "initial": "...",
    "options": ["..."],
    "effects": [{
      "trigger": 4
    }],
    "response": [""],
    "icon": "/images/thumb/Coffin_detail.png/130px-Coffin_detail.png?9d094",
    "width": 130,
    "height": 120
  },
  "FireCape": {
    "initial": "",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/TzHaar-Mej-Jal_chathead.png?df71e",
    "width": 94,
    "height": 106
  },
  "Invaders": {
    "initial": "",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Captain_Cain_chathead.png?78f37",
    "width": 79,
    "height": 120
  },
  "AHscreen": {
    "initial": "You need a bigger screen area to fight the Alchemical Hydra! At least 1000x500!",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "Crab": {
    "initial": "Reset all quest and achievement data?",
    "options": ["Yes", "No"],
    "effects": [{
      "trigger": 1
    }, {}],
    "response": ["Done. Reload the page.", "Okay, I won't."],
    "icon": "/images/thumb/Crab.png/220px-Crab.png?e81ce",
    "width": 220,
    "height": 168
  },
  "DisableCursor": {
    "initial": "Your cursor has been disabled! Reload the page for changes to take effect. But maybe I would consider re-enabling the cursor... who knows what could happen?",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "",
    "omitY": true,
    "omitIcon": true,
    "width": 0,
    "height": 0
  },
  "EnableCursor": {
    "initial": "Your cursor has been re-enabled! Reload the page for changes to take effect. I wonder what mysteries are in store...",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "",
    "omitY": true,
    "omitIcon": true,
    "width": 0,
    "height": 0
  },
  "CursorBye": {
    "initial": "You have unequipped your weapon! To get back into combat, re-equip a weapon and reload the page!",
    "options": [],
    "effects": [],
    "response": [],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  },
  "SlashDDS": {
    "initial": "Why don't you try testing waving your new dagger at an easy NPC, such as a Cow or something?",
    "questState": 501,
    "options": ["Got it!"],
    "effects": [{
      "questState": 502
    }],
    "response": ["Good luck! Don't hesitate to talk to me if you get stuck!"],
    "icon": "/images/Wise_Old_Man_chathead.png?68f26",
    "width": 78,
    "height": 148
  }
};
var masters = {
  "Turael": {
    "icon": "/images/Turael_chathead.png?1b620",
    "width": 103,
    "height": 102
  },
  "Krystilia": {
    "icon": "/images/Krystilia_chathead.png?99a3f",
    "width": 119,
    "height": 167
  },
  "Mazchna": {
    "icon": "/images/Mazchna_chathead.png?47bb8",
    "width": 101,
    "height": 153
  },
  "Vannaka": {
    "icon": "/images/Vannaka_chathead.png?1b620",
    "width": 70,
    "height": 109
  },
  "Chaeldar": {
    "icon": "/images/Chaeldar_chathead.png?a7568",
    "width": 77,
    "height": 101
  },
  "Konar quo Maten": {
    "icon": "/images/Konar_quo_Maten_chathead.png?e0801",
    "width": 81,
    "height": 70
  },
  "Steve": {
    "icon": "/images/Steve_chathead.png?1b620",
    "width": 84,
    "height": 92
  },
  "Duradel": {
    "icon": "/images/Duradel_chathead.png?e91f3",
    "width": 66,
    "height": 102
  }
};
function crab(conversationoverride, datum) {
  $('#crob').remove();
  if (conversationoverride === undefined) {
    var questState = load("apr-queststate");
    if (questState === undefined) {
      return;
    }
    if (mw.config.get('wgNamespaceNumber') != 0 && mw.config.get('wgNamespaceNumber') != 116) {
      return;
    }
  }
  var pagename = mw.config.get('wgTitle');
  var namespace = mw.config.get('wgCanonicalNamespace');
  var categories = mw.config.get('wgCategories');
  var conversation = null;
  if (conversationoverride in dialogue) {
    conversation = dialogue[conversationoverride];
    if (conversationoverride == "Poor") {
      conversation.initial = "You are too poor to afford that item! You need " + datum + ",000 GP to buy this item.";
    }
    if (conversationoverride == "DeadCucco") {
      conversation.initial = "Oh dear, you are dead. You survived the onslaught of " + datum + " Cuccos.";
    }
    if (conversationoverride == "CuccoEscape") {
      conversation.initial = "You managed to run away from the Cuccos after " + datum + " Cuccos appeared!";
    }
    if (conversationoverride == "FireCape") {
      if (achievementsOpen) {
        return;
      }
      conversation.initial = "You even defeated TzTok-Jad, I am most impressed! Please accept this gift. Give cape back to me if you not want it. Your kill time was " + Math.floor(datum / 100) / 10 + " seconds.";
    }
    if (conversationoverride == "Invaders") {
      conversation.initial = "Congratulations on defeating the Penance! It took you about " + Math.floor(datum / 4) / 10 + " seconds!";
    }
    if (conversationoverride == "SlayerWin") {
      if (achievementsOpen) {
        return;
      }
      conversation.initial = "Human! You have defeated the Alchemical Hydra! Your kill time was " + Math.floor(datum / 100) / 10 + " seconds.";
    }
  } else {
    if (questState === 1) {
      var WOMtime = new Date().getTime();
      var WOMchance = Math.max(0, Math.min(1, (WOMtime - 1585699200000) / 86400000));
      WOMchance = WOMchance * WOMchance + 0.005;
      console.log(WOMchance);
      if (Math.random() < WOMchance) {
        conversation = dialogue["IntroPrompt"];
      }
    }
    if (questState > 1 && questState < 100) {
      save("apr-queststate", questState + 1);
    }
    if (questState == 100) {
      conversation = dialogue["IntroReminder"];
    }
    if (questState > 1 && questState <= 101) {
      if (pagename == "Wise Old Man") {
        conversation = dialogue["WiseOldMan"];
      }
    }
    if (questState == 110) {
      if (pagename == "Wise Old Man") {
        conversation = dialogue["WiseOldManHelp"];
      }
      if (pagename == "Lumbridge Swamp") {
        conversation = dialogue["Swamp"];
      }
      if (pagename == "Archer (Lost City)") {
        conversation = dialogue["Archer"];
      }
      if (pagename == "Monk (Lost City)") {
        conversation = dialogue["Monk"];
      }
      if (pagename == "Wizard (Lost City)") {
        conversation = dialogue["Wizard"];
      }
      if (pagename == "Warrior (Lost City)") {
        conversation = dialogue["Warrior"];
      }
    }
    if (questState == 120) {
      if (pagename == "Wise Old Man") {
        conversation = dialogue["WiseOldManHelp120"];
      }
      if (pagename == "Warrior (Lost City)") {
        conversation = dialogue["Warrior4"];
      }
      if (pagename == "Shamus") {
        conversation = dialogue["Shamus"];
      }
    }
    if (questState == 130) {
      if (pagename == "Wise Old Man") {
        conversation = dialogue["WiseOldManHelp130"];
      }
      if (pagename == "Shamus") {
        conversation = dialogue["Shamus5"];
      }
      if (pagename == "Port Sarim" || pagename == "Monk of Entrana") {
        conversation = dialogue["Sarim"];
      }
    }
    if (questState == 135) {
      if (pagename == "Wise Old Man") {
        conversation = dialogue["WiseOldManHelp135140"];
      }
      if (pagename == "Port Sarim" || pagename == "Monk of Entrana") {
        conversation = dialogue["Sarim3"];
      }
      if (pagename == "Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)") {
        conversation = dialogue["Entrana"];
      }
    }
    if (questState == 140) {
      if (pagename == "Wise Old Man") {
        conversation = dialogue["WiseOldManHelp135140"];
      }
      if (pagename == "Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)") {
        conversation = dialogue["Entrana2"];
      }
      if (pagename == "Cave monk" || pagename == "Entrana Dungeon" || pagename == "Tree spirit (Lost City)") {
        conversation = dialogue["CaveMonk"];
      }
    }
    if (questState == 150) {
      if (pagename == "Wise Old Man") {
        conversation = dialogue["WiseOldManHelp150"];
      }
      if (pagename == "Entrana" || pagename == "Monk of Entrana" || pagename == "Monk" || pagename == "High Priest (Entrana)" || pagename == "Cave monk" || pagename == "Entrana Dungeon" || pagename == "Dramen tree" || pagename == "Dramen staff" || pagename == "Dramen branch" || pagename == "Tree spirit (Lost City)") {
        conversation = dialogue["DramenReminder"];
      }
      if (pagename == "Lumbridge Swamp") {
        conversation = dialogue["Swamp2"];
      }
    }
    if (questState == 160) {
      if (pagename == "Zanaris" || pagename == "Wise Old Man") {
        conversation = dialogue["Zanaris"];
      }
      if (pagename == "Jukat" || pagename == "Jukat (shop)") {
        conversation = dialogue["Jukat"];
      }
    }
    if (questState >= 101 && questState <= 200) {
      if (pagename == "Lost City" || pagename == "Lost City/Quick guide") {
        conversation = dialogue["Judged"];
      }
    }
    if (questState == 500) {
      if (pagename == "Wise Old Man" || Math.random() < 0.2) {
        conversation = dialogue["SlashDDS"];
      }
    }
    if (questState == 501) {
      if (pagename == "Wise Old Man" || Math.random() < 0.05) {
        conversation = dialogue["SlashDDS"];
      }
    }
    if (questState == 502) {
      if (pagename == "Wise Old Man") {
        conversation = dialogue["SlashDDS"];
      }
    }
    if (questState >= 1000) {
      var slayerState = load("apr-slayerstate");
      if (slayerState <= 19) {
        if (pagename == "Nieve") {
          conversation = dialogue["Nieve"];
        }
      }
      if (slayerState >= 1 && slayerState <= 19 && pagename in masters) {
        conversation = dialogue["Slayer"];
        if (slayerState == 1) {
          conversation.effects[0] = {
            "slayerState": 2
          };
          conversation.response[0] = "Excellent, you're doing great. Your new task is to kill 13 fever spiders.";
        } else if (slayerState >= 2 && slayerState <= 16) {
          conversation.effects[0] = {};
          var remaining = Math.min(13, 17 - slayerState);
          conversation.response[0] = "You're still hunting fever spiders; you have " + remaining + " to go. Come back when you've finished your task.";
        } else if (slayerState == 17) {
          conversation.effects[0] = {
            "slayerState": 18
          };
          conversation.response[0] = "Excellent, you're doing great. Your new task is to kill 1 Alchemical Hydra.";
        } else if (slayerState == 18) {
          conversation.effects[0] = {};
          conversation.response[0] = "You're still hunting Alchemical Hydras; you have 1 to go. Come back when you've finished your task.";
        } else if (slayerState == 19) {
          conversation.effects[0] = {
            "slayerState": 20
          };
          conversation.response[0] = "Sorry, I don't have any more tasks for you right now. We need to practice sustainable Slaying to avoid depleting all the monsters in our environment.";
        }
        if (slayerState >= 1 && slayerState <= 2 || slayerState == 17 || slayerState == 19) {
          conversation.effects[1] = {};
          conversation.response[1] = "I have quite a few rewards you can earn, and a wide variety of Slayer equipment for sale. Come back if you realize you need any equipment.";
        } else if (slayerState == 3) {
          conversation.effects[1] = {
            "slayerState": 4
          };
          conversation.response[1] = "I hear you've been having trouble against the Fever spiders. Equip these Slayer gloves to protect against disease. Don't forget to wash your hands and practice social distancing.";
        } else if (slayerState >= 4 && slayerState <= 16) {
          conversation.effects[1] = {};
          conversation.response[1] = "I already gave you some Slayer gloves! This will allow you to kill the Fever spiders.";
        } else if (slayerState == 18) {
          conversation.effects[1] = {};
          conversation.response[1] = "You already got Boots of brimstone from the Grand Exchange. Why are you looking at me?";
        }
        conversation.icon = masters[pagename].icon;
        conversation.width = masters[pagename].width;
        conversation.height = masters[pagename].height;
        save("apr-lastslayermaster", pagename);
      }
      if (slayerState == 3 && pagename == 'Slayer Equipment (shop)') {
        pagename = load("apr-lastslayermaster");
        conversation = dialogue["Slayer"];
        conversation.response[0] = "You're still hunting fever spiders; you have 13 to go. Come back when you've finished your task.";
        conversation.effects[1] = {
          "slayerState": 4
        };
        conversation.response[1] = "I hear you've been having trouble against the Fever spiders. Equip these Slayer gloves to protect against disease. Don't forget to wash your hands and practice social distancing.";
        conversation.icon = masters[pagename].icon;
        conversation.width = masters[pagename].width;
        conversation.height = masters[pagename].height;
      }
      if (pagename == "Crab") {
        conversation = dialogue["Crab"];
      }
      if (MD5(pagename) == "da3daba59031da284264382eaa6171e2") {
        conversation = dialogue["OldWOM"];
        displayAchievement("OldWOM");
      }
    }
  }
  if (conversation === null) {
    return;
  }
  var bubblex, chatboxx;
  if (conversation.bubblex === undefined) {
    bubblex = conversation.width;
  } else {
    bubblex = conversation.bubblex;
  }
  if (conversation.chatboxx === undefined) {
    chatboxx = Math.max(200, bubblex + 48);
  } else {
    chatboxx = conversation.chatboxx;
  }
  var ybubble = '';
  if (!("omitY" in conversation)) {
    ybubble = "<div id=\"crob-speech-arrow\" style=' width: 0; position: relative; bottom: 3px; left: " + bubblex + "px; border-top: 15px solid #FFFDCC; border-left: 0 solid transparent; border-right: 10px solid transparent; filter: drop-shadow(-1px 1px 0 #000) drop-shadow(0 1px 0 #000);'></div>";
  }
  var $div = $("<div id=\"crob\" style='color: black; z-index: 999999999; position: fixed;bottom: 20px;left: 30px;'><div id=\"crob-speech\" style='  position: fixed;bottom: " + (36 + conversation.height) + "px;left: 15px;background-color: #FFFDCC;width: " + chatboxx + "px;border: 1px solid black;border-radius: 7px;'><div id=\"crob-speech-text\" style='  margin: 7px 10px;font-family: Arial;font-size: 13px;'></div></div>" + ybubble + "<div id=\"crob-icon\" style=\"background: url(" + conversation.icon + ") no-repeat;height:" + conversation.height + "px;width:" + conversation.width + "px\"></div></div>");
  var $buttons = $("<div id=\"crob-speech-buttons\" style='  font-family: Arial;font-size: 14px;position: relative;text-align: center;border-top: 1px solid #C2C2C2;bottom: 0;margin: 7px 7px 10px 7px;'></div>");
  var $button = $("<button class=\"crob-button\" style='  background-color: #FFFDCC;border: 1px solid #C2C2C2;border-radius: 3px;padding: 5px 12px;margin: 10px 5px 0 5px;'>No</button>");
  $('#firstHeading').after($div);
  $("#crob-speech-text").html(conversation.initial);
  if (conversation.options.length > 0) {
    $("#crob-speech-text").after($buttons);
  }
  if ("omitY" in conversation) {
    $("crob-speech-arrow").remove();
  }
  if ("omitIcon" in conversation) {
    $("crob-icon").remove();
  }
  var onClick = function onClick(event) {
    $("#crob-speech-text").html($(event.target).attr('data-response'));
    $("#crob-speech-buttons").remove();
    if ('questState' in event.data) {
      save("apr-queststate", event.data.questState);
    }
    if ('slayerState' in event.data) {
      save("apr-slayerstate", event.data.slayerState);
    }
    if ('trigger' in event.data) {
      if (event.data.trigger == 1) {
        localStorage.removeItem("apr-queststate");
        localStorage.removeItem("apr-weapon");
        localStorage.removeItem("apr-weapon-inv");
        localStorage.removeItem("apr-weapon-buy");
        localStorage.removeItem("apr-achievementlist");
        localStorage.removeItem("apr-totalkills");
        localStorage.removeItem("apr-lightdark");
        localStorage.removeItem("apr-gp");
        localStorage.removeItem("apr-gp-total");
        localStorage.removeItem("apr-slayerstate");
        localStorage.removeItem("apr-lastslayermaster");
        localStorage.removeItem("apr-gadgetenabled");
      } else if (event.data.trigger == 2) {
        save("apr-queststate", 160);
        localStorage.removeItem("apr-weapon");
        localStorage.removeItem("apr-weapon-inv");
        localStorage.removeItem("apr-weapon-buy");
        localStorage.removeItem("apr-achievementlist");
        localStorage.removeItem("apr-totalkills");
        localStorage.removeItem("apr-lightdark");
        localStorage.removeItem("apr-gp");
        localStorage.removeItem("apr-gp-total");
        localStorage.removeItem("apr-slayerstate");
        localStorage.removeItem("apr-lastslayermaster");
        localStorage.removeItem("apr-gadgetenabled");
      } else if (event.data.trigger == 3) {
        save("apr-weapon", ['Dragon dagger(p++)', '0 0', 'red']);
        enableDDS(['Dragon dagger(p++)', '0 0', 'red']);
      } else if (event.data.trigger == 4) {
        $("#crob-speech,#crob-speech-arrow").remove();
      } else if (event.data.trigger == 6) {
        disableDDS(["/images/Skull_%28status%29_icon.png?fa6d8", "13 0", 'white']);
      } else if (event.data.trigger == 7) {
        $('#crob').remove();
      } else if (event.data.trigger == 8) {
        save("apr-weapon", ['Windows', '0 0', 'white']);
        disableDDS(['Windows', '0 0', 'white']);
      } else if (event.data.trigger == 9) {
        save("apr-weapon", ['Dramen staff', '6 0', 'brown']);
        disableDDS(['Dramen staff', '6 0', 'brown']);
      } else if (event.data.trigger == 11) {
        displayAchievement("FirstHit");
        achievements.forEach(function (achievement, achievementref) {
          displayAchievement(achievementref);
        });
      }
    }
    if ('dialogue' in event.data) {
      $('#crob').remove();
      crab(event.data.dialogue);
    }
    if ('redirect' in event.data) {
      window.location.href = event.data.redirect;
    }
  };
  for (var i = 0; i < conversation.options.length; i++) {
    var butt = $button.clone();
    butt.text(conversation.options[i]);
    butt.attr("data-response", conversation.response[i]);
    butt.click(conversation.effects[i], onClick);
    $("#crob-speech-buttons").append(butt);
  }
  if ('questState' in conversation) {
    save("apr-queststate", conversation.questState);
  }
  if ('trigger' in conversation) {
    if (conversation.trigger == 4) {
      $("#crob-speech,#crob-speech-arrow").remove();
    } else if (conversation.trigger == 5) {
      disableDDS(["/images/Skull_%28status%29_icon.png?fa6d8", "13 0", "white"]);
      displayAchievement("Died");
    } else if (conversation.trigger == 10) {
      $("#crob-speech,#crob-speech-arrow").remove();
      $('<div id="crob-X" style="width:23px;height:23px;left:414px;position:relative;top:50px;cursor:default;"></div>').appendTo($('div#crob > div')).click(function () {
        $('#crob').remove();
      });
    }
  }
}
function AH(npc) {
  $(document).mouseleave(function () {
    if (DDSenabled) {
      DDSenabled = false;
      crab("AHEscape");
    }
  });
  var AHRanged = function AHRanged(npc, offsetx, offsety) {
    var startx = npc.dom.getBoundingClientRect().left + npc.width / 2 + offsetx;
    var starty = npc.dom.getBoundingClientRect().top + npc.height / 2 + offsety;
    projectileTracked("/images/Alchemical_Hydra_ranged_projectile.png?2a2bc", "apr-hydra-ranged", 80, 80 / 1561 * 585, startx, starty, 20, 150, 0);
  };
  var AHMagic = function AHMagic(npc, offsetx, offsety) {
    var startx = npc.dom.getBoundingClientRect().left + npc.width / 2 + offsetx;
    var starty = npc.dom.getBoundingClientRect().top + npc.height / 2 + offsety;
    projectileTracked("/images/Alchemical_Hydra_magic_projectile.png?2a2bc", "apr-hydra-magic", 50, 50 / 1013 * 592, startx, starty, 20, 150, 0.3914051281252104);
  };
  var _AHFire = function AHFire(npc, remaining) {
    if (npc.phase == 3 || !DDSenabled) {
      return;
    }
    var curX = lastX;
    var curY = lastY;
    setTimeout(burnOver, 900, "/images/Alchemical_Hydra_flame_wall_attack.png?2a2bc", "apr-hydra-burn", curX, curY, 250 * resizeratio, 250 * resizeratio, 300, 10000, true, "#protectMelee");
    if (remaining > 0) {
      setTimeout(_AHFire, 1200, npc, remaining - 1);
    }
  };
  var AHTornado = function AHTornado(startX, startY) {
    seekerMissile("/images/Alchemical_Hydra_lightning_attack.png?2a2bc", "apr-hydra-tornado", 250 * resizeratio, 250 * resizeratio, startX, startY, 300, 20 * resizeratio, 250 * resizeratio, 600, -10);
  };
  var _AHAttack = function AHAttack(npc) {
    if (width != $(window).width() || height != $(window).height()) {
      crab("DeadBadWindow");
    }
    if (npc.skipattack > 0) {
      npc.skipattack -= 1;
    } else if (npc.specialtimer == 0) {
      npc.specialtimer = 9;
      if (npc.phase == 0 || npc.phase == 3) {
        burnOver("/images/Alchemical_Hydra_acid_pool_attack.png?2a2bc", "apr-hydra-poison", lastX, lastY, 250 * resizeratio, 250 * resizeratio, 600, 10000, true, "#protectMelee");
        for (var i = 0; i < 4; i++) {
          setTimeout(function () {
            burnOver("/images/Alchemical_Hydra_acid_pool_attack.png?2a2bc", "apr-hydra-poison", Math.random() * width, Math.random() * height, 250 * resizeratio, 250 * resizeratio, 600, 10000, true, "#apr-hydra-vent-red");
          }, 600);
        }
      }
      if (npc.phase == 1) {
        i = 0;
        var attempts = 0;
        while (i < 4) {
          var startX = Math.random() * width;
          var startY = Math.random() * height;
          var dist = getDist(startX - lastX, startY - lastY);
          if (dist < 350) {
            attempts += 1;
            if (attempts > 1000) {
              crab("Dead");
              break;
            }
          } else {
            i += 1;
            AHTornado(startX, startY);
          }
        }
      }
      if (npc.phase == 2) {
        _AHFire(npc, 11);
      }
    } else {
      npc.specialtimer -= 1;
      if (npc.mainattackswitch == 0) {
        npc.mainattack = 1 - npc.mainattack;
        if (npc.phase == 3) {
          npc.mainattackswitch = 1;
        } else {
          npc.mainattackswitch = 3;
        }
      }
      npc.mainattackswitch -= 1;
      if (npc.mainattack == 0) {
        prayerKillDelay("Ranged", 600);
        AHRanged(npc, 43, -70);
        if (npc.phase <= 1) {
          AHRanged(npc, 0, 0);
        }
      } else {
        prayerKillDelay("Magic", 600);
        AHMagic(npc, -57, -90);
        if (npc.phase <= 0) {
          AHMagic(npc, -100, -18);
        }
      }
    }
    if (DDSenabled && !npc.dead) {
      setTimeout(_AHAttack, 3600, npc);
    }
  };
  $('body').css("overflow", "hidden");
  var width = $(window).width();
  var height = $(window).height();
  var resizeratio = Math.max(1, Math.sqrt(width / 1903 * height / 976));
  if (width < 1000) {
    crab("AHscreen");
    DDSenabled = false;
    return;
  }
  if (height < 500) {
    crab("AHscreen");
    DDSenabled = false;
    return;
  }
  var main = $('<div class="apr-hydra"/>').appendTo('body');
  $(npc.dom).attr("src", ahimg[0]);
  $(npc.dom.parentElement.parentElement).appendTo(main);
  $(npc.dom.parentElement).css("left", (width - npc.width) / 2);
  $(npc.dom.parentElement).css("top", (height - npc.height) / 2);
  $(npc.dom.parentElement).css("position", "absolute");
  $(npc.dom.parentElement).prop("fixed", "true");
  $('<img id="apr-hydra-vent-red" class="apr-hydra-vent" src="/images/Alchemical_Hydra_red_vent.png?c2c96" style="left:0px;top:' + (height - 250) + 'px">').prependTo(main).prop("top", height - 200);
  $('<img id="apr-hydra-vent-green" class="apr-hydra-vent" src="/images/Alchemical_Hydra_green_vent.png?c2c96" style="left:' + (width - 250) + 'px;top:0px">').prependTo(main).prop("left", width - 200);
  $('<img id="apr-hydra-vent-blue" class="apr-hydra-vent" src="/images/Alchemical_Hydra_blue_vent.png?c2c96" style="left:0px;top:0px">').prependTo(main);
  $("#p-personal").remove();
  $("div.menu").remove();
  $("div.suggestions").remove();
  setupPrayer();
  _AHAttack(npc);
}
var ahimg = ["/images/thumb/Alchemical_Hydra_%28serpentine%29.png/272px-Alchemical_Hydra_%28serpentine%29.png?925dd", "/images/thumb/Alchemical_Hydra_%28electric%29.png/230px-Alchemical_Hydra_%28electric%29.png?925dd", "/images/thumb/Alchemical_Hydra_%28fire%29.png/234px-Alchemical_Hydra_%28fire%29.png?925dd", "/images/thumb/Alchemical_Hydra_%28extinguished%29.png/234px-Alchemical_Hydra_%28extinguished%29.png?925dd"];
function AHhit(npc) {
  var left = parseFloat($(npc.dom.parentElement).css("left"));
  var top = parseFloat($(npc.dom.parentElement).css("top"));
  if (npc.accuracy == 0.25) {
    if (npc.phase == 0) {
      if (left < 200 && top + npc.height > $("#apr-hydra-vent-red").prop("top")) {
        npc.accuracy = 1;
      }
    }
    if (npc.phase == 1) {
      if (top < 200 && left + npc.width > $("#apr-hydra-vent-green").prop("left")) {
        npc.accuracy = 1;
      }
    }
    if (npc.phase == 2) {
      if (top < 200 && left < 200) {
        npc.accuracy = 1;
      }
    }
  }
  if (npc.hits == (npc.phase + 1) * 80) {
    npc.phase = npc.hits / 80;
    $(npc.dom).attr("src", ahimg[npc.phase]);
    npc.specialtimer = 3;
    if (npc.phase == 3) {
      npc.mainattackswitch = 0;
      npc.accuracy = 1;
    } else {
      npc.accuracy = 0.25;
    }
    npc.skipattack = 1;
  }
}
function Cucco() {
  $('body').css("overflow", "hidden");
  var width = $(window).width();
  var height = $(window).height();
  if (width / height > 0.25 && width / height < 4) {
    var cuccoCount = 0;
    var cuccoSpawned = 0;
    var basex = Math.floor(Math.sqrt(width * height / 100 / 1.35));
    var basey = Math.floor(Math.sqrt(width * height / 100 / 1.35) * 1.35);
    var body = $('body');
    $("#p-personal").remove();
    $("div.menu").remove();
    $("div.suggestions").remove();
    $(document).mouseleave(function () {
      if (DDSenabled) {
        DDSenabled = false;
        crab("CuccoEscape", cuccoSpawned);
      }
    });
    var _cuccoAttack = function cuccoAttack() {
      cuccoCount += 1;
      if (width != $(window).width() || height != $(window).height()) {
        crab("DeadBadWindow");
      }
      if (Math.random() < 0.5) {
        cuccoSpawned += 1;
        var img = ['/images/thumb/Chicken_%281%29.png/89px-Chicken_%281%29.png?a7258', '/images/thumb/Chicken_%282%29.png/89px-Chicken_%282%29.png?ec54e', '/images/thumb/Chicken_%283%29.png/88px-Chicken_%283%29.png?22962', '/images/thumb/Chicken_%284%29.png/88px-Chicken_%284%29.png?e1827', '/images/thumb/Chicken_%285%29.png/88px-Chicken_%285%29.png?bf9d3', '/images/thumb/Chicken_%286%29.png/88px-Chicken_%286%29.png?0f7e8'];
        var cucco = $("<img class='apr-cucco' src='" + img[Math.floor(Math.random() * 6)] + "'>");
        cucco.css("position", "fixed");
        cucco.css("top", Math.random() * height - basey / 2 + 'px');
        cucco.css("left", -basey + 'px');
        cucco.css("width", basex + 'px');
        cucco.css("height", basey + 'px');
        cucco.css("transform", 'rotate(' + Math.random() + 'turn)');
        $('.mwe-popups').remove();
        body.append(cucco);
        cucco.hover(function () {
          if (DDSenabled) {
            crab("DeadCucco", cuccoSpawned);
          }
        });
      }
      $('.apr-cucco').each(function () {
        var newx = parseInt($(this).css("left")) + width / 80;
        if (newx > width + basex) {
          $(this).remove();
        } else {
          $(this).css("left", newx);
        }
      });
      if (cuccoSpawned == 200) {
        displayAchievement("Cucco");
      }
      if (DDSenabled) {
        setTimeout(_cuccoAttack, 50);
      }
    };
    _cuccoAttack();
  } else {
    crab("DeadBadWindow");
  }
}
function attackOver(icon, classname, sizex, sizey, duration) {
  var attack = $("<img class='" + classname + "' src='" + icon + "'>");
  attack.css("position", "fixed");
  attack.css("top", lastY - sizey / 2 + 'px');
  attack.css("left", lastX - sizex / 2 + 'px');
  attack.css("width", sizex + 'px');
  attack.css("height", sizey + 'px');
  $('body').append(attack);
  setTimeout(function () {
    attack.remove();
  }, duration);
}
function burnOver(icon, classname, x, y, sizex, sizey, hoverdelay, duration, randomrotation, jquerytarget) {
  var attack = $("<img class='" + classname + "' src='" + icon + "'>");
  attack.css("position", "fixed");
  attack.css("top", y - sizey / 2 + 'px');
  attack.css("left", x - sizex / 2 + 'px');
  attack.css("width", sizex + 'px');
  attack.css("height", sizey + 'px');
  if (randomrotation) {
    attack.css("transform", "rotate(" + Math.random() + "turn)");
  }
  $(jquerytarget).after(attack);
  setTimeout(function () {
    attack.detach();
    attack.addClass("apr-burndone");
    attack.hover(function () {
      if (DDSenabled) {
        crab("Dead");
      }
    });
    $(jquerytarget).after(attack);
  }, hoverdelay);
  setTimeout(function () {
    attack.remove();
  }, duration);
}
function seekerMissile(icon, classname, sizex, sizey, startx, starty, frames, speed, diameter, durationout, baserotation) {
  var attack = $("<img class='" + classname + "' src='" + icon + "'>");
  var x = startx - sizex / 2;
  var y = starty - sizey / 2;
  attack.css("position", "fixed");
  attack.css("left", x + 'px');
  attack.css("top", y + 'px');
  attack.css("width", sizex + 'px');
  attack.css("height", sizey + 'px');
  var deltax = lastX - sizex / 2 - x;
  var deltay = lastY - sizey / 2 - y;
  if (baserotation != -10) {
    attack.css("transform", "rotate(" + (Math.atan2(deltay, deltax) + baserotation) + "rad)");
  }
  $('body').append(attack);
  var _seekerMissilePosition = function seekerMissilePosition(attack, sizex, sizey, x, y, frames, speed, radius, durationout, baserotation) {
    var deltax = lastX - sizex / 2 - x;
    var deltay = lastY - sizey / 2 - y;
    var dist = getDist(deltax, deltay);
    if (dist < speed) {
      x = lastX;
      y = lastY;
    } else {
      x = x + deltax / dist * speed;
      y = y + deltay / dist * speed;
    }
    attack.css("left", x + 'px');
    attack.css("top", y + 'px');
    if (baserotation != -10) {
      attack.css("transform", "rotate(" + (Math.atan2(deltay, deltax) + baserotation) + "rad)");
    }
    if (dist < radius / 2) {
      if (DDSenabled) {
        crab("Dead");
      }
      setTimeout(function () {
        attack.remove();
      }, durationout);
    } else {
      if (frames == 1) {
        setTimeout(function () {
          attack.remove();
        }, durationout);
      } else {
        setTimeout(_seekerMissilePosition, 33, attack, sizex, sizey, x, y, frames - 1, speed, radius, durationout, baserotation);
      }
    }
  };
  setTimeout(_seekerMissilePosition, 33, attack, sizex, sizey, x, y, frames - 1, speed, diameter / 2, durationout, baserotation);
}
function projectileTracked(icon, classname, sizex, sizey, startx, starty, frames, durationout, baserotation) {
  var attack = $("<img class='" + classname + "' src='" + icon + "'>");
  var x = startx - sizex / 2;
  var y = starty - sizey / 2;
  attack.css("position", "fixed");
  attack.css("left", x + 'px');
  attack.css("top", y + 'px');
  var deltax = lastX - sizex / 2 - x;
  var deltay = lastY - sizey / 2 - y;
  if (baserotation != -10) {
    attack.css("transform", "rotate(" + (Math.atan2(deltay, deltax) + baserotation) + "rad)");
  }
  $('body').append(attack);
  var _projectileTrackedPosition = function projectileTrackedPosition(attack, sizex, sizey, x, y, frames, durationout, baserotation) {
    var deltax = (lastX - sizex / 2 - x) / frames;
    var deltay = (lastY - sizey / 2 - y) / frames;
    x = x + deltax;
    y = y + deltay;
    attack.css("left", x + 'px');
    attack.css("top", y + 'px');
    if (baserotation != -10) {
      attack.css("transform", "rotate(" + (Math.atan2(deltay, deltax) + baserotation) + "rad)");
    }
    if (frames == 1) {
      setTimeout(function () {
        attack.remove();
      }, durationout);
    } else {
      setTimeout(_projectileTrackedPosition, 33, attack, sizex, sizey, x, y, frames - 1, durationout, baserotation);
    }
  };
  setTimeout(_projectileTrackedPosition, 33, attack, sizex, sizey, x, y, frames - 1, durationout, baserotation);
}
function barrage(npc) {
  var barra = $("<img class='apr-barrage' src='/images/Ice_Barrage_iceblock.png?b4915'>");
  barra.css("position", "fixed");
  barra.css("top", lastY - 173 / 2 + 'px');
  barra.css("left", lastX - 100 / 2 + 'px');
  $('body').append(barra);
  crab("Dead");
  displayAchievement("Wombat");
  setTimeout(function () {
    barra.remove();
  }, 2000);
}
function prayerKill(style) {
  if (curPrayer != style && DDSenabled) {
    crab("Dead");
  }
}
function prayerKillDelay(style, timeout) {
  if (curPrayer != style && DDSenabled) {
    setTimeout(crab, timeout, "Dead");
  }
}
var curPrayer = "";
function setPrayer(e) {
  $('.apr-prayer-highlight').css("opacity", 0);
  if (e.data == curPrayer) {
    curPrayer = "";
  } else {
    curPrayer = e.data;
    $('#apr-prayer-highlight-' + curPrayer).css("opacity", 1);
  }
}
function setupPrayer() {
  $('<div class="apr-prayer-background">').appendTo($('body'));
  $('<div id="apr-prayer-highlight-Magic" class="apr-prayer apr-prayer-highlight" style="right:128px"></div><div id="protectMagic" class="apr-prayer apr-prayer-icon" style="right:128px;background-image:url(/images/Protect_from_Magic.png?5c9d8)"></div>').appendTo($('body')).click("Magic", setPrayer);
  $('<div id="apr-prayer-highlight-Ranged" class="apr-prayer apr-prayer-highlight" style="right:92px"></div><div id="protectRanged" class="apr-prayer apr-prayer-icon" style="right:92px;background-image:url(/images/Protect_from_Missiles.png?686a4)"></div>').appendTo($('body')).click("Ranged", setPrayer);
  $('<div id="apr-prayer-highlight-Melee" class="apr-prayer apr-prayer-highlight" style="right:56px"></div><div id="protectMelee" class="apr-prayer apr-prayer-icon" style="right:56px;background-image:url(/images/Protect_from_Melee.png?65856"></div>').appendTo($('body')).click("Melee", setPrayer);
}
var TTJlist = {
  "Ma": "/images/TzTok-Jad_magic_attack.png?0b424",
  "Me": "/images/TzTok-Jad_melee_attack.png?0b424",
  "N": "/images/TzTok-Jad_neutral_pose.png?0b424",
  "R1": "/images/TzTok-Jad_ranged_attack_part_1.png?0b424",
  "R2": "/images/TzTok-Jad_ranged_attack_part_2.png?0b424"
};
var TTJhover = false;
function TTJ(npc) {
  var TTJon = function TTJon() {
    TTJhover = true;
  };
  var TTJoff = function TTJoff() {
    TTJhover = false;
  };
  $(npc.dom).hover(TTJon, TTJoff);
  setupPrayer();
  var _TTJAttack = function TTJAttack(npc) {
    var TTJNormalAnim = function TTJNormalAnim(npc) {
      npc.dom.src = TTJlist["N"];
      npc.dom.srcset = TTJlist["N"];
    };
    var TTJRange2Anim = function TTJRange2Anim(npc) {
      npc.dom.src = TTJlist["R2"];
      npc.dom.srcset = TTJlist["R2"];
    };
    var TTJMage = function TTJMage(npc) {
      npc.dom.src = TTJlist["Ma"];
      npc.dom.srcset = TTJlist["Ma"];
      setTimeout(TTJNormalAnim, 2400, npc);
      setTimeout(prayerKillDelay, 1800, "Magic", 1000);
      setTimeout(function () {
        var startx = npc.dom.getBoundingClientRect().left + 50;
        var starty = npc.dom.getBoundingClientRect().top + 100;
        projectileTracked("/images/TzTok-Jad_magic_projectile.png?c6ae1", "apr-ttj-magic", 100, 94, startx, starty, 30, 300, 0.7853981633974483);
      }, 1800);
    };
    var TTJRange = function TTJRange(npc) {
      npc.dom.src = TTJlist["R1"];
      npc.dom.srcset = TTJlist["R1"];
      setTimeout(TTJRange2Anim, 300, npc);
      setTimeout(TTJNormalAnim, 600, npc);
      setTimeout(prayerKillDelay, 1800, "Ranged", 600);
      setTimeout(function () {
        attackOver("/images/TzTok-Jad_ranged_projectile.png?c6ae1", "apr-ttj-ranged", 100, 193, 600);
      }, 1800);
    };
    var TTJMelee = function TTJMelee(npc) {
      npc.dom.src = TTJlist["Me"];
      npc.dom.srcset = TTJlist["Me"];
      setTimeout(TTJNormalAnim, 600, npc);
      prayerKill("Melee");
    };
    if (npc.dead || !DDSenabled) {
      return;
    }
    var atk = Math.random() * (2 + TTJhover);
    if (atk < 1) {
      TTJMage(npc);
    } else if (atk < 2) {
      TTJRange(npc);
    } else {
      TTJMelee(npc);
    }
    if (!npc.dead && DDSenabled) {
      setTimeout(_TTJAttack, 4800, npc);
    }
  };
  setTimeout(_TTJAttack, 1200, npc);
}
function NPC(dom) {
  this.hp = 10;
  this.accuracy = 1;
  this.hits = 0;
  this.dead = false;
  this.speed = 500;
  this.dom = dom;
  this.mechanics = false;
  if (achievementsOpen) {
    this.accuracy = 0.2;
    this.hp = 5;
  } else {
    var query = MD5(mw.config.get('wgTitle'));
    if (query == "4f66ec58eb4e9d48b01a7480c51c89b4") {
      this.hp = 5;
      if (load("apr-slayerstate") <= 3) {
        this.accuracy = 0;
      }
    }
    if (query == "09ec2c80c276b958ef255c6120cbe97a") {
      this.hp = 1;
      this.speed = 1000;
    }
    if (query == "e8f65c7327e4ae90e767afc30a709419") {
      this.accuracy = 0;
      this.mechanics = 1;
      this.angry = false;
    }
    if (query == "a9514f8884af954749b66932d8a95a76") {
      this.accuracy = 0;
      this.mechanics = 2;
      this.angry = false;
      disableHighlight();
    }
    if (query == "b31eb4b7a63bfaa339c679b86445b700" || query == "789ef204f9b93cc224a4e25694691684") {
      this.hp = 1;
      this.accuracy = 0.3;
    }
    if (query == "7dd8d4d08aa31a5c516f21d40a03c8a5") {
      this.hp = 60;
      this.accuracy = 0.5;
      this.angry = false;
      this.mechanics = 3;
      this.speed = 2000;
      bossTimer = Date.now();
      disableHighlight();
    }
    if (query == "b2df76532200e6522fd6da3967e7c94c" || query == "2586a16a520a2c20d7309b799a627f22") {
      this.mechanics = 4;
      this.angry = false;
      disableHighlight();
    }
    if (query == "fd9cf477745dbeee730e23af6a81a887") {
      this.hp = 50;
    }
    if (query == "f06eb95413908c7a0be080f82e1f4d56") {
      this.hp = 80 * 4;
      this.mechanics = 5;
      this.accuracy = 0.25;
      this.angry = false;
      this.speed = 2000;
      this.phase = 0;
      this.mainattack = 0;
      this.mainattackswitch = 3;
      this.specialtimer = 3;
      this.skipattack = 1;
      this.width = 270;
      this.height = 298;
      bossTimer = Date.now();
      disableHighlight();
    }
    if (query == "324696af5d4cb32efd2594c463cc56cc") {
      this.hp = 1;
      this.speed = 1000;
    }
    if (query == "04f12d4923ec5069ac75e6d364b719cb") {
      this.hp = 1;
      this.speed = 1000;
      disableHighlight();
    }
  }
}
var wepcolor = 'red';
function linedraw(x1, y1, x2, y2) {
  var tmp;
  if (x2 < x1) {
    tmp = x2;
    x2 = x1;
    x1 = tmp;
    tmp = y2;
    y2 = y1;
    y1 = tmp;
  }
  var lineLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  var m = (y2 - y1) / (x2 - x1);
  var degree = Math.atan(m) * 180 / Math.PI;
  $('body').append("<div class='osrs_dds line' style='transform-origin: top left; transform: rotate(" + degree + "deg); width: " + lineLength + "px; height: 1px; background: " + wepcolor + "; position: absolute; top: " + y1 + "px; left: " + x1 + "px;'></div>");
}
function mouseDown(e) {
  if (e.which == 1) {
    mouseStateDown = true;
  }
}
function mouseUp(e) {
  if (e.which == 1) {
    mouseStateDown = false;
    $(".osrs_dds").remove();
  }
}
function killNPC(npc, el) {
  npc.dead = true;
  save("apr-totalkills", load("apr-totalkills") + 1);
  updateDarkModeAchievement();
  checkAchievementKillCount();
  loggedInAchievement();
  checkAchievementSimples(npc);
  slayerAchievements();
  var seconds = npc.speed / 1000;
  var children = $(el).children("img");
  children.css("transition", "opacity " + seconds + "s ease");
  children.css("opacity", 0);
  setTimeout(function () {
    $(el.parentElement).remove();
  }, npc.speed);
}
var lastX = 0;
var lastY = 0;
function mouseMove(e) {
  lastX = e.clientX;
  lastY = e.clientY;
  if (mouseStateDown && DDSenabled) {
    linedraw(e.pageX - e.movementX, e.pageY - e.movementY, e.pageX, e.pageY);
    if (e.target.parentElement.classList.contains("hittable")) {
      var curTime = Date.now();
      if (lastHit + 200 < curTime) {
        lastHit = curTime;
        if (typeof e.target.npcid === "undefined") {
          e.target.npcid = NPCarray.length;
          NPCarray[NPCarray.length] = new NPC(e.target);
        }
        var npc = NPCarray[e.target.npcid];
        if (npc.mechanics == 3 && !npc.angry) {
          npc.angry = true;
          TTJ(npc);
        } else if (npc.mechanics == 5 && !npc.angry) {
          if (load("apr-slayerstate") <= 17) {
            crab("AHDead");
            return;
          } else {
            npc.angry = true;
            AH(npc);
          }
        }
        if (npc.accuracy > Math.random()) {
          displayAchievement("FirstHit");
          npc.hits += 1;
          var splat;
          if (npc.hits >= npc.hp) {
            if (!npc.dead) {
              splat = $("<img class='apr-hitsplat' style='left:" + (e.target.parentElement.offsetWidth * Math.random() - 12) + "px;top:" + (e.target.parentElement.offsetHeight * Math.random() - 12) + "px' src='/images/73.png?ba00a'>").appendTo(e.target.parentElement).prop("npcid", e.target.npcid);
              setTimeout(function () {
                splat.remove();
              }, 6000);
              killNPC(npc, e.target.parentElement);
            }
          } else {
            splat = $("<img class='apr-hitsplat' style='left:" + (e.target.parentElement.offsetWidth * Math.random() - 12) + "px;top:" + (e.target.parentElement.offsetHeight * Math.random() - 12) + "px' src='/images/73.png?ba00a'>").appendTo(e.target.parentElement).prop("npcid", e.target.npcid);
            setTimeout(function () {
              splat.remove();
            }, 6000);
            if (npc.mechanics == 4 && !npc.angry) {
              npc.angry = true;
              npc.dom.parentElement.remove();
              Invaders();
            } else if (npc.mechanics == 5 && npc.angry) {
              AHhit(npc);
            }
          }
        } else {
          splat = $("<img class='apr-hitsplat' style='left:" + (e.target.parentElement.offsetWidth * Math.random() - 12) + "px;top:" + (e.target.parentElement.offsetHeight * Math.random() - 12) + "px' src='/images/Zero_hitsplat.png?482dd'>").appendTo(e.target.parentElement).prop("npcid", e.target.npcid);
          setTimeout(function () {
            splat.remove();
          }, 6000);
          if (MD5(mw.config.get('wgTitle')) == "4f66ec58eb4e9d48b01a7480c51c89b4") {
            var slayerState = load("apr-slayerstate");
            if (slayerState <= 3) {
              if (slayerState >= 2) {
                save("apr-slayerstate", 3);
                crab("SpiderDead");
              } else {
                crab("Dead");
              }
            }
          }
          if (npc.mechanics == 1 && !npc.angry) {
            npc.angry = true;
            setTimeout(barrage, 4000, npc);
          }
          if (npc.mechanics == 2 && !npc.angry) {
            npc.angry = true;
            Cucco();
          }
        }
      }
    }
  }
}
function enableDDS(weapon) {
  DDSenabled = true;
  setWeapon(weapon, false);
}
function disableDDS(weapon) {
  DDSenabled = false;
  setWeapon(weapon, false);
}
function setWeapon(weapon, checkBye) {
  wepcolor = weapon[2];
  if (weapon[0] == 'Windows') {
    $('body').css('cursor', '');
    DDSenabled = false;
    if (load('apr-queststate') >= 1000 && checkBye) {
      setTimeout(crab, 50, "CursorBye");
    }
  } else if (weapon[0][0] == '/') {
    $('body').css('cursor', 'url(' + weapon[0] + ') ' + weapon[1] + ',pointer');
  } else {
    $('body').css('cursor', 'url(' + getFileURL(weapon[0] + ' cursor.png') + ') ' + weapon[1] + ',pointer');
  }
}
function checkAchievementKillCount() {
  var pagekills = 0;
  var totalkills = load("apr-totalkills");
  for (var i = 0; i < NPCarray.length; i++) {
    pagekills += NPCarray[i].dead;
  }
  if (totalkills >= 1000) {
    displayAchievement("Total1000Kill");
  } else if (totalkills >= 50) {
    displayAchievement("Total100Kill");
  } else if (totalkills >= 10) {
    displayAchievement("Total10Kill");
  }
  if (pagekills >= 5) {
    displayAchievement("Page5Kill");
  }
}
function updateDarkModeAchievement() {
  var mode = getCookie("darkmode");
  var lightdark = load("apr-lightdark");
  if (mode === false || mode === "false") {
    lightdark[0] = true;
  } else {
    lightdark[1] = true;
  }
  save("apr-lightdark", lightdark);
  if (lightdark[0] && lightdark[1]) {
    displayAchievement("LightDark");
  }
}
function slayerAchievements() {
  var slayerState = load("apr-slayerstate");
  if (slayerState >= 4) {
    if (MD5(mw.config.get('wgTitle')) == "4f66ec58eb4e9d48b01a7480c51c89b4") {
      if (slayerState < 17) {
        slayerState += 1;
        save("apr-slayerstate", slayerState);
        var width = $(window).width();
        var height = $(window).height();
        var itemz = $('<img src="' + getFileURL(mw.config.get('wgTitle') + '.png') + '" width="60" height="40">');
        itemz.css("transform", 'rotate(' + Math.random() + 'turn)');
        itemz.prop("fixed", "true");
        var itema = $('<span class="hittable bumper spinny"></span>').append(itemz);
        itema.css("left", Math.random() * (width - 60 - 300));
        itema.css("top", Math.random() * (height - 60));
        itema.css("position", "absolute");
        var itemb = $('<span class="hittabletop"></span>').append(itema);
        $(".mw-parser-output").append(itemb);
      }
      if (slayerState >= 17) {
        displayAchievement("Slayer");
      }
    }
  }
  if (slayerState >= 18) {
    if (MD5(mw.config.get('wgTitle')) == "f06eb95413908c7a0be080f82e1f4d56") {
      if (slayerState == 18) {
        slayerState += 1;
        save("apr-slayerstate", slayerState);
      }
      if (slayerState >= 19) {
        crab("SlayerWin", Date.now() - bossTimer);
        displayAchievement("Slayer2");
      }
    }
  }
}
function loggedInAchievement() {
  if (mw.config.get("wgUserName")) {
    displayAchievement("LoggedIn");
  }
}
function checkAchievementSimples(npc) {
  if (achievementsOpen) {
    displayAchievement("Inception");
  } else {
    var query = MD5(mw.config.get('wgTitle'));
    if (query == "a8e0286c13b376010251a761326a4b61" || query == "78698ef9be047049e324fbf8762e49e3" || query == "3e3411dc9821e95190da5b609451029f" || query == "e138090effb008476982705d2a74857d") {
      displayAchievement("CerealKiller");
    }
    if (query == "09ec2c80c276b958ef255c6120cbe97a") {
      displayAchievement("73");
    }
    if (query == "50b168de95e4814306c14fb2b14fb8d2" || query == "0bedb1f1643387b05f11d102b6652815") {
      displayAchievement("HandBite");
    }
    if (query == "b31eb4b7a63bfaa339c679b86445b700" || query == "789ef204f9b93cc224a4e25694691684") {
      var wep = load("apr-weapon");
      if (wep[0] == "Dragon dagger(p++)") {
        save("apr-weapon", ['Dragon dagger', '0 0', 'red']);
        enableDDS(['Dragon dagger', '0 0', 'red']);
        displayAchievement("Dishwasher");
      }
    }
    if (query == "5fdea4b55ecfc08b41b2e00f20e0e77e" || query == "0a671d6817c73446d1f2603796ba243a" || query == "9d41e8047e0a8e8b4434f117b4f1aa7d") {
      var wep2 = load("apr-weapon");
      if (wep2[0] == "Dragon dagger") {
        save("apr-weapon", ['Dragon dagger(p++)', '0 0', 'red']);
        enableDDS(['Dragon dagger(p++)', '0 0', 'red']);
        displayAchievement("Herbalist");
      }
    }
    if (query == "7dd8d4d08aa31a5c516f21d40a03c8a5") {
      crab("FireCape", Date.now() - bossTimer);
      displayAchievement("FireCape");
    }
    if (query == "1f54189f4d37bb3eeacf73027c8d6667") {
      displayAchievement("Announce");
    }
    if (MD5(query) == "1885ba58ea6e51744e1938e166151112") {
      var wep3 = MD5(load("apr-weapon")[0]);
      if (wep3 == "5c4f94f3be5e790ad8d5c058b69c037f" || wep3 == "b60c371438a43749555f0a4cbaeceeff") {
        displayAchievement("Uncle");
      }
    }
    if (query == "324696af5d4cb32efd2594c463cc56cc") {
      var wep4 = load("apr-weapon");
      if (wep4[0] == "Dragon scimitar") {
        save("apr-weapon", ['Dragon scimitar (or)', '0 0', 'rgb(183,137,21)']);
        enableDDS(['Dragon scimitar (or)', '0 0', 'rgb(183,137,21)']);
        displayAchievement("Trimmed");
      } else if (wep4[0] == "Dragon scimitar (or)") {
        save("apr-weapon", ["Dragon scimitar", "0 0", "red"]);
        enableDDS(["Dragon scimitar", "0 0", "red"]);
        displayAchievement("Trimmed");
      }
    }
    if (query == "fd9cf477745dbeee730e23af6a81a887") {
      displayAchievement("GetBond");
    }
  }
}
var mouseStateDown = false;
var DDSenabled = false;
var lastHit = 0;
var bossTimer = 0;
var NPCarray = [];
function Invaders() {
  function getHeight(i) {
    if (i < 2) {
      return 6;
    }
    return 4;
  }
  function updateDom(enemy) {
    if (enemy.y < 0) {
      enemy.dom.css("display", "none");
    } else {
      enemy.dom.css("left", leftoffset + blocksize * enemy.x);
      enemy.dom.css("top", topoffset + blocksize * enemy.y);
    }
  }
  function InvaderEnemy(type, i, j) {
    this.x = 3 + j * 4;
    if (i <= 2) {
      this.y = 0 + i * 8;
    } else {
      this.y = 16 + (i - 2) * 6;
    }
    var img;
    var tall;
    var wide = 2;
    if (type == "healer") {
      img = "/images/Penance_Healer_front_angle.png?69c56";
      tall = 6;
    } else {
      img = "/images/Penance_Runner_front_angle.png?69c56";
      tall = 4;
    }
    this.dom = $('<img id="' + i + 'MOB' + j + '" class="apr-invader-mob" src="' + img + '" style="height' + tall * blocksize + ':px;width:' + wide * blocksize + 'px;">');
    this.dom.appendTo('.apr-invader');
    updateDom(this);
  }
  function Cannon() {
    this.x = 0;
    this.y = 39;
    this.dom = $('<img id="cannonMOB" class="apr-invader-mob" src="/images/Egg_launcher_top_view.png?3b932" style="height' + 3.13703703704 * blocksize + ':px;width:' + 2 * blocksize + 'px;">');
    this.dom.appendTo('.apr-invader');
    updateDom(this);
  }
  function Egg() {
    this.x = -1;
    this.y = -1;
    this.dom = $('<img id="eggMOB" class="apr-invader-mob" src="/images/thumb/Red_egg_detail.png/160px-Red_egg_detail.png?e0ce4" style="height' + 1.49375 * blocksize + ':px;width:' + blocksize + 'px;">');
    this.dom.appendTo('.apr-invader');
    updateDom(this);
  }
  function mainLoop() {
    if (direction == 0) {
      enemyArray[currenti][currentj].x += 1;
      if (enemyArray[currenti][currentj].x == 42) {
        nextDirection = 1;
      }
    } else if (direction == 1 || direction == 3) {
      enemyArray[currenti][currentj].y += 1;
      var deathrow = 40 - getHeight(currenti);
      if (enemyArray[currenti][currentj].y == deathrow) {
        crab("Rah");
        gameEnabled = false;
      }
    } else if (direction == 2) {
      enemyArray[currenti][currentj].x -= 1;
      if (enemyArray[currenti][currentj].x == 0) {
        nextDirection = 3;
      }
    }
    updateDom(enemyArray[currenti][currentj]);
    cannon.x = Math.min(43, Math.max(0, Math.floor((lastX - leftoffset) / blocksize))) - 0.5;
    updateDom(cannon);
    lastShot -= 1;
    if (lastShot <= 0 && mouseStateDown) {
      egg.x = cannon.x + 0.5;
      egg.y = cannon.y;
      lastShot = 40;
      egg.dom.css("display", "inline");
    }
    egg.y -= 1;
    var i, j;
    var height;
    for (i = 0; i < 4; i++) {
      height = getHeight(i);
      for (j = 0; j < 10; j++) {
        if (enemyArray[i][j]) {
          if (egg.x >= enemyArray[i][j].x && egg.x < enemyArray[i][j].x + 2 && egg.y >= enemyArray[i][j].y && egg.y < enemyArray[i][j].y + height) {
            egg.y = -1;
            enemyArray[i][j].dom.remove();
            enemyArray[i][j] = false;
            kills += 1;
          }
        }
      }
    }
    updateDom(egg);
    do {
      if (kills == 40) {
        break;
      }
      currentj += 1;
      if (currentj == 10) {
        currentj = 0;
        currenti -= 1;
        if (currenti == -1) {
          currenti = 3;
          direction = nextDirection;
          if (direction == 1 || direction == 3) {
            nextDirection = 3 - direction;
          }
        }
      }
    } while (!enemyArray[currenti][currentj]);
    gameTicks += 1;
    if (gameEnabled && kills < 40) {
      setTimeout(mainLoop, 25);
    }
    if (kills == 40) {
      displayAchievement("Invaders");
      crab("Invaders", gameTicks);
    }
  }
  var width = $(window).width();
  var height = $(window).height();
  var leftoffset = 0;
  var topoffset = 0;
  var blocksize;
  if (width > height) {
    leftoffset = (width - height) / 2;
    blocksize = height / 44;
  } else {
    topoffset = (height - width) / 2;
    blocksize = width / 44;
  }
  disableDDS(['/images/Attacker_icon.png?f5946', '3 0', 'red']);
  $('body').append('<div class="apr-invader" style="background:url(/images/thumb/Barbarian_Assault_Field.png/600px-Barbarian_Assault_Field.png?91094);background-size:cover;left:' + leftoffset + 'px;top:' + topoffset + 'px;width:' + blocksize * 44 + 'px;height:' + blocksize * 44 + 'px"/>');
  var i, j;
  var enemyArray = [];
  var type = "healer";
  for (i = 0; i < 4; i++) {
    if (i == 2) {
      type = "runner";
    }
    enemyArray[i] = [];
    for (j = 0; j < 10; j++) {
      enemyArray[i][j] = new InvaderEnemy(type, i, j);
    }
  }
  var cannon = new Cannon();
  var egg = new Egg();
  var direction = 0;
  var nextDirection = 0;
  var currentj = 0;
  var currenti = 3;
  var kills = 0;
  var lastShot = 10;
  var gameEnabled = true;
  var gameTicks = 0;
  mainLoop();
}
var achievementTimeOut = 0;
function displayAchievement(achievementref) {
  var achievementList = load('apr-achievementlist');
  if (achievementref in achievementList) {
    return;
  }
  if (achievementref != "FirstHit" && !("FirstHit" in achievementList)) {
    return;
  }
  if (achievementsOpen && !(achievementref == "Total10Kill" || achievementref == "Total100Kill" || achievementref == "Total1000Kill" || achievementref == "Page5Kill" || achievementref == "Inception" || achievementref == "LoggedIn")) {
    return;
  }
  var curTime = Date.now();
  if (achievementTimeOut + 5000 < curTime) {
    achievementTimeOut = curTime;
    var achievement = achievements.get(achievementref);
    achievementList[achievementref] = true;
    save('apr-achievementlist', achievementList);
    save('apr-gp', load('apr-gp') + achievement.points);
    save('apr-gp-total', load('apr-gp-total') + achievement.points);
    var toppx = 52;
    if (window.chrome) {
      toppx = 12;
    }
    $('body').append("<div class='achievement-banner'>" + "<div class='achievement-icon'>" + "<span class='icon'><span class='icon-trophy'><img style='position:absolute;top:" + toppx + "px;left:-20px;width:40px;height:40px;' src='" + achievement.icon + "'</img></span></span>" + "</div>" + "<div class='achievement-text'>" + "<p class='achievement-notification'>Achievement unlocked</p>" + "<p class='achievement-name'>" + achievement.points + "k GP &ndash; " + achievement.name + "</p>" + "</div>" + "</div>");
    if (achievementref == "FirstHit") {
      achievementButton();
      crab("FirstBlood");
    }
    if (achievementsOpen) {
      drawAchievementList();
      drawAchievementList();
    }
  } else {
    setTimeout(displayAchievement, 250, achievementref);
  }
}
var achievementsOpen = false;
var pageTitle, pageBody;
var selectedTab;
function drawAchievementList() {
  if (achievementsOpen) {
    achievementsOpen = false;
    $('#' + selectedTab).addClass('selected');
    $('#apr-achievement-button').removeClass('selected');
    $('#firstHeading').text(pageTitle);
    $('#bodyContent').remove();
    $('#content').append(pageBody);
  } else {
    selectedTab = $('#p-namespaces ul > li.selected').attr('id');
    achievementsOpen = true;
    var achievementList = load('apr-achievementlist');
    $('#' + selectedTab).removeClass('selected');
    $('#apr-achievement-button').addClass('selected');
    pageTitle = $('#firstHeading').text();
    $('#firstHeading').text("Achievements");
    $('#crob').remove();
    pageBody = $('#bodyContent').detach();
    $('#content').append('<div id="bodyContent" class="mw-body-content"></div>');
    var body = $('#bodyContent');
    var maxgp = load('apr-gp-total');
    var curgp = load('apr-gp');
    if (maxgp == 0) {
      maxgp = "0";
    } else {
      maxgp += ",000";
    }
    if (curgp == 0) {
      curgp = "0";
    } else {
      curgp += ",000";
    }
    body.append("<p>Welcome to the achievements tab! So far, you have obtained a total of <b><span class='maxgp'>" + maxgp + "<span> GP</b>! You have <b><span class='curgp'>" + curgp + "</span> GP</b> left to spend. You have <b>" + load('apr-totalkills') + " kills</b> in total.</p>");
    var myweps = load('apr-weapon-inv');
    if (myweps.length > 0) {
      body.append("<h2><span class='mw-headline'>Available cosmetic weapons</span></h2>");
      var mywepsd = $('<div class="apr-weapon-big"/>');
      body.append(mywepsd);
      for (var i = 0; i < myweps.length; i++) {
        var item = $("<div class='apr-weapon'><img src='" + getFileURL(myweps[i][0] + ' cursor.png') + "'></div>");
        item.click([i, myweps], function (e) {
          var i = e.data[0];
          var myweps = e.data[1];
          var curwep = load("apr-weapon");
          save("apr-weapon", myweps[i]);
          setWeapon(myweps[i], true);
          myweps[i] = curwep;
          save("apr-weapon-inv", myweps);
          drawAchievementList();
          drawAchievementList();
        });
        item.css("cursor", "default");
        mywepsd.append(item);
      }
    }
    var buyweps = load('apr-weapon-buy');
    if (buyweps.length > 0) {
      body.append("<h2><span class='mw-headline'>Cosmetic weapons for sale</span></h2><p>Buy any of the weapons for the listed price.</p>");
      var buywepsd = $('<div class="apr-weapon-big" style="height:60px"/>');
      body.append(buywepsd);
      for (i = 0; i < buyweps.length; i++) {
        var item2 = $("<div class='apr-weapon'><div class='apr-weapon-icon'><img src='" + getFileURL(buyweps[i][0][0] + ' cursor.png') + "'></div><div class='apr-weapon-price'>" + buyweps[i][1] + "k</div></div>");
        item2.click([i, buyweps], function (e) {
          var i = e.data[0];
          var buyweps = e.data[1];
          var curgp = load('apr-gp');
          var price = buyweps[i][1];
          if (curgp >= price) {
            var curwep = load("apr-weapon");
            myweps.unshift(curwep);
            save("apr-weapon-inv", myweps);
            save("apr-weapon", buyweps[i][0]);
            setWeapon(buyweps[i][0], true);
            buyweps.splice(i, 1);
            save("apr-weapon-buy", buyweps);
            save("apr-gp", curgp - price);
            drawAchievementList();
            drawAchievementList();
          } else {
            crab("Poor", price);
          }
        });
        item2.css("cursor", "default");
        buywepsd.append(item2);
      }
    }
    body.append("<h2><span class='mw-headline'>Achievements list</span></h2>");
    body.append('<div class="apr-achievement-container"></div>');
    achievements.forEach(function (achievement, achievementref) {
      var icon;
      var achieved = '';
      var filler = '';
      if (achievementref in achievementList) {
        icon = getFileURL('Clippy_Achievement ' + achievement.name + '.png');
        achieved = 'achieved';
        filler = achievement.filler;
      } else {
        icon = '/images/Clippy_Achievement_none.jpg?779d5';
      }
      $('.apr-achievement-container').append('<div class="apr-achievement ' + achieved + '">' + '<div class="apr-achievement-icon">' + '<span class="hittable bumper spinny"><img src="' + icon + '"></span>' + '</div>' + '<div class="apr-achievement-text">' + '<div class="apr-achievement-title">' + achievement.name + '</div>' + '<div class="apr-achievement-desc">' + achievement.desc + '</div>' + '<div class="apr-achievement-filler">' + filler + '</div>' + '</div>' + '<div class="apr-achievement-points">' + achievement.points + ',000 GP</div>' + '</div>');
    });
  }
}
function achievementButton() {
  var achievementList = load('apr-achievementlist');
  if ('FirstHit' in achievementList) {
    $('#p-namespaces ul').append('<li id="apr-achievement-button">' + '<span>' + '<a' + ' href="javascript:void(0)"' + ' title="View your Achievements">' + 'Toggle Achievements' + '</a>' + '</span>' + '</li>');
    $('#apr-achievement-button').click(drawAchievementList);
  }
}
function toggleApr() {
  var gadgetEnabled = load("apr-gadgetenabled");
  if (gadgetEnabled) {
    save("apr-gadgetenabled", false);
    $('#apr-toggle-button > a').text("Enable cursor");
    crab("DisableCursor");
  } else {
    save("apr-gadgetenabled", true);
    $('#apr-toggle-button > a').text("Disable cursor");
    crab("EnableCursor");
  }
}
function enableDisableButton() {
  var fillertext;
  if (load("apr-gadgetenabled")) {
    fillertext = "Disable cursor";
  } else {
    fillertext = "Enable cursor";
  }
  $('#t-gadget-newpage').after('<li id="apr-toggle-button"><a href="javascript:void(0)" title="Enable or disable the cursor">' + fillertext + '</a></li>');
  $('#apr-toggle-button').click(toggleApr);
}
var achievements = new Map([["FirstHit", {
  "name": "First Blood",
  "desc": "Attack something!",
  "filler": 'A cold-blooded "accident".',
  "points": 10
}], ["Total10Kill", {
  "name": "Amateur Killer",
  "desc": "Kill 10 targets.",
  "filler": "Does anyone got a runez scazmatar they dont need?",
  "points": 10
}], ["Total100Kill", {
  "name": "Dedicated Killer",
  "desc": "Kill 50 targets!",
  "filler": "Level 50. Halfway to 99! You've unlocked the <a href='https://oldschool.runescape.wiki/w/Slaughterhouse'>slaughterhouse!</a>",
  "points": 25
}], ["Total1000Kill", {
  "name": "Professional Killer",
  "desc": "Kill 1,000 targets!! Trigger-happy much?",
  "filler": "Grinding as hard as in actual OSRS. Congratulations!",
  "points": 100
}], ["Page5Kill", {
  "name": "Serial Killer",
  "desc": "Kill 5 targets on the same page.",
  "filler": "Heads up! Enemy UAV spotted!",
  "points": 25
}], ["CerealKiller", {
  "name": "Cereal Killer",
  "desc": "Kill someone's breakfast.",
  "filler": "Are you Sam-I-Am?",
  "points": 25
}], ["73", {
  "name": "73 Re-enactment",
  "desc": "Ahhhahahaha!",
  "filler": "Never forget.",
  "points": 73
}], ["LightDark", {
  "name": "Change of Heart",
  "desc": "Kill in the Light and in the Dark.",
  "filler": "Perfectly balanced. As all things should be.",
  "points": 25
}], ["GetBond", {
  "name": "GET BOND",
  "desc": "Get a bond.",
  "filler": "Look out for future One Small Wiki Favour tasks!",
  "points": 10
}], ["HandBite", {
  "name": "The Hand that Feeds",
  "desc": "Test your blade on a blue-haired fairy.",
  "filler": "Your heart, it is black and it's hollow and it's cold.",
  "points": 10
}], ["Inception", {
  "name": "Inception",
  "desc": "Achievement an achievement.",
  "filler": "If you're going to perform inception, you need imagination.",
  "points": 25
}], ["Died", {
  "name": "Lumbridge",
  "desc": "Visit Lumbridge.",
  "filler": "Oh... THAT kind of visit.",
  "points": 10
}], ["LoggedIn", {
  "name": "The Wikian",
  "desc": "Kill something while logged in.",
  "filler": "🎶 People doing things, and editing things, and doing things. That's the wiki! 🎶",
  "points": 50
}], ["Wombat", {
  "name": "WOMbat",
  "desc": "?????",
  "filler": "Batted away by the WOM!",
  "points": 10
}], ["Announce", {
  "name": "An Important Announcement",
  "desc": "Become an anti-RWT specialist.",
  "filler": "Enjoy your lambo.",
  "points": 25
}], ["Uncle", {
  "name": "Monkey's Uncle",
  "desc": "Surprise a shopkeeper with a special weapon.",
  "filler": "Seriously, you'll be a monkey's uncle before you'll ever hold this.",
  "points": 25
}], ["Trimmed", {
  "name": "Trimmed",
  "desc": "Trim your weapon.",
  "filler": "Phr44 armour tr1mming!",
  "points": 25
}], ["Dishwasher", {
  "name": "Dishwasher",
  "desc": "Clean your dagger.",
  "filler": "Needs more weapon poison.",
  "points": 25
}], ["Herbalist", {
  "name": "Herbalist",
  "desc": "Fix your dagger.",
  "filler": "Needs less weapon poison.",
  "points": 25
}], ["Cucco", {
  "name": "20 Hearts",
  "desc": "Survive against 200 members of the Cucco's Revenge Squad.",
  "filler": "It's dangerous to go alone! Take this!",
  "points": 100
}], ["Invaders", {
  "name": "Torso Hunter",
  "desc": "Get your first Fighter torso by killing a Penance creature as a Defender or Healer.",
  "filler": "(1) Join Casual BA to hunt for Pet penance queen.<br>(2) Participate in Casual BA raids and plank like IgnobleSolid.<br>(3) ??? (4) Profit.",
  "points": 50
}], ["FireCape", {
  "name": "Starter Cape",
  "desc": "Get your first Fire Cape.",
  "filler": "Gotta post your first fire cape to Reddit, as is tradition.",
  "points": 100
}], ["Slayer", {
  "name": "Slayer Beginner",
  "desc": "Complete a slayer assignment.",
  "filler": "On the way to being a chad...",
  "points": 50
}], ["Slayer2", {
  "name": "Slayer Master",
  "desc": "Complete 2 slayer assignments.",
  "filler": "*When Nieve finds out you have 99 Slayer*",
  "points": 150
}], ["OldWOM", {
  "name": "Credits",
  "desc": "Go Sailing with the Wise Old Man.",
  "filler": "Thanks for playing! ~Gau Cho (gaucho#9471, u/gauchoob)",
  "points": 10
}]]);
function april() {
  console.log("Bronze Dagger - v72 - by Gau Cho");
  var gadgetEnabled = load("apr-gadgetenabled");
  if (gadgetEnabled) {
    spinny();
    crab();
    var weapon = load("apr-weapon");
    if (load("apr-queststate") >= 500) {
      enableDDS(weapon);
    } else {
      disableDDS(weapon);
    }
    document.body.addEventListener('mousedown', mouseDown);
    document.body.addEventListener('mousemove', mouseMove);
    document.body.addEventListener('mouseup', mouseUp);
    achievementButton();
  }
  enableDisableButton();
}
function waitForElement() {
  if (typeof rswiki !== "undefined" && typeof rswiki.hasLocalStorage !== "undefined") {
    april();
  } else {
    setTimeout(waitForElement, 250);
  }
}
waitForElement();