Untitled
Guest 39 15th Jan, 2025
! function() {
"use strict";
const e = () => void 0 !== window.Engine,
t = (e, t, i, s) => {
var n;
n = e[t], e[t] = function(...e) {
"function" == typeof i && i.apply(this, e);
let t = n.apply(this, arguments);
return "function" == typeof s && s.call(this, e, t), t
}
},
i = t => {
const i = e() ? window.Engine.map.d.visibility : window.map.visibility;
if (0 === i) return !0;
const {
x: s,
y: n
} = e() ? window.Engine.hero.d : window.hero;
return Math.abs(s - t.x) <= i && Math.abs(n - t.y) <= i
},
s = e => e > 19 && e < 30,
n = e => {
if (e < 1) return "0:00";
let t = Math.floor(e / 3600),
i = Math.floor(e / 60) % 60;
return t > 0 && i < 10 && (i = "0" + i), (t > 0 ? t + ":" : "") + i + ":" + ("0" + e % 60).substr(-2)
},
o = () => {
document.title = "Margonem MMORPG"
},
r = ({
cid: t,
aid: i,
world: s
}) => {
if (c() === t && l() === i && d() === s) return window.message("JesteĹ juĹź na tej postaci");
const n = () => {
const e = new Date;
e.setTime(e.getTime() + 2592e6), setCookie("mchar_id", t, e, "/", "margonem.pl"), i !== l() && window.setCookie("user_id", i, e, "/", "margonem.pl"), s !== d() ? window.location.replace(`https://${s}.margonem.pl`) : window.location.reload()
},
o = (e() ? Engine.hero.d.guest : hero.guest) ? "logout" : "loginSubstitute";
if (i !== l()) {
const e = window.getCookie("hs3");
fetch("https://www.margonem.pl/ajax/" + o, {
method: "POST",
mode: "no-cors",
body: `h2=${e}&security=true`,
headers: {
"content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
credentials: "include"
}).then(n)
} else n()
},
a = ({
id: e = "",
name: t = "",
world: i
}) => e + t + i,
d = () => e() ? Engine.worldConfig.getWorldName() : g.worldname,
l = () => e() ? window.getCookie("user_id") : g.aid,
c = () => e() ? Engine.hero.d.id : hero.id,
m = () => e() ? Engine.lock : g.lock,
h = (t, i) => {
e() ? (i = i.map((e, t) => ({
txt: 0 === t ? "Tak" : "Nie",
callback: () => (e(), !0)
})), window.mAlert(t, i)) : window.mAlert(t, 2, i)
};
function p(e, t) {
void 0 === t && (t = {});
var i = t.insertAt;
if (e && "undefined" != typeof document) {
var s = document.head || document.getElementsByTagName("head")[0],
n = document.createElement("style");
n.type = "text/css", "top" === i && s.firstChild ? s.insertBefore(n, s.firstChild) : s.appendChild(n), n.styleSheet ? n.styleSheet.cssText = e : n.appendChild(document.createTextNode(e))
}
}
var u = {
multiplier: 1,
opacity: .6,
size: 14,
title: !0,
floating: !1,
floatingPos: {
x: 0,
y: 0
},
alwaysActive: !1,
moveBookmarks: !0,
highlight: !0,
highlightTime: 30,
deleteTime: 90,
volume: .2,
alertRespawn: !1,
alertRespawnUrl: "https://cronus.margonem.com/sounds/elite2_here.mp3",
alertHighlight: !1,
alertHighlightUrl: "https://cronus.margonem.com/sounds/abbys.mp3",
elitesFirst: !0,
firstRun: !0
};
var w = new class {
constructor() {
this.storage = e() ? API.Storage : window.margoStorage, this.settings = this.storage.get("timer2/settings", u), this.emitter = (() => {
const e = {};
return {
on(t, i) {
e[t] || (e[t] = []), e[t].push(i)
},
emit(t, i) {
let s = e[t];
s && s.forEach(e => e(i))
}
}
})()
}
get(e) {
return window.isset(this.settings[e]) ? this.settings[e] : this.getDefault(e)
}
set(e, t) {
this.settings[e] = t, this.storage.set("timer2/settings", this.settings), this.emitter.emit(e, t)
}
getDefault(e) {
return window.isset(u[e]) ? u[e] : null
}
reset(e) {
this.set(e, this.getDefault(e))
}
resetAll() {
Object.entries(u).forEach(([e, t]) => {
this.set(e, t)
})
}
},
A = [{
key: "multiplier",
type: "text",
label: "MnoĂĹĄÄšĹnik czasu odrodzenia"
}, {
key: "opacity",
type: "slider",
label: "PrzezroczystoĂĹĄĂÂÄÂĂÂ",
min: .3,
max: .9,
step: .01
}, {
key: "size",
type: "slider",
label: "WielkoĂĹĄĂÂÄÂĂÂ tekstu",
min: 8,
max: 16,
step: 1
}, {
key: "title",
type: "checkbox",
label: "WyĂĹĄĂÂwietlaj ostatni wpis w tytule karty"
}, {
key: "floating",
type: "checkbox",
label: "PĂĹĄĂÂywajÄÂĂÂ
cy minutnik"
}, {
key: "alwaysActive",
type: "checkbox",
label: "Interfejs minutnika zawsze aktywny"
}, {
key: "moveBookmarks",
type: "checkbox",
label: "PrzesuĂĹĄĂ zakĂĹĄĂÂadki (np. druĂĹĄÄšĹyny, konsoli)",
interface: "old"
}, {
key: "highlight",
type: "checkbox",
label: "PodĂĹĄĂÂwietlaj wpis zbliĂĹĄÄšĹajÄÂĂÂ
cy siÄÂĂÂ do koĂĹĄĂÂca"
}, {
key: "highlightTime",
type: "text",
label: "Czas podĂĹĄĂÂwietlenia wpisu [s]"
}, {
key: "deleteTime",
type: "text",
label: "Czas do usuniÄÂĂÂcia wpisu [s]"
}, {
key: "alertRespawn",
type: "checkbox",
label: "Alert dĂĹĄÄšÂwiÄÂĂÂkowy po odrodzeniu"
}, {
key: "alertHighlight",
type: "checkbox",
label: "Alert dĂĹĄÄšÂwiÄÂĂÂkowy po podĂĹĄĂÂwietleniu"
}, {
key: "alertRespawnUrl",
type: "text",
label: "ĂĹĄĂÂcieĂĹĄÄšĹka do alertu odrodzenia",
audio: !0
}, {
key: "alertHighlightUrl",
type: "text",
label: "ĂĹĄĂÂcieĂĹĄÄšĹka do alertu podĂĹĄĂÂwietlenia",
audio: !0
}, {
key: "volume",
type: "slider",
label: "GĂĹĄĂÂoĂĹĄĂÂnoĂĹĄĂÂÄÂĂ alertĂÂÄšÂw",
min: .05,
max: 1,
step: .01
}];
var b = new class {
constructor() {
this.sounds = {}, this.block = !1
}
load(e) {
this.sounds[e] = new Audio(e)
}
unload(e) {
this.sounds[e] && delete this.sounds[e]
}
play(e) {
if (this.block) return;
this.block = !0, this.sounds[e] || this.load(e);
const t = this.sounds[e];
t.pause(), t.currentTime = 0, t.volume = w.get("volume"), t.play().then(() => {
this.block = !1
}).catch(() => {
this.block = !1
})
}
},
f = ["Czarna Wilczyca", "Karhu", "Vulk", "MrĂÂÄšÂwcza KrĂÂÄšÂlowa", "Astratus", "KotoĂĹĄĂÂak Tropiciel", "PaladyĂĹĄĂÂski Apostata", "Cerber", "Herszt rozbĂÂÄšÂjnikĂÂÄšÂw", "WilkoĂĹĄĂÂak", "Tollok Shimger", "DowĂÂÄšÂdca Ghuli", "Wilcza Jagoda", "Thowar", "Gnom Figlid", "Wilcza Paszcza", "Krogor", "Nocny Puff", "Vonaros", "Lisz", "Kraken", "Tarrol Agze", "Brzeginia", "Topielica Nelumbo", "MrĂÂÄšÂwka KrĂÂÄšÂlowa", "ĂĹĄĂÂowca SkĂÂÄšÂr", "ZarzÄÂĂÂ
dca Magazynu", "Duchowy PoĂĹĄÄšĹeracz", "Berog Astron", "Mnich Czarnego Uroku", "Selder", "Centaur Zyfryd", "Henry Kaprawe Oko", "Cheperu", "Pomylony MiĂĹĄĂÂ", "Zabalsamowany wyznawca Seta", "Marid", "Szkielet bosmana", "ZarzÄÂĂÂ
dca KazamatĂÂÄšÂw", "Moloch Klucznik", "Demiurg cretula", "Demoniczny StraĂĹĄÄšĹnik", "StraĂĹĄÄšĹnik MaddokĂÂÄšÂw", "Szafirowa Bolita", "PotÄÂĂÂĂĹĄÄšĹny Furbol"];
var y = new class {
constructor() {
this.storage = e() ? API.Storage : window.margoStorage, this.disabled = this.storage.get("timer2/disabledElites", {}), this.userElites = this.storage.get("timer2/userElites", [])
}
check(e) {
return this.isElite(e) && !this.isDisabled(e)
}
isElite(e) {
return f.includes(e) || this.userElites.includes(e)
}
isDisabled(e) {
return e in this.disabled
}
add(e) {
if (!e || this.isElite(e)) throw new Error("Elite is already on the list");
return this.userElites.push(e), this.storage.set("timer2/userElites", this.userElites), !0
}
remove(e) {
const t = this.userElites.indexOf(e);
if (t < 0) throw new Error("Elite is not on the user list");
return this.userElites.splice(t, 1), this.storage.set("timer2/userElites", this.userElites), !0
}
setState(e, t) {
if (!this.isElite(e)) throw new Error("Elite is not on the list");
return !0 === t ? this.disabled[e] = !0 : this.isDisabled(e) && delete this.disabled[e], this.storage.set("timer2/disabledElites", this.disabled), !0
}
};
class x {
constructor() {
this.lock = m()
}
toggle() {
this.$wnd ? e() ? this.newWnd.isShow() ? this.newWnd.hide() : this.newWnd.show() : this.$wnd ? this.$wnd.toggle() : this.init() : this.init(), this.toggleLock()
}
toggleLock() {
this.lock.check("timer-settings") ? this.lock.remove("timer-settings") : this.lock.add("timer-settings")
}
init() {
this.$wnd = $('<div class="timer-settings"><header class="timer-settings__header"><div class="timer-settings__tabs"></div><button class="timer-settings__close">Zamknij</button></header><section class="timer-settings__content"></section></div>'), this.$content = this.$wnd.find(".timer-settings__content"), this.initTabs([
["Ustawienia", this.loadSettingsTab],
["Elity", this.loadElitesTab],
["Informacje", this.loadInfoTab]
]), p('.timer-elites{width:70%;height:90%;display:flex;flex-direction:column;box-sizing:border-box}.timer-elites__list{height:100%;overflow-y:scroll;border:1px solid #555}.timer-elites__elite{display:flex;padding:4px;align-items:center}.timer-elites__elite:hover{background:rgba(0,0,0,.2)}.timer-elites__header{margin-bottom:1em}.timer-elites__controls{margin-top:.5em;padding:10px;display:flex}.timer-elites__input{width:100%;margin-right:10px;border:0;background:none;border:1px solid hsla(0,0%,100%,.3);color:#fff;padding:5px}.timer-elites__remove{cursor:pointer;position:relative;width:1em;height:1em;margin-left:auto;margin-right:4px}.timer-elites__remove:before{transform:rotate(45deg)}.timer-elites__remove:after{transform:rotate(-45deg)}.timer-elites__remove:after,.timer-elites__remove:before{position:absolute;left:.5em;content:" ";height:1em;width:2px;background-color:#888}.timer-elites__elite input{margin-right:.5em}.timer-settings{position:absolute;width:512px;height:512px;background:rgba(0,0,0,.7);z-index:398;font-family:sans-serif;font-size:14px;backdrop-filter:blur(5px);display:flex;flex-direction:column;color:#fff}.timer-settings--ni{font-family:Aleo;position:relative;background:none}.timer-settings__header{display:flex;justify-content:space-between;background:hsla(0,0%,39.2%,.3)}.timer-settings__close{background:#000;padding:10px 12px;border:none;color:#aaa;cursor:pointer}.timer-settings__tabs{display:flex}.timer-settings__tab{padding:10px 12px;cursor:pointer}.timer-settings__tab--active{background:hsla(0,0%,100%,.3);box-shadow:0 0 10px #222}.timer-settings__tab:not(.timer-settings__tab--active):hover{background:hsla(0,0%,39.2%,.2)}.timer-settings__content{display:flex;flex-direction:column;justify-content:space-around;align-items:center;height:100%;overflow:hidden;width:100%;padding:10px;box-sizing:border-box}.timer-settings__label{width:100%;height:1.5em}.timer-settings__label--input{display:flex;justify-content:space-between;align-items:center}.timer-settings__label--input span{margin-right:auto}.timer-settings__button{cursor:pointer;margin-right:.2em;padding:2px}.timer-settings__label--input input[type=text]{border:0;background:none;border:1px solid hsla(0,0%,100%,.3);color:#fff;padding:5px;width:120px}.timer-settings__checkbox{margin-right:10px}.timer-info{width:80%}.timer-info p{text-align:center;margin:2em 0}.timer-settings__ni-bg{position:absolute;top:-2px;left:-10px;right:-10px;bottom:-5px;border-style:solid;border-width:10px;border-image:url(../img/gui/quests/quest_middle.png) 10 fill round}'), e() ? (this.$wnd.addClass("timer-settings--ni"), Engine.windowManager.add({
content: this.$wnd,
title: "Minutnik",
nameWindow: "minutnik-ni-si",
objParent: this,
nameRefInParent: "newWnd",
onclose: () => {
this.toggle()
}
}), this.$wnd.find(".timer-settings__close").hide(), this.newWnd.$.append('<div class="timer-settings__ni-bg">').find(".content").css("padding", 0), this.newWnd.addToAlertLayer(), this.newWnd.setWndOnPeak(!0), this.newWnd.center()) : (this.$wnd.appendTo("#centerbox"), this.$wnd.find(".timer-settings__close").click(() => this.toggle()))
}
initTabs(e) {
const t = this.$wnd.find(".timer-settings__tabs");
e.forEach(e => {
t.append(this.createTabElem(e))
}), this.changeActiveTab(this.$wnd.find(".timer-settings__tab:first-child").first()), e[0][1].call(this)
}
createTabElem(e) {
return $('<div class="timer-settings__tab">').text(e[0]).click(t => {
this.changeActiveTab($(t.target)), e[1].call(this)
})
}
changeActiveTab(e) {
e.toggleClass("timer-settings__tab--active", !0).siblings().toggleClass("timer-settings__tab--active", !1)
}
loadSettingsTab() {
this.$content.html(""), A.forEach(t => {
if (e() && "old" === t.interface) return;
let i;
"checkbox" === t.type ? i = this.createCheckbox(t) : "text" === t.type ? i = this.createInput(t) : "slider" === t.type && (i = this.createSlider(t)), this.$content.append(i)
})
}
loadInfoTab() {
this.$content.html('<div class="timer-info"><p>Przytrzymaj przycisk <kbd>CTRL</kbd>, aby uaktywniÄ interfejs Minutnika.</p><p>UĹźyj przycisku <kbd>ÄÂĚĽ</kbd> lub naciĂĹĄĂÂnij <kbd>PPM</kbd> na wpis, aby siÄÂĂ przelogowaÄÂĂÂ.</p></div>')
}
createCheckbox({
key: e,
label: t
}) {
const i = $('<label class="timer-settings__label">').text(t),
s = $('<input type="checkbox" class="timer-settings__checkbox">');
return s.attr("checked", w.get(e) || !1).change((function() {
w.set(e, this.checked)
})), i.prepend(s), i
}
createInput({
key: e,
label: t,
audio: i = !1
}) {
const s = $('<label class="timer-settings__label timer-settings__label--input">').append($("<span>").text(t));
if (i) {
const t = $('<img class="timer-settings__button">').attr("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AQeADYwq4LUgQAAAttJREFUKM91099LU2EcBvDnffd6fi3PmfPHzmTmnE46jRwyEiSQ6iKQSLoSxRuJQRf1B4h33XbTv6E3XQVFSk4DQahIN2OQGQc3h7NxzvTsbObxPd0Y2EWfywee79X3Ib7vgxByDUAEgApAAfDJ9/0zACCE9OOS7/smrmCEkCAAHcDQ4uLiY1VVEwsLC28JIa9jsdiz3t7eB4SQTsbYZ0LISwDlv0cYAA2AAeBuPB5/qqoqJiYm7mmatkAI6UilUs16vV7b29uLc85fCYKwRwhZBGAGAAwBmJyZmclmMhlZVVUkEgna2dkZjEQiAU3TRF3XO9LptD44OOjl8/mueDyOSqXyMQBgAsCj+fn5m6lUCq1WC67rwnEcNBoNjzHWBCCcnp4iGo2GGGMwTVOKRqMNBmDAMIybuq7D8zy4rgvLssA5Ry6XYycnJyVBEL7Nzc0NHR4edgwPD3cfHBzEjo+Pb1AA4enpaS0cDmN3dxc7OzuwLAuWZSGdTvvn5+dVWZaD6+vrrZ6eHnDOQSntZYyl2NjYWNj3fba6uopSqQRRFOE4DiRJgiRJjmEYP4vF4veLi4tse3s7ms0m2traOACwo6OjDysrKyOu64a2t7eVRCLB9vf3Tyilec75ZwBfYrHYjCiKlqIoum3boJRyWZbBTNNcK5fLNc/zbgPQs9nscwCt5eXltXw+/2l0dPQhIeTX7Oxs2LZtVKtVVCoVJxKJlAMAHM75DwBNAFJfX1/XwMBAyjCMO41G40koFMqMj49nkslkV7VaRb1et2q1WpUx9p5d+bYfACK2bbdvbW15oigGp6ammKZpiizLoJTC87zS5uZmTRCElY2NjXeBK+XfANxisVjs7++/yzkP2rbNbdvmZ2dnbqFQOMjlci3P834mk8kXhULBJPiXcDmQQQD3R0ZGhgVBkCil3xRF6ZZl+aumaW+WlpZM/Ae7XJcO4DqA2OTk5K3L/B9/AC/yLV2VaX0EAAAAAElFTkSuQmCC").click(() => {
n.val(w.getDefault(e)), w.reset(e)
}),
i = $('<img class="timer-settings__button">').attr("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AQdFQkw+wQwyAAAAjdJREFUKM99kj1PFFEYhZ87995llv0YRXaWndXI4lLZGGxsqOhoaTAxNIZCxJjwMyjtKfkFhFhRWdkRKEg2xsTgbAGEdYdZPmZ25lpwlxCjvu29zzkn73kFfx8BKMAFCoAEcuAaSIAMyJ3/gOPAA6A+Pz//YnNz83Wz2azeExPKfhaAYyEFFIGHgN9qtZ4uLi5+qNfr38Iw/Gzds9XVVT2CtY04DpSso+/7/uzS0tLbqampapqmHaAMDIC00+kMHRvBtUATmAWeNxqNV8vLyx99339cqVTIsqwAFKenp0tra2u1MAyNsnAJqG1sbHwKguCJEEImSVJUSrmu615prcnzXAI6SRKnUql46+vrFyPnIvAIeCmEaE5MTNQ9zxtXSlEoFBBC3G2z2+2mW1tbP05PT1F2UQWg1O/301KppLXWADiOg+PcFmKMEYABODs7y/b39zP1R0XkeU6WZXfwv0ZKibLlJ0AspVR5nhNFEcYYpJRIKW+VhTAj0PM8MTc3V1D2Wq6A88FgcCiEaBhjlDFmrFwuu47jkCTJXbogCPTKyspT13V/juABcLK9vf0O8AF/cnLy2cLCwhsppRdFEUKIDEi11iYMw3hnZyeWVtEAQ3s9MXBxeXnZ63a7nSAI2tVqdUxr/X13d/dLv9/vHRwcnLdarUxZMLUJbiz8C+j3er3+3t7eSa1Wez8zMyPs2w0wbLfb6r5zbt1Tu8AEuI7juBdF0VfP866Pj48P4zi+AoZHR0c3vwHKutIiBFcXtAAAAABJRU5ErkJggg==").click(() => {
b.play(w.get(e))
});
s.append(t, i)
}
const n = $('<input type="text">');
return n.val(w.get(e) || "").change((function() {
w.set(e, this.value)
})), s.append(n), s
}
createSlider({
key: e,
label: t,
min: i,
max: s,
step: n
}) {
const o = $('<label class="timer-settings__label timer-settings__label--input">').text(t),
r = $('<input type="range">');
return r.attr({
min: i,
max: s,
step: n
}).val(w.get(e)).change((function() {
w.set(e, this.value)
})), o.append(r), o
}
loadElitesTab() {
const e = $('<div class="timer-elites"><header class="timer-elites__header"></header><section class="timer-elites__list"></section><form class="timer-elites__controls"><input type="text" class="timer-elites__input"> <input type="submit" class="timer-elites__submit" value="Dodaj elitÄÂĂÂ"></form></div>');
e.find(".timer-elites__header").append(this.createCheckbox({
key: "elitesFirst",
type: "checkbox",
label: "Zapisuj ubicia elit I"
}));
const t = e.find(".timer-elites__list");
this.updateElitesList(t), e.find(".timer-elites__controls").submit(i => {
i.preventDefault();
const s = e.find(".timer-elites__input").val();
return y.add(s) ? (this.updateElitesList(t), t.scrollTop(t[0].scrollHeight), window.message("Dodano elitÄ")) : window.message("Elita jest juĹź na liĹcie")
}), this.$content.html(e)
}
updateElitesList(e) {
e.html(""), f.forEach(t => e.append(this.createEliteField(t, !1, e))), y.userElites.forEach(t => e.append(this.createEliteField(t, !0, e)))
}
createEliteField(e, t, i) {
const s = $('<label class="timer-elites__elite">').text(e),
n = $('<input type="checkbox">').attr("checked", !y.isDisabled(e)).change((function() {
y.setState(e, !this.checked)
}));
if (s.prepend(n), t) {
const t = $('<div class="timer-elites__remove">');
t.click(() => {
y.remove(e), this.updateElitesList(i)
}), s.append(t)
}
return s
}
}
class k {
constructor(t) {
this.map = new Map, this.$wnd = $('<div class="timer"><div class="timer__empty">Minutnik</div><div class="timer__nodes"></div></div>'), this.$nodes = this.$wnd.find(".timer__nodes"), this.$empty = this.$wnd.find(".timer__empty"), e() || this.setupButtonsOld(), e() && this.$wnd.addClass("timer--ni"), this.registerKeyEvents(), this.initialSettings(), this.registerSettingsEvents(), e() || this.$wnd.appendTo("#centerbox2"), this.settingsWindow = null, this.timer = t
}
createNodeElem(t, i) {
const s = $('<div class="timer-node"><div class="timer-node__time"></div><div class="timer-node__name"></div><div class="timer-node__world"></div><div class="timer-node__controls"><div class="timer-node__arrow"></div><div class="timer-node__delete"></div></div></div>'),
o = n(i.expires - window.unix_time());
s.attr("data-expires", i.expires), s.find(".timer-node__time").text(o), s.find(".timer-node__name").text(i.name), s.find(".timer-node__world").text(i.world).toggle(i.world !== d()), s.find(".timer-node__arrow").click(() => r(i)), s.find(".timer-node__delete").click(() => this.timer.askDelete(t, i.name)), e() ? s.on("contextmenu", e => {
e.preventDefault(), r(i)
}) : s.rightClick(() => r(i)), this.$nodes.append(s), this.sortNodes(), this.map.set(t, s), this.toggleEmptyMessage()
}
updateNodeElem(e, t) {
const i = this.map.get(e);
i.find(".timer-node__time").text(n(t)), i.toggleClass("timer-node--after", t < 1), w.get("highlight") && i.toggleClass("timer-node--highlight", t > 0 && t <= w.get("highlightTime"))
}
removeNodeElem(e) {
this.map.get(e).remove(), this.map.delete(e), this.toggleEmptyMessage()
}
sortNodes() {
this.$nodes.children().sort((function(e, t) {
return e.dataset.expires - parseInt(t.dataset.expires)
})).appendTo(this.$nodes)
}
toggleEmptyMessage() {
this.$empty.toggle(0 === this.map.size)
}
setupButtonsOld() {
const e = $('<img class="timer__settings">').attr("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAPCAYAAADUFP50AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AQdFBw3UxcpSAAAAp1JREFUKM+dkl1IU3EYxn/ntOF2tjQxzWrWpi4XEWEUpJWyRXjRTW6W3vVBkPYBXlhXUUEFXmiEXZ2ii1ZZpHbTnREl6STQMkz68mNNK2XWcOk6ur/ndLNddNsL79XL8/xeHh7JMAz+Z0wAZQf2sq98ihcTgtCdKRlwApuBaGptQAyYeXK1TkRnDeS0w7ULYWvozpQL2JGdnX3uWXf3w0AgcMVisZxvbm5+4CkpOQIo/xDltWEAR3X1wWslm0oc70dGkllZWfbjx49VBPzV23Nz83JUVR0DKv0XHr0FpiXDMJAkSQIqm5qa2mpq/FuTS0kSiQRCCMxmM7Is86C9/WOhq1APBoNdX0ZHb6RfdVoslkP9oZC2sJAgHo8zPDy8fDcYXBx6O6RrmkbA7/e4XE533pq8XYDVlBLu7OzoOJqTk6PEYr8YHBwUFy9dDgNjnZ1dRddbW11ud/GKUH//776+UByQ08TFlpaW8NDQG6HrOp8+f54DngJNuq4/j0xG5k0mEx6PR6mqqloHONPCLy97er5PhL9qiqKwvbQ0Q1GUPMBnt9szKysqLEIIHOvXZ9TVHi4FNqbDKfB5vfcaGur3WK3WFbIsYxjGn/HxiW/uTe78rMxM+8zMDA2nTv+IxWIjmqZdTRPF6NjY+Kve3riq3koIIZAkyVpUVFi8LIQ9Go0C4PN6haZp94F36XDikUjkcVvbTa2gwLE/mUwWDwwMLNtsNpxOp3z6zNk5n8+rT05OTgMfgDlSXZWBlcAWh8PRXl9/8qfZbJ4oLy+P3r6lJm02Wy9wCagD8tXGWiTDMNh9ooD8VRpPWmcVoAzYBswDG4BcoBvoAzRgXm2sFSYA/YeTacKkDq+Bd8BSqptW4BcQVxtrjdzVEtFZg78ZdBbKMPDApQAAAABJRU5ErkJggg==").click(this.toggleSettingsWindow),
t = $('<img class="timer__add">').attr("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH5AQdFSocd3UrSgAAAdZJREFUKM+Vkz+LGlEUxX9vM390HHSVRaI2wXRCLAIbez9A2GIhhbYBG7+InyCVRbqQLUIqP0ISsQoGplmWBxOZMLhqxoyzyk6aK4ixyYPH48E997xzz3mKf5cBWEAGOAMegQ3wAOwOC58cARWQA54CFaAKuIAp4O0xy+FKpfh5s9m8LpfLF8vlMhyPxzfAH+D3KbCS0xbGl91u92273cbzPDqdzi0QAvdAsicypEFWGKtAC7jSWqee5ymtdQpcASsh+QlEQLwfThmoA5fAa6CVzWZxHAfbtpU0BDgHxsAtMFNACXjWaDR6/X7/TS6XyyulSJIE13UpFotEUcRms8EwjNVgMPgwmUzeAXeG2JG1LKvmOE7esiwcxyEIApIkIU1TarUaURSRyWTytm3XROaZIT7G8/ncH41GqyRJ8oVCgXq9TqlUIgxDptMpi8UC13VXs9nMB2Lg0ZAALLXWH7XWd3vNvV6PSqWC7/sMh0OAr8Bn0bwENoaY/0t8nAMLGc6rOI6VaZop8A14Lw32034wJHKR7HsJSn673baCIGC9XivgE/AF+HHoszqR7QrwolqtXpumebHb7ULf92+A78DsOMvHd1d8PwcckbMQaZG87CT4v37VX1hYsKX7PoKDAAAAAElFTkSuQmCC").click(() => this.timer.toggleAddWindow());
this.$wnd.append(e, t)
}
setupButtonsNew() {
const e = Engine.serverStorage.get(Engine.interface.getPathToHotWidgetVersion(), "timer-ni-si");
if (e) this.addWidgetButtonNew(e[0], e[1]);
else {
let e = Engine.interface.getFirstEmptyWidgetSlot();
const t = {
[Engine.interface.getPathToHotWidgetVersion()]: {
"timer-ni-si": [e.slot, e.container]
}
};
Engine.serverStorage.sendData(t, () => this.addWidgetButtonNew(e.slot, e.container))
}
}
addWidgetButtonNew(e, t) {
Engine.interface.addKeyToDefaultWidgetSet("timer-ni-si", e, t, "Minutnik <em>(PPM aby dodaÄ wpis)</em>", "red", () => this.toggleSettingsWindow()), Engine.interface.alreadyInitialised && Engine.interface.addWidgetButtons(), $(".main-buttons-container").on("contextmenu", ".widget-timer-ni-si", e => {
e.preventDefault(), this.timer.toggleAddWindow()
})
}
toggleSettingsWindow() {
this.settingsWindow || (this.settingsWindow = new x), this.settingsWindow.toggle()
}
registerKeyEvents() {
document.addEventListener("keydown", e => {
this.onActiveKey(e, !0)
}), document.addEventListener("keyup", e => {
this.onActiveKey(e, !1)
}), window.addEventListener("blur", e => {
w.get("alwaysActive") || this.$wnd.toggleClass("timer--active", !1)
})
}
onActiveKey(e, t = !0) {
["input", "textarea"].includes(e.target.tagName.toLowerCase()) || "ControlLeft" === e.code && (w.get("alwaysActive") || this.$wnd.toggleClass("timer--active", t))
}
initialSettings() {
this.$wnd.css({
fontSize: w.get("size") + "px",
opacity: w.get("opacity")
}), this.onFloating(w.get("floating")), this.onAlwaysActive(w.get("alwaysActive")), this.onMoveBookmarks(w.get("moveBookmarks"))
}
registerSettingsEvents() {
w.emitter.on("opacity", e => this.$wnd.css("opacity", e)), w.emitter.on("size", e => this.$wnd.css("fontSize", e + "px")), w.emitter.on("floating", e => this.onFloating(e)), w.emitter.on("alwaysActive", e => this.onAlwaysActive(e)), w.emitter.on("moveBookmarks", e => this.onMoveBookmarks(e))
}
onMoveBookmarks(t) {
e() || (t ? $("#bookmarks").css("left", "230px") : $("#bookmarks").css("left", 0))
}
onFloating(t) {
if (t) {
e() && this.$wnd.detach().appendTo(".alerts-layer");
const {
x: t,
y: i
} = w.get("floatingPos");
this.$wnd.draggable({
containment: "body",
cancel: ".timer__settings, .timer__add",
start: () => {
m().add("timer-draggable")
},
stop: (e, t) => {
m().remove("timer-draggable"), w.set("floatingPos", {
x: t.position.left,
y: t.position.top
})
}
}).addClass("timer--floating").css({
top: i + "px",
left: t + "px"
}), $("body").css("height", "100vh")
} else {
if (e() && this.$wnd.detach().appendTo(".game-layer"), !this.$wnd.is(":ui-draggable")) return;
this.$wnd.draggable("destroy").css({
left: 0,
top: 0
}).removeClass("timer--floating"), w.set("floatingPos", {
x: 0,
y: 0
}), $("body").css("height", "none")
}
}
onAlwaysActive(e) {
this.$wnd.toggleClass("timer--active", e)
}
}
class _ {
constructor(e) {
this.timer = e, this.lock = m()
}
toggle() {
this.$wnd ? (this.resetInputs(), this.$wnd.toggle()) : this.init(), this.toggleLock()
}
toggleLock() {
this.lock.check("timer-add") ? this.lock.remove("timer-add") : this.lock.add("timer-add")
}
init() {
this.$wnd = $('<div class="timer-add"><form class="timer-add__form"><input type="number" min="0" placeholder="HH" name="hours"> : <input type="number" min="0" max="60" placeholder="MM" name="minutes"> : <input type="number" placeholder="SS" name="seconds"> <input type="text" placeholder="Nazwa" name="name" minlength="3" maxlength="50" required> <input type="submit" value="Dodaj"></form><button class="timer-add__close">Anuluj</button></div>'), this.$wnd.find(".timer-add__form").submit(e => this.onSubmit(e)), this.$wnd.find(".timer-add__close").click(() => this.toggle()), this.$wnd.appendTo(e() ? ".alerts-layer" : "body"), e() ? this.center() : this.$wnd.absCenter()
}
onSubmit(e) {
const t = new FormData(e.target),
i = Object.fromEntries(t);
this.addNode(i), window.message("Dodano nowy wpis"), this.$wnd.toggle(), this.toggleLock(), e.preventDefault()
}
addNode({
hours: e,
minutes: t,
seconds: i,
name: s
}) {
const n = 3600 * e + 60 * t + +i,
o = a({
name: s,
world: d()
}),
r = {
name: s,
expires: window.unix_time() + n
};
this.timer.addNode(o, r)
}
resetInputs() {
this.$wnd.find('input[type="text"], input[type="number"]').val("")
}
center() {
var e = $("body").width(),
t = $("body").height();
let i = e / 2 - this.$wnd.outerWidth() / 2,
s = t / 2 - this.$wnd.outerHeight() / 2;
i < 0 && (i = 0), s < 0 && (s = 0), this.$wnd.css({
top: s + "px",
left: i + "px"
})
}
}
window.Timer = new class {
constructor() {
this.nodes = null, this.lastTs = 0, this.crossStorage = e() ? Engine.crossStorage : g.crossStorage, this.widget = new k(this), p('.timer-add{position:absolute;box-shadow:0 0 0 1px #010101,0 0 0 2px #ccc,0 0 0 3px #0c0d0d,2px 2px 3px 3px rgba(12,13,13,.4);border-radius:2px;background:rgba(0,0,0,.7);z-index:460;padding:4px;pointer-events:auto}.timer-add,.timer-add .timer-add__form{display:flex;align-items:center}.timer-add .timer-add__form *{margin:0 .2em}.timer-add input[type=number]{width:3em}.timer-add input[type=number],.timer-add input[type=text]{border:0;background:none;border:1px solid hsla(0,0%,100%,.3);color:#fff;padding:5px}.timer{position:absolute;color:#fff;font-size:15px;z-index:340;font-family:sans-serif;background:linear-gradient(90deg,rgba(0,0,0,.8) 0,rgba(0,0,0,.8) 40%,transparent);opacity:.7;pointer-events:none;display:inline-block}.timer--ni:not(.timer--floating){padding-left:5px}.timer__empty{padding:5px 20px;color:grey;font-weight:700;display:none}.timer:not(.timer--floating) .timer__empty{display:none!important}.timer-node{padding:3px 6px;cursor:default;text-transform:uppercase;color:#91ffed;transition:color 1s;display:flex;max-width:200px;align-items:center;font-weight:700}.timer-node--after{color:#ff0}.timer-node--highlight .timer-node__time{color:orange}.timer-node__time{font-variant-numeric:tabular-nums}.timer-node__world{font-size:.7em;font-weight:400}.timer-node__world:before{content:"("}.timer-node__world:after{content:")"}.timer-node__name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:0 .3em}.timer--floating{box-shadow:0 0 0 1px #010101,0 0 0 2px #ccc,0 0 0 3px #0c0d0d,2px 2px 3px 3px rgba(12,13,13,.4);border-radius:2px;background:rgba(0,0,0,.7);z-index:460}.timer--floating .timer__empty{display:block}.timer__settings{position:absolute;width:20px;height:20px;cursor:pointer;left:-32px;top:-30px;pointer-events:all}.timer--floating .timer__settings{top:-25px;left:0}.timer__add{width:20px;height:20px;position:absolute;cursor:pointer;pointer-events:all;top:-30px;left:-52px}.timer--floating .timer__add{top:-25px;left:22px}.timer--active{pointer-events:all;opacity:1!important}.timer--active .timer-node{max-width:none!important}.timer-node__delete{cursor:pointer;position:relative;width:.7em;height:.7em;padding-top:2px}.timer-node__delete:before{transform:rotate(45deg)}.timer-node__delete:after{transform:rotate(-45deg)}.timer-node__delete:after,.timer-node__delete:before{position:absolute;left:.5em;content:" ";height:.7em;width:2px;background-color:red}.timer-node__arrow{padding:0 .2em;cursor:pointer;position:relative;display:block;height:.9em;color:#fff;line-height:.85em}.timer-node__arrow:before{content:"\\203A\\203A"}.timer-node__controls{display:none;margin-left:auto;padding-left:.5em;align-items:center}.timer-node__controls div{margin:0 .2em}.timer--active .timer-node__controls{display:flex}.widget-button .timer-ni-si{background:url(../img/gui/addons-icons.png);background-position:-438px -3px}'), this.registerGameEvents(), this.registerResetTitleEvent(), this.preloadAudio(), this.initNodes(), this.checkFirstRun()
}
update() {
const e = window.unix_time();
if (e <= this.lastTs) return;
this.lastTs = e;
let t = null;
var i, s;
this.nodes.forEach((i, s) => {
(!t || i.expires < t.expires) && (t = i), this.updateNode(s, i, e)
}), w.get("title") && document.hidden && (t ? (i = t.expires - e, s = t.name, document.title = `${n(i)} ${s}`) : o())
}
updateNode(e, t, i) {
const s = t.expires - i;
if (this.widget.updateNodeElem(e, s), s < -w.get("deleteTime")) return this.deleteNode(e);
w.get("highlight") && w.get("alertHighlight") && s == w.get("highlightTime") && b.play(w.get("alertHighlightUrl"))
}
deleteNode(e) {
this.nodes.has(e) && (this.widget.removeNodeElem(e), this.nodes.delete(e), this.save())
}
addNode(e, t) {
this.nodes.has(e) && this.deleteNode(e), t = {
...t,
aid: l(),
cid: c(),
world: d()
}, this.widget.createNodeElem(e, t), this.nodes.set(e, t), this.save()
}
registerGameEvents() {
e() ? (API.addCallbackToEvent("newNpc", e => {
this.onRespawn(e.d.id, e.d)
}), API.addCallbackToEvent("removeNpc", e => {
i(e.d) && this.onKill(e.d)
})) : t(window, "newNpc", t => {
for (let s in t) !t[s].del || !isset(g.npc[s]) || (e() ? Engine.hero.d.stasis : hero.stasis) || window.isset(g.gameLoader) && !1 === g.gameLoader.steps.map.status || !i(g.npc[s]) ? isset(g.npc[s]) || this.onRespawn(s, t[s]) : this.onKill(g.npc[s])
})
}
onKill(e) {
if (!s(e.wt) && !this.canAddEliteFirst(e)) return;
const t = a({
id: e.id,
world: d()
}),
i = ((e, t) => {
const i = e > 200 ? 18 : .7 + .18 * e - 45e-5 * e * e;
return Math.round(60 * i * 1 / t)
})(e.lvl, w.get("multiplier")),
n = {
name: e.nick,
expires: window.unix_time() + i
};
this.addNode(t, n)
}
onRespawn(e, t) {
(s(t.wt) || this.canAddEliteFirst(t)) && (w.get("alertRespawn") && b.play(w.get("alertRespawnUrl")), this.deleteNode(a({
id: e,
world: d()
})))
}
save() {
const e = JSON.stringify(Array.from(this.nodes));
this.crossStorage.set("timer/nodes", e)
}
initNodes() {
this.crossStorage.storage.onConnect().then(() => this.crossStorage.get("timer/nodes")).then(t => {
this.nodes = new Map(JSON.parse(t)), e() ? this.start() : g.loadQueue.push({
fun: () => this.start()
})
})
}
start() {
this.nodes.forEach((e, t) => this.widget.createNodeElem(t, e)), this.interval = setInterval(() => {
this.update()
}, 1e3)
}
canAddEliteFirst(e) {
return (t = e.wt) > 9 && t < 20 && w.get("elitesFirst") && y.check(e.nick);
var t
}
askDelete(e, t) {
h(`Chcesz usunÄ
Ä "${t}" z Minutnika?`, [() => this.deleteNode(e), () => {}])
}
checkFirstRun() {
if (!w.get("firstRun")) return;
h("Uruchamiasz Minutnik po raz pierwszy. Chcesz otworzyÄ okienko konfiguracji?", [() => this.widget.toggleSettingsWindow(), () => {}]), w.set("firstRun", !1), e() || window.deleteCookie("timer/nodes")
}
toggleAddWindow() {
this.addWindow || (this.addWindow = new _(this)), this.addWindow.toggle()
}
registerResetTitleEvent() {
window.addEventListener("focus", () => {
w.get("title") && o()
})
}
preloadAudio() {
w.get("alertRespawn") && b.load(w.get("alertRespawnUrl")), w.get("alertHighlight") && b.load(w.get("alertHighlightUrl"))
}
}, e() && (async () => {
for (; !Engine.interfaceStart;) await new Promise(e => setTimeout(e, 100));
window.Timer.widget.setupButtonsNew()
})()
}();
To share this paste please copy this url and send to your friends
RAW Paste Data