MediaWiki:Gadget-clippy.js: Difference between revisions

no edit summary
No edit summary
Tag: Manual revert
No edit summary
 
Line 1:
"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;
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) {
if (mouseStateDown && DDSenabled) {
var $this = $(this);
var width, height, corner, mouseX, mouseY;
 
if ($this.prop("fixed") == "true") {
var width,height,corner,mouseX,mouseY
width = if$($thiswindow).propwidth("fixed") == "true"){;
widthheight = $(window).widthheight();
heightcorner = $(window).height(){
corner = {"left": parseFloat($this.css("left")),"top":parseFloat($this.css("top"))}
"top": mouseX = evtparseFloat($this.clientXcss("top"))
};
mouseY = evt.clientY
mouseX = } else {evt.clientX;
widthmouseY = $(document)evt.width()clientY;
} else {
height = $(document).height()
cornerwidth = $this(document).offsetwidth();
mouseXheight = evt$(document).pageXheight();
mouseYcorner = evt$this.pageYoffset();
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 closestcenter = $this.outerWidth() / 2{
x: corner.left + $this.outerWidth() / 2,
y: corner.top + $this.toggleClassouterHeight('spinning',true) / 2
};
var dist = new Math.Vector(center.x - mouseX, center.y - mouseY);
if (dist.length() >= closest) {
var closest = $this.outerWidth() / return2;
$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'));
ifleft: (newCornercorner.left <+ -padding) {delta.x,
top: corner.top + newCornerdelta.left = -padding;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.topleft <= -padding) {;
} else if (newCorner.left + $this.outerWidth() - padding > width) {
newCorner.top = -padding;
newCorner.left = }width else if (newCorner.top +- $this.outerHeightouterWidth() -+ 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);
}
}
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);
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 =
searchterm = '.mwinfobox-parser-output >monster .floatleftinfobox-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 excludetermheight = $(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"){
var wrapperitema = $('<span class="hittabletop"><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 (queryname == "f06eb95413908c7a0be080f82e1f4d56"'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 (resultname === null'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 if(retname == result'apr-achievementlist') {
return true{};
}
if (name == 'apr-totalkills') {
console.warn('Error saving to localStorage');
return false0;
} catch (err) {
if (name == 'apr-lightdark') {
console.warn('Error saving to localStorage');
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 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 getDist(x,y){
return Math.sqrt(x*x+y*y)
}
function disableHighlight() {
 
if (window.getSelection) {
function disableHighlight(){
if (window.getSelection) {window.getSelection().removeAllRanges();}
} else if (document.selection) {document.selection.empty();}
document.selection.empty();
$('body').css("user-select","none")
}
$('body').css("user-select", "none");
}
 
var dialogue = {
"IntroPrompt": {
Line 306 ⟶ 324:
"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}],
"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",
"width": 78,
Line 317 ⟶ 341:
"questState": 101,
"options": ["Got it!"],
"effects": [{"questState":110}],
"questState": 110
}],
"response": ["Good luck! Don't hesitate to talk to me if you get stuck!"],
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
Line 343 ⟶ 369:
"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": [{
"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",
"omitY": true,
"width": 64,
"height": 95
Line 354 ⟶ 388:
"initial": "?",
"options": ["Why are you guys hanging around here?"],
"effects": [{"dialogue":"Archer2"}],
"dialogue": "Archer2"
}],
"response": ["(ahem)...'Guys'? And that's really none of your business."],
"icon": "/images/Archer_%28Lost_City%29_chathead.png?a7c88",
Line 363 ⟶ 399:
"initial": "(ahem)...'Guys'? And that's really none of your business.",
"options": ["I'll talk to someone else then."],
"effects": [{"dialogue":"Swamp"}],
"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",
Line 372 ⟶ 410:
"initial": "?",
"options": ["Why are all of you standing around here?"],
"effects": [{"dialogue":"Monk2"}],
"dialogue": "Monk2"
}],
"response": ["None of your business. Get lost."],
"icon": "/images/Monk_%28Lost_City%29_chathead.png?33896",
Line 381 ⟶ 421:
"initial": "None of your business. Get lost.",
"options": ["I'll talk to someone else then."],
"effects": [{"dialogue":"Swamp"}],
"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",
Line 390 ⟶ 432:
"initial": "?",
"options": ["Why are all of you standing around here?"],
"effects": [{"dialogue":"Wizard2"}],
"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",
Line 399 ⟶ 443:
"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"}],
"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",
Line 407 ⟶ 453:
"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"}],
"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",
"width": 85,
Line 416 ⟶ 466:
"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}],
"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",
"width": 85,
Line 425 ⟶ 477:
"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}],
"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",
"width": 85,
Line 453 ⟶ 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?",
"options": ["I want to find Zanaris."],
"effects": [{"dialogue":"Shamus2"}],
"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",
Line 462 ⟶ 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.",
"options": ["...but... I thought... Zanaris was a city...?"],
"effects": [{"dialogue":"Shamus3"}],
"dialogue": "Shamus3"
}],
"response": ["Aye that it is!"],
"icon": "/images/Shamus_chathead.png?989e1",
Line 470 ⟶ 528:
"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"}],
"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",
"width": 92,
Line 480 ⟶ 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.",
"options": ["So where would I get a staff?"],
"effects": [{"questState":130}],
"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",
Line 497 ⟶ 561:
"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,
Line 506 ⟶ 570:
"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"}],
"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",
"width": 103,
Line 516 ⟶ 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.",
"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."],
"icon": "/images/Monk_of_Entrana_chathead.png?33896",
Line 543 ⟶ 613:
"initial": "Welcome to holy Entrana! Feel free to take a look around.",
"options": ["Have you seen any dramen trees around?"],
"effects": [{"questState":140}],
"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",
Line 560 ⟶ 632:
"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"}],
"responsetrigger": ["",""],4
}, {
"dialogue": "TreeSpirit"
}],
"response": ["", ""],
"icon": "/images/Cave_monk_chathead.png?17eff",
"width": 62,
Line 569 ⟶ 645:
"TreeSpirit": {
"initial": "A tree spirit suddenly appears and attacks you!",
"options": ["Fight back with melee.", "Use Water Wave."],
"effects": [{"trigger":6},{"dialogue":"DramenBranch"}],
"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",
"omitY": true,
"width": 150,
"height": 283
Line 580 ⟶ 660:
"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}],
"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
Line 602 ⟶ 685:
"response": [],
"icon": "/images/thumb/Dramen_staff_detail.png/150px-Dramen_staff_detail.png?83540",
"omitY": true,
"width": 150,
"height": 152
Line 608 ⟶ 691:
"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": [{
"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",
"omitY": true,
"width": 150,
"height": 152
Line 619 ⟶ 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?",
"options": ["Ok"],
"effects": [{"trigger":4}],
"trigger": 4
}],
"response": [""],
"icon": "/images/Wise_Old_Man_chathead.png?68f26",
Line 627 ⟶ 715:
"Jukat": {
"initial": "Dragon swords! Here, Dragon swords! Straight from Frenaskrae!",
"options": ["Yes please.", "No thanks, I'm just browsing."],
"effects": [{"dialogue":"Jukat2"},{}],
"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",
"width": 87,
Line 637 ⟶ 727:
"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"}],
"trigger": 3,
"questState": 500,
"dialogue": "Jukat3"
}],
"response": [""],
"icon": "/images/Jukat_chathead.png?ba968",
Line 772 ⟶ 866:
"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}],
"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": {
"initial": "...",
"options": ["..."],
"effects": [{"trigger":4}],
"trigger": 4
}],
"response": [""],
"icon": "/images/thumb/Coffin_detail.png/130px-Coffin_detail.png?9d094",
Line 814 ⟶ 912:
"Crab": {
"initial": "Reset all quest and achievement data?",
"options": ["Yes", "No"],
"effects": [{"trigger":1},{}],
"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",
"width": 220,
Line 856 ⟶ 956:
"questState": 501,
"options": ["Got it!"],
"effects": [{"questState":502}],
"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": {
Line 903 ⟶ 1,005:
"width": 66,
"height": 102
},
};
 
function crab(conversationoverride, datum) {
}
$('#crob').remove();
 
function crab if (conversationoverride,datum === undefined) {
var questState = load("apr-queststate");
$('#crob').remove();
if (conversationoverridequestState === 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.chatboxxconversationoverride === undefined"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"conversationoverride in== conversation"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){
if (slayerState >= 1 && save("apr-slayerstate",event.data.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(eventconversation.data.triggereffects[1] == 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-invslayerState"): 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 ('questStateslayerState' in conversationevent.data) {
save("apr-queststateslayerstate",conversation event.data.questStateslayerState);
}
if ('trigger' in conversationevent.data) {
if (conversationevent.data.trigger == 41) {
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"])
displayAchievementlocalStorage.removeItem("Diedapr-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) {
 
$(document).mouseleave(function AH(npc) {
if (DDSenabled) {
$(document).mouseleave(function () {
DDSenabled = if(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 AHMagicAHRanged = 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_magic_projectileAlchemical_Hydra_ranged_projectile.png?2a2bc", "apr-hydra-magicranged",50 80,50 80 /1013 1561 *592 585, startx, starty, 20, 150, 0.3914051281252104);
};
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 AHFirecurY = function(npc,remaining){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 }
if (remaining > 0) var curX = lastX{
setTimeout(_AHFire, 1200, varnpc, curYremaining =- lastY1);
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;
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){
if (npc.skipattackphase -== 1) {
}i else if(npc.specialtimer == 0){;
var npc.specialtimerattempts = 90;
while if(npc.phasei ==< 04) || npc.phase == 3){
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 istartY = 0;Math.random() i* < 4height; i++) {
var dist = getDist(startX - lastX, startY - setTimeout(function(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")
attempts += },600)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 {
npc.specialtimermainattackswitch -= 13;
 
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 (top < 200 && left + npc.hitswidth ==> $(npc"#apr-hydra-vent-green").phase+1prop("left")*80) {
npc.phaseaccuracy = npc.hits/801;
}
$(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 widthheight = $(window).widthheight();
if (width var/ height => $(window)0.25 && width / height( < 4) {
var cuccoCount = 0;
if(width/height > 0.25 && width/height < 4){
var cuccoCountcuccoSpawned = 0;
var basex = Math.floor(Math.sqrt(width * height / 100 / 1.35));
var cuccoSpawned = 0
var basexbasey = 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-personaldiv.menu").remove();
$("div.menusuggestions").remove();
$(document).mouseleave(function () {
$("div.suggestions").remove()
if (DDSenabled) {
 
$(document).mouseleave(functionDDSenabled ()= {false;
crab("CuccoEscape", if(DDSenabledcuccoSpawned){;
}
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 = $('.apr-cucco').each(function () {
var newx = cuccoCountparseInt($(this).css("left")) += 1width / 80;
if (newx > if(width !=+ $(window).width(basex) || height != $(window).height()){
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)
}
}
});
 
if cuccoAttack(cuccoSpawned == 200) {
displayAchievement("Cucco");
 
} else {}
if crab("DeadBadWindow"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 = $.css("<img class='position"+classname+"', src='"+icon+"'>fixed");
attack.css("positiontop","fixed" lastY - sizey / 2 + 'px');
attack.css("topleft",lastY lastX -sizey sizex / 2 + 'px');
attack.css("leftwidth",lastX- sizex/2 + 'px');
attack.css("widthheight",sizex sizey + 'px');
$('body').append(attack);
attack.css("height",sizey+'px');
setTimeout(function () {
$('body').append(attack)
setTimeout(function(){attack.remove()}, duration);
}, 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 if(DDSenabled) {
crab("Dead");
}
});
$(jquerytarget).after(attack);
}, hoverdelay);
setTimeout(function () {attack.remove()},duration);
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 xy = startxstarty -sizex sizey / 2;
attack.css("position", "fixed");
var y = starty-sizey/2
attack.css("positionleft","fixed" x + 'px');
attack.css("lefttop",x y + 'px');
attack.css("topwidth",y sizex + 'px');
attack.css("widthheight",sizex 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 xy = startxstarty -sizex sizey / 2;
attack.css("position", "fixed");
var y = starty-sizey/2
attack.css("positionleft","fixed" x + 'px');
attack.css("lefttop",x 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_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("positiontop","fixed" lastY - 173 / 2 + 'px');
barra.css("topleft",lastY lastX -173 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");
}
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 == curPrayerTTJRange(npc){;
curPrayer = ""
} else {
curPrayer = e.dataTTJMelee(npc);
$('#apr-prayer-highlight-'+curPrayer).css("opacity",1)
}
if (!npc.dead && DDSenabled) {
setTimeout(_TTJAttack, 4800, npc);
}
};
setTimeout(_TTJAttack, 1200, npc);
}
function setupPrayerNPC(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(){TTJhoverthis.speed = true}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.hitshp = 01;
this.deadaccuracy = false0.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) {
var tmp;
if (x2 < x1) {
tmp = x2 ; x2 = x1 ; x1 = tmp
tmpx2 = y2 x1; y2 = y1 ; y1 = tmp
}x1 = tmp;
tmp = y2;
 
y2 = y1;
var lineLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
var my1 = (y2 - y1) / (x2 - x1)tmp;
}
 
var degreelineLength = Math.atansqrt(m)Math.pow(x2 *- 180x1, /2) + Math.PIpow(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) {
if (e.which == 1) {
mouseStateDown = mouseStateDown=false;
$(".osrs_dds").remove();
}
}
function killNPC(npc, el ) {
npc.dead = true;
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");
 
children.css("transition", "opacity var" + seconds =+ npc.speed/1000"s ease");
var children = $(el).childrencss("imgopacity", 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 lastXlastY = 0;
function mouseMove(e) {
var lastY = 0
lastX = e.clientX;
function mouseMove(e){
lastXlastY = e.clientXclientY;
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")){
if (lastHit + 200 var< curTime) = Date.now(){
lastHit = if(lastHit+200<curTime){;
if (typeof e.target.npcid === "undefined") {
lastHit = curTime
if(typeof e.target.npcid === "undefined"){NPCarray.length;
NPCarray[NPCarray.length] = new NPC(e.target.npcid = NPCarray.length);
}
NPCarray[NPCarray.length] = new NPC(e.target)
var npc = }NPCarray[e.target.npcid];
if (npc.mechanics == 3 && !npc.angry) {
 
var npc.angry = NPCarray[e.target.npcid]true;
TTJ(npc);
 
} else if if(npc.mechanics == 35 && !npc.angry) {
if (load("apr-slayerstate") <= 17) npc.angry = true;{
TTJcrab(npc"AHDead");
return;
} else if(npc.mechanics == 5 && !npc.angry){
} else if(load("apr-slayerstate")<=17){
npc.angry = crab("AHDead")true;
returnAH(npc);
} else {
}
npc.angry = true;
if (npc.accuracy > AHMath.random(npc);) {
}displayAchievement("FirstHit");
npc.hits += }1;
var splat;
 
if if(npc.accuracyhits >Math= npc.random()hp) {
if displayAchievement("FirstHit"!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
setTimeout(function () var splat{
ifsplat.remove(npc.hits >= npc.hp){;
}, if(!npc.dead6000){;
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) {
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) {
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 setWeaponcheckAchievementKillCount(weapon,checkBye) {
var wepcolorpagekills = weapon[2]0;
var totalkills = load("apr-totalkills");
if(weapon[0]=='Windows'){
for (var i = 0; i $('body')< NPCarray.css('cursor',''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]totalkills =>= '/'50) {
displayAchievement("Total100Kill");
$('body').css('cursor','url('+weapon[0]+') '+weapon[1]+',pointer')
} 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("Total1000Kill73");
} else if(totalkills>=50){
displayAchievement("Total100Kill");
} else if(totalkills>=10){
displayAchievement("Total10Kill");
}
if (query == "50b168de95e4814306c14fb2b14fb8d2" || query == "0bedb1f1643387b05f11d102b6652815") {
if(pagekills >= 5){
displayAchievement("Page5KillHandBite");
}
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 DDSenabled = false;
var lastHit = 0;
var bossTimer = 0;
 
var NPCarray = [];
function Invaders() {
 
function InvadersgetHeight(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")
if (enemy.y < } else0) {
enemy.dom.css("leftdisplay",leftoffset+blocksize*enemy.x "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) {
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)
}
functionvar Cannon(){img;
var this.x = 0tall;
var this.ywide = 392;
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')
tall = updateDom(this)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 = dom.appendTo('.apr-1invader');
updateDom(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;">')
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){
egg.x = cannon.x + nextDirection = 10.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")
for (i = 0; i < 4; i++) gameEnabled = false;{
height = }getHeight(i);
for (j }= else0; if(directionj ==< 210; j++) {
if (enemyArray[currentii][currentjj].x -=) 1{
if (egg.x >= enemyArray[currentii][currentjj].x =&& egg.x < enemyArray[i][j].x + 2 && egg.y >= 0enemyArray[i][j].y && egg.y < enemyArray[i][j].y + height) {
nextDirectionegg.y = 3-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 -= 1break;
}
if(lastShot <= 0 && mouseStateDown){
currentj egg.x += cannon.x+0.51;
if (currentj == 10) egg.y = cannon.y{
lastShotcurrentj = 400;
currenti -= 1;
egg.dom.css("display","inline")
}if (currenti == -1) {
egg.y - currenti = 13;
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 typeblocksize = "healer"height / 44;
} else {
for (i = 0; i < 4; i++) {
topoffset = (height - if(i==2width){ / 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 cannonenemyArray[i] = new Cannon()[];
varfor egg(j = new0; Egg(j < 10; j++) {
enemyArray[i][j] = new InvaderEnemy(type, i, j);
 
}
var direction = 0
}
var nextDirection = 0
var cannon = new Cannon();
 
var currentjegg = 0new Egg();
var currentidirection = 30;
var killsnextDirection = 0;
var currentj = 0;
 
var lastShotcurrenti = 103;
var gameEnabledkills = true0;
var lastShot = 10;
 
var gameTicksgameEnabled = 0true;
var gameTicks = 0;
 
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")){
returndrawAchievementList();
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 pageTitle, pageBody;
var selectedTab;
function drawAchievementList() {
if (achievementsOpen) {
achievementsOpen = false;
$('#' + selectedTab).addClass('selected');
$('#apr-achievement-button').removeClass('selected');
$('#firstHeading').text(pageTitle);
$('#firstHeadingbodyContent').textremove(pageTitle);
$('#bodyContentcontent').removeappend(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 {
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 {
curgp += save("apr-gadgetenabled",true)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 {
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();