Last active
March 5, 2019 20:40
-
-
Save d0peCode/d01931da5fdeaf140f601fb93a287f3e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//miniupdate: respy herosĂłw, usuniÄto wsync z ustawieĹ bo juĹź nie istnieje, poprawne pokazywanie klanĂłw na NI, baza respĂłw herosĂłw jest teraz dostÄpna dla innych skryptĂłw | |
//3.2 | |
//-(SI) ppm na gracza na minimapie -> menu takie jakie by siÄ otworzyĹo po klikniÄciu na mapie | |
//-kompatybilnoĹÄ z dodatkiem ccarderra pokazujÄ cym graczy z innych ĹwiatĂłw | |
//-naprawiony bug z grobami | |
//3.1.9b - nowe respy | |
//3.1.9 - oczywiĹcie Ĺźe 3.1.8 coĹ popsuĹo :^) | |
//3.1.8 - uzupeĹniono elity do questa dziennego na .com | |
//3.1.7 - czemu kaĹźdÄ aktualizacjÄ coĹ psujÄ | |
//3.1.6 - to coĹ z cookie __mExts i kompatybilnoĹÄ z jednÄ rzeczÄ ktĂłrÄ robiÄ (w wersji 2.x byĹa ale zapomniaĹem robiÄ c 3.0) | |
//3.1.5 - wersja na stary silnik xd | |
//3.1.4 - ciÄ gle coĹ psujÄ | |
//3.1.3 - ._.' warto uĹźywaÄ isset | |
//3.1.2 - zmiany w chodzeniu postaci po klikniÄciu punktu na mapie (teraz moze iĹÄ gdziekolwiek sie kliknie), optymalizacje dla urzÄ dzeĹ mobilnych (toucheventy majÄ mniejsze opóźnienie) | |
//3.1.1 - naprawa gĹupiego bĹÄdu prezez ktĂłry minimapa psuĹa grÄ | |
//3.1 - pokazywanie qm przy npc na minimapie, poprawione wartoĹci przy ktĂłrych elementy dolnego paska sÄ chowane, licznik instalacji (przez dislike niepublicznego dodatku) | |
//3.0 - dodatek napisany od nowa | |
window.miniMapPlus = new (function() { | |
var interface = (function() { | |
if (typeof API != "undefined" && typeof Engine != "undefined" && typeof margoStorage == "undefined") { | |
return "new"; //NI | |
} else if (typeof dbget == "undefined" && typeof proceed == "undefined") { | |
return "old"; //SI | |
} else { | |
return "superold"; //Stary silnik | |
}; | |
})(); | |
var self = this; | |
var masks = ["obj/cos.gif", "mas/nic32x32.gif", "mas/nic64x64.gif"]; | |
var gws = ["mas/exit-ith.gif", "mas/exit-ith1.gif", "mas/exit.gif", "mas/drzwi.gif", "obj/drzwi.gif"]; | |
var oldPos = {x: -1, y: -1}; | |
var otherRanks = ["Administrator", "Super Mistrz Gry", "Mistrz Gry", "Moderator Chatu", "Super Moderator Chatu"]; | |
var $map, | |
$wrapper, | |
$info, | |
$search, | |
$userStyle, | |
objScale, | |
objSize, | |
$chatInput, | |
$searchTxt; | |
var search = { | |
type: "", | |
data: "" | |
}; | |
var manualMode = false; | |
var innerDotKeys = ["friend", "enemy", "clan", "ally"]; | |
this.version = "3.2"; | |
var settings = new (function() { | |
var path = "mmp"; | |
var Storage = interface != "old" ? API.Storage : margoStorage; | |
this.set = function(p, val) { | |
Storage.set(path + p, val); | |
}; | |
this.get = function(p) { | |
return Storage.get(path + p); | |
}; | |
this.remove = function(p) { | |
try { | |
Storage.remove(path + p); | |
} catch (e) {}; | |
}; | |
this.exist = function() { | |
return Storage.get(path) != null; | |
}; | |
})(); | |
var mobileDevice = (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || settings.get("/forceMobileMode")); | |
this.initSettings = function() { | |
if (!settings.exist()) { | |
this.setDefaultSettings(); | |
} else { | |
this.fixSettings(); | |
}; | |
}; | |
this.fixSettings = function() { | |
var loaded = settings.get(""); | |
var def = this.getDefaultSettings(); | |
var overwrite = false; | |
for (var key in def) { | |
if (!isset(loaded[key])) { | |
loaded[key] = def[key]; | |
overwrite = true; | |
}; | |
}; | |
if (overwrite) settings.set("", loaded); | |
}; | |
this.setDefaultSettings = function() { | |
settings.set("", this.getDefaultSettings()); | |
}; | |
this.convertOldSettings = function(json) { | |
var sett = JSON.parse(json); | |
sett.darkmode = false; | |
sett.altmobilebtt = false; | |
sett.mapsize = 1; | |
sett.minlvl = parseInt(sett.minlvl); | |
sett.opacity = 1 - sett.opacity; | |
if (isNaN(sett.minlvl)) sett.minlvl = 1; | |
localStorage.removeItem("miniMapPlus"); | |
return sett; | |
}; | |
this.getDefaultSettings = function() { | |
var oldVersion = localStorage.getItem("miniMapPlus"); | |
if (oldVersion) return this.convertOldSettings(oldVersion); | |
return { | |
show: 82, | |
minlvl: "1", | |
colors: { | |
hero: "#FF0000", | |
other: "#FFFFFF", | |
friend: "#08ad00", | |
enemy: "#FF0000", | |
clan: "#08ad00", | |
ally: "#9eff91", | |
npc: "#ddff00", | |
mob: "#222222", | |
elite: "#00ffe9", | |
elite2: "#039689", | |
elite3: "#007500", | |
heros: "#c6ba35", | |
titan: "#809912", | |
item: "#f56bff", | |
gw: "#0000FF", | |
}, | |
trackedNpcs: [], | |
trackedItems: [], | |
maxlvl: 13, | |
mapsize: 1, | |
opacity: 1, | |
interpolerate: true, | |
darkmode: false, | |
showqm: true, | |
showevonetwork: true | |
}; | |
}; | |
this.getInstallSource = function() { | |
if (interface != "old") return "addon"; | |
var panelAddons = getCookie("__mExts"); | |
if (panelAddons == null) return "addon"; | |
var srcs = { | |
p: "panel dodatkĂłw (pub.)", | |
d: "dev", | |
v: "panel dodatkĂłw" | |
}; | |
for (var i in srcs) { | |
if (panelAddons.indexOf(i+"64196") > -1) return srcs[i]; | |
}; | |
return "addon"; | |
}; | |
this.initHTML = function() { | |
$wrapper = document.createElement("div"); | |
$wrapper.classList.add("mmpWrapper"); | |
$map = document.createElement("div"); | |
$map.classList.add("mmpMap"); | |
if (!mobileDevice) $map.addEventListener("click", this.goTo); | |
else $map.addEventListener("touchstart", this.goTo); | |
$map.addEventListener("contextmenu", this.rclick); | |
var $bottombar = document.createElement("div"); | |
$bottombar.classList.add("mmpBottombar"); | |
$info = document.createElement("span"); | |
$info.innerHTML = "miniMapPlus by <a href='https://www.margonem.pl/?task=profile&id=3779166' target='_blank'>Priweejt</a> | "; | |
$bottombar.appendChild($info); | |
$searchTxt = document.createElement("span"); | |
$searchTxt.innerHTML = "Szukaj: "; | |
$bottombar.appendChild($searchTxt); | |
$search = document.createElement("input"); | |
$search.addEventListener("keyup", this.searchBarHandler); | |
$bottombar.appendChild($search); | |
var $settings = document.createElement("img"); | |
$settings.src = "http://i.imgur.com/S7FugOv.png"; | |
$settings.classList.add("mmpSettingIcon"); | |
$settings.addEventListener("click", niceSettings.toggle); | |
$settings.setAttribute(interface == "new" ? "data-tip" : "tip", "Ustawienia"); | |
$bottombar.appendChild($settings); | |
$wrapper.appendChild($map); | |
$wrapper.appendChild($bottombar); | |
if (interface == "new") document.querySelector(".game-window-positioner").appendChild($wrapper); | |
else if (interface == "old") document.querySelector("#centerbox2").appendChild($wrapper); | |
else document.querySelector("body").appendChild($wrapper); | |
this.appendMainStyles(); | |
this.initEventListener(); | |
}; | |
this.appendMobileButton = function() { | |
if (interface == "old" && mobileDevice) { | |
//przycisk otwierania mapy dla urzÄ dzeĹ mobilnych | |
var $btt = document.createElement("div"); | |
$btt.innerHTML = "MM+"; | |
$btt.classList.add("mmpMobileButton"); | |
$btt.addEventListener("touchstart", event => { | |
self.toggleView(); | |
event.preventDefault(); | |
}); | |
document.getElementById("centerbox2").appendChild($btt); | |
}; | |
}; | |
this.initEventListener = function() { | |
document.addEventListener("keydown", function(e) { | |
if (e.target.tagName != "INPUT" && e.target.tagName != "TEXTAREA" && e.keyCode == settings.get("/show")) { | |
self.toggleView(); | |
}; | |
}, false); | |
}; | |
this.appendMainStyles = function() { | |
var $style = document.createElement("style"); | |
var css = ` | |
.mmpMobileButton { | |
z-index: 390; | |
border: 1px solid black; | |
opacity: 0.7; | |
background: white; | |
position: absolute; | |
top: 240px; | |
left: -1px; | |
width: 32px; | |
height: 32px; | |
color: gray; | |
text-align: center; | |
line-height: 32px; | |
font-size: 80%; | |
border-radius: 3px; | |
border-top-right-radius: 8px; | |
} | |
.mmpWrapper { | |
position: absolute; | |
z-index: 380; | |
border: 3px solid black; | |
border-radius: 5px; | |
border-bottom-left-radius: 20px; | |
overflow: hidden; | |
display: none; | |
} | |
.mmpWrapper .mmpMap { | |
overflow: hidden; | |
background-size: 100%; | |
} | |
.mmpWrapper .mmpBottombar { | |
height: 19px; | |
background: #CCCCCC; | |
border-top: 1px solid black; | |
color: #232323; | |
padding-left: 8px; | |
line-height: 19px; | |
} | |
.mmpWrapper .mmpBottombar input { | |
height: 11px; | |
width: 130px; | |
} | |
.mmpWrapper .mmpBottombar .mmpSettingIcon { | |
height: 15px; | |
width: 15px; | |
float: right; | |
background: rgba(100,100,100,.8); | |
border-radius: 5px; | |
cursor: pointer; | |
margin-top: 2px; | |
} | |
.mmpMapObject { | |
position: absolute; | |
} | |
.mmpMapObject.hidden { | |
display: none; | |
} | |
.mmpMapObject.hiddenBySearch { | |
display: none; | |
} | |
.mmpMapObject .innerDot{ | |
position: absolute; | |
} | |
.mmpMapObject.evoNetwork { | |
opacity: 0.5 !important; | |
} | |
`; | |
$style.innerHTML = css; | |
document.head.appendChild($style); | |
}; | |
this.onSettingsUpdate = function() { | |
self.appendUserStyles(); | |
self.objectMgr.manageDisplay(); | |
self.resetQtrack(); | |
message("<span style='color:white;'>Zapisano</span>"); | |
}; | |
this.appendUserStyles = function() { | |
if (!$userStyle) { | |
$userStyle = document.createElement("style"); | |
document.head.appendChild($userStyle); | |
}; | |
$userStyle.innerHTML = this.generateUserCss(); | |
}; | |
this.generateUserCss = function() { | |
var css = ""; | |
var colors = settings.get("/colors"); | |
for (var name in colors) { | |
css += this.getSingleCssLine(name, colors[name]); | |
}; | |
css += ".mmpWrapper { opacity: "+settings.get("/opacity")+"; }\n" | |
if (settings.get("/interpolerate")) css += ".mmpMapObject { transition: all .5s ease-in-out; }\n"; | |
if (settings.get("/darkmode")) { | |
css += ".mmpWrapper .mmpBottombar { background: #222222; color: #CCCCCC; }\n"; | |
css += ".mmpWrapper .mmpBottombar input {background: black; border: 1px solid #333333; color: white;}\n"; | |
css += ".mmpWrapper .mmpBottombar a {color: #009c9c;}\n" | |
css += ".mmpMobileButton {background: #222222; color: #CCCCCC;}\n" | |
}; | |
if (settings.get("/altmobilebtt")) { | |
css += ".mmpMobileButton { top: 470px; left: 665px; }\n"; | |
}; | |
if (!settings.get("/showqm")) { | |
css += ".mmpQM { display: none; }"; | |
} else { | |
css += ".mmpQM { display: block; position: absolute; top: -200%;}"; | |
}; | |
return css; | |
}; | |
this.getSingleCssLine = function(name, val) { | |
if (innerDotKeys.indexOf(name) > -1) { | |
return ".mmpMapObject .innerDot.mmp-"+name+" { background: "+val+";}\n"; | |
} else { | |
return ".mmpMapObject.mmp-"+name+" { background: "+val+";}\n"; | |
}; | |
}; | |
//functionality | |
this.rclick = function(e) { | |
if (interface != "old") return; //TODO: support other interfaces | |
var tar = false | |
if (e.target.classList.contains("mmp-other")) tar = e.target; | |
else if (e.target.parentElement.classList.contains("mmp-other")) tar = e.target.parentElement; //for others with innerdot | |
if (tar) { | |
var obj = self.objectMgr.getByElem(tar); | |
if (obj.d.evoNetwork) return; | |
var id = obj.d.id; | |
id = id.split("-")[1]; //id = OTHER-rid, where rid = char id of the other player | |
var $other = document.querySelector("#other"+id); | |
//hacky solution | |
var sm = window.showMenu; | |
var otherMenu = false; | |
window.showMenu = function(e, menu) { | |
otherMenu = menu; | |
window.showMenu = sm; | |
}; | |
$other.click(); | |
if (otherMenu) { | |
for (var i in otherMenu) { | |
//idk it doesn't hide automatically for whatever reason (I mean it does, but only after it has been clicked 2 times) | |
otherMenu[i][1] += ";hideMenu();"; | |
}; | |
window.showMenu(e, otherMenu, true); | |
}; | |
e.preventDefault(); | |
}; | |
}; | |
this.goTo = function() { | |
if (e.type == "touchstart") { | |
var offsets = self.getOffsets(e.target); | |
e.offsetX = e.touches[0].pageX - offsets[0]; | |
e.offsetY = e.touches[0].pageY - offsets[1]; | |
e.stopPropagation(); | |
}; | |
var coords = { x: 25, y: 25}; | |
if (interface == "new") { | |
Engine.hero.autoGoTo({x: coords.x, y: coords.y}); | |
} else if (interface == "old") { | |
self.searchPath.call(window.hero, coords.x, coords.y); | |
} else { | |
self.oldMargoGoTo(coords.x, coords.y); | |
}; | |
}; | |
this.oldMargoGoTo = function(x, y) { | |
//window,hero.setMousePos(x*32,y*32); | |
window.hero.mx = x; | |
window.hero.my = y; | |
window.global.movebymouse = true; | |
this.cancelMouseMovement = true; | |
}; | |
this.getCoordsFromEvent = function(e) { | |
if (e.target == $map) { | |
return { | |
x: Math.round(e.offsetX/(objScale*32)), | |
y: Math.round(e.offsetY/(objScale*32)) | |
}; | |
} else { | |
var obj = this.objectMgr.getByElem(e.target); | |
return { | |
x: obj.d.x, | |
y: obj.d.y | |
}; | |
}; | |
}; | |
this.getOffsets = function($el, offs) { | |
var offsets = offs ? offs : [0,0]; | |
offsets[0] += $el.offsetLeft; | |
offsets[1] += $el.offsetTop; | |
if ($el.parentElement != null) { | |
this.getOffsets($el.parentElement, offsets); | |
}; | |
return offsets; | |
}; | |
this.searchBarHandler = function(e) { | |
//keyup event handler | |
var input = $search.value; | |
var noSpace = input.replace(/ /g, ""); | |
self.objectMgr.resetSearch(); | |
if (/([0-9]+)-([0-9]+)/.test(noSpace)) { | |
self.parseRangeSearch(noSpace); | |
} else if (/([0-9]+),([0-9]+)/.test(noSpace)) { | |
self.parseCoordSearch(noSpace); | |
} else { | |
self.parseStringSearch(input); | |
}; | |
}; | |
this.parseRangeSearch = function(str) { | |
var nums = str.split("-"); | |
this.objectMgr.filterByLvl(parseInt(nums[0]), parseInt(nums[1])); | |
}; | |
this.parseCoordSearch = function(str) { | |
var coords = str.split(","); | |
this.objectMgr.createCoordMarker(parseInt(coords[0]), parseInt(coords[1])); | |
}; | |
this.parseStringSearch = function(str) { | |
this.objectMgr.filterByString(str); | |
}; | |
this.makeTip = function(data) { | |
var tip = data.nocenter ? "" : "<center>"; | |
tip += data.txt+"<div style='text-align: center;color: gray'>("+data.x+","+data.y+")</div>"; | |
return tip + (data.nocenter ? "" : "</center>"); | |
}; | |
this.toggleView = function() { | |
$wrapper.style["display"] = $wrapper.style["display"] == "block" ? "none" : "block"; | |
}; | |
this.initResponseParser = function() { | |
if (interface == "new") { | |
API.priw.emmiter.on("before-game-response", data => { | |
if (!manualMode) this.parseInput(data); | |
}) | |
} else if (interface == "old") { | |
var _parseInput = parseInput; | |
parseInput = function(data) { | |
if (!manualMode) self.parseInput(data); | |
return _parseInput.apply(this, arguments); | |
}; | |
} else { | |
API.emmiter.on("response", data => { | |
if (!manualMode) self.parseInput(self.parseOldMargonemData(data)); | |
}) | |
}; | |
}; | |
self.arr2obj = function(arr) { | |
var ret = {}; | |
for (var i=0; i<arr.length; i++) { | |
ret[arr[i].id] = arr[i]; | |
}; | |
return ret; | |
}; | |
self.parseOldMargonemData = function(data) { | |
//data.gw2 = []; | |
//data.townname = {}; | |
/*if (data.elements) { | |
if (data.elements.npc) Object.assign(data.npc, this.arr2obj(data.elements.npc)); | |
if (data.elements.other) Object.assign(data.other, this.arr2obj(data.elements.other)); | |
} | |
if (data.delete) { | |
if (data.delete.npc) Object.assign(data.npc, this.arr2obj(data.delete.npc)); | |
if (data.delete.other) Object.assign(data.other, this.arr2obj(data.delete.other)); | |
} | |
if (data.othermove) { | |
Object.assign(data.other, this.arr2obj(data.othermove)); | |
console.log(data.othermove); | |
};*/ | |
return data; | |
}; | |
this.enableManualMode = function() { //tryb w ktĂłrym ignoruje wszystkie dane z silnika gry; na potrzeby mojego dodatku klanowego | |
manualMode = true; | |
}; | |
this.disableManualMode = function() { | |
manualMode = false; | |
}; | |
this.parseInput = function(data) { | |
for (var i in data) { | |
if (typeof this.eventHandlers[i] == "function") this.eventHandlers[i](data[i]); | |
}; | |
if (data.townname) this.eventHandlers.gateways(data.gw2, data.townname); | |
}; | |
this.eventHandlers = { | |
town: function(town) { | |
self.loadMap(town); | |
}, | |
npc: function(npc) { | |
self.parseNpc(npc); | |
}, | |
gateways: function(gws, townname) { | |
self.parseGws(gws, townname); | |
}, | |
other: function(others) { | |
self.parseOther(others); | |
}, | |
item: function(items) { | |
self.parseItem(items); | |
}, | |
rip: function(rip) { | |
self.parseRip(rip); | |
} | |
}; | |
this.resetQtrack = function() { | |
qTrack.reset(); | |
var npc = settings.get("/trackedNpcs"); | |
for (var i=0; i<npc.length; i++) { | |
qTrack.add({ | |
type: "NPC", | |
name: npc[i] | |
}); | |
}; | |
var item = settings.get("/trackedItems"); | |
for (i=0; i<item.length; i++) { | |
qTrack.add({ | |
type: "ITEM", | |
name: item[i] | |
}); | |
}; | |
}; | |
this.loadMap = function(town) { | |
if (interface == "superold") town.file = town.img; | |
this.resetQtrack(); | |
this.objectMgr.deleteAll(); | |
var mapsize = interface == "new" ? 700 : 440; | |
mapsize = mapsize*settings.get("/mapsize"); | |
if (town.x > town.y) { | |
var height = Math.floor(town.y/town.x * mapsize); | |
var width = mapsize; | |
} else { | |
var width = Math.floor(town.x/town.y * mapsize); | |
var height = mapsize; | |
}; | |
objScale = width/(town.x*32); | |
objSize = Math.round(objScale*32); | |
var left = 0; | |
var top = 0; | |
if (interface != "new") { | |
top = -30; | |
left = -144; | |
}; | |
Object.assign($wrapper.style, { | |
//$map will stretch the $wrapper | |
//width: width + "px", | |
//height: (height+20) + "px", | |
left: "calc(50% - "+(width/2 - left)+"px)", | |
top: "calc(50% - "+(height/2 - top)+"px)" | |
}); | |
Object.assign($map.style, { | |
width: width + "px", | |
height: height + "px", | |
}); | |
if (width < 385) $info.style["display"] = "none"; | |
else $info.style["display"] = "inline-block"; | |
if (width < 210) $searchTxt.style["display"] = "none"; | |
else $searchTxt.style["display"] = "inline-block"; | |
this.loadMapImg(town.file); | |
if (interface != "superold") { | |
this.addSpawnsToMap(herosDB, true, town.name, town.id); | |
this.addSpawnsToMap(eliteDB, false, town.name, town.id); | |
}; | |
}; | |
this.loadMapImg = function(file) { | |
$map.style["background-image"] = ""; | |
$map.style["background"] = "#444444"; | |
var miniMapImg = new Image(); | |
if (file.indexOf("http") == -1) { | |
var mpath = interface == "old" ? g.mpath : "/obrazki/miasta/"; | |
miniMapImg.src = (interface == "superold" ? "http://oldmargonem.pl" : "") + mpath + file; | |
} else { | |
miniMapImg.src = file; | |
}; | |
miniMapImg.onload = function() { | |
$map.style["background"] = ""; | |
$map.style["background-image"] = "url("+miniMapImg.src+")"; | |
}; | |
}; | |
this.parseNpc = function(npcs) { | |
for (var id in npcs) { | |
var npc = npcs[id]; | |
if (!npc.del) { | |
this.addNewNpcToMap(npc, id); | |
} else { | |
this.objectMgr.updateObject({ | |
id: "NPC-"+id, | |
del: 1 | |
}); | |
if (npcTrack[id]) { | |
qTrack.remove({ | |
type: "NPC", | |
nick: npcTrack[id].nick | |
}); | |
delete npcTrack[id]; | |
}; | |
}; | |
}; | |
}; | |
this.addNewNpcToMap = function(npc, id) { | |
var {type, flash} = this.getNpcType(npc, id); | |
if (type == undefined) return; | |
var {tip, ctip} = this.getNpcTip(npc, type, flash); | |
var data = { | |
id: "NPC-"+id, | |
type: type, | |
flash: flash, | |
tip: tip, | |
ctip: ctip, | |
x: npc.x, | |
y: npc.y, | |
qm: npc.qm || (npc.actions && npc.actions & 128) | |
}; | |
if (type != "npc" && type != "gw" && type != "item") { | |
data.lvl = npc.lvl; | |
}; | |
this.objectMgr.updateObject(data) | |
}; | |
this.getNpcTip = function(npc, type, important) { | |
var tip = ""; | |
var mask = false; | |
for (var i=0; i<masks.length; i++) { | |
if (masks[i].indexOf(npc.icon) > -1) mask = true; | |
}; | |
if (!mask) tip += "<img src='"+this.npcIconHTML(npc.icon)+"'>"; | |
var ctip = "t_npc"; | |
if (type == "gw") { | |
ctip = false; | |
tip = this.makeTip({ | |
txt: npc.nick + "<br>", | |
x: npc.x, | |
y: npc.y | |
}) | |
} else if (type == "item") { | |
ctip = "t_item"; | |
tip = this.makeTip({ | |
x: npc.x, | |
y: npc.y, | |
txt: tip + "<br>" + npc.nick | |
}) | |
} else { | |
tip = this.normalNpcTip(npc, type, important, tip); | |
}; | |
return { | |
tip: tip, | |
ctip: ctip | |
} | |
}; | |
this.npcIconHTML = function(icon) { | |
if (icon.indexOf("://") > -1 || icon.indexOf("obrazki/") > -1) return icon; //zapomniaĹem o kompatybilnoĹci z jednÄ rzeczÄ ktĂłrÄ robiÄ xd | |
else if (interface == "superold") return "http://oldmargonem.pl/obrazki/npc/"+icon; | |
else return (interface == "old" ? g.opath : "/obrazki/")+"npc/"+icon; | |
}; | |
this.oldNpcTip = function(npc, type, eve) { | |
var icon = npc.icon; | |
npc.icon = "kappa"; | |
if (type == "elite2" && !eve) { | |
npc.wt = 30; | |
}; | |
if (!g.tips.npc) newNpc(); | |
var tip = g.tips.npc(npc); | |
if (type == "elite2") { | |
if (!eve) { | |
npc.wt = 20; | |
tip = tip.replace("elita III", "elita II"); | |
} else { | |
tip = tip.replace("elita", "specjalna elita"); | |
}; | |
}; | |
npc.icon = icon; | |
return typeof tip == "string" ? tip : ""; | |
}; | |
this.newNpcTip = function(npc, type, eve) { | |
var nick = "<div><strong>"+npc.nick+"</strong></div>"; | |
switch (type) { | |
case "titan": | |
var type = "<i>tytan</i>"; | |
break; | |
case "heros": | |
var type = "<i>heros</i>"; | |
break; | |
case "elite3": | |
var type = "<i>elita III</i>"; | |
break; | |
case "elite2": | |
if (eve) { | |
var type = "<i>specjalna elita</i>"; | |
} else { | |
var type = "<i>elita II</i>"; | |
} | |
break; | |
case "elite": | |
var type = "<i>elita</i>"; | |
break; | |
default: | |
var type = ""; | |
break; | |
}; | |
var lvl = npc.lvl ? npc.lvl + " lvl" : ""; | |
var grp = npc.grp ? " grp" : ""; | |
var lvlgrp = "<span>"+lvl+grp+"</span>"; | |
return nick + type + lvlgrp; | |
}; | |
this.oldMargoNpcTip = function(npc, type, eve) { | |
var nick = "<b style='color:orange;'>"+npc.nick+"</b>"; | |
switch (type) { | |
case "titan": | |
var type = "<i>tytan</i><br>"; | |
break; | |
case "heros": | |
var type = "<i>heros</i><br>"; | |
break; | |
case "elite3": | |
var type = "<i>elita III</i><br>"; | |
break; | |
case "elite2": | |
if (eve) { | |
var type = "<i>specjalna elita</i><br>"; | |
} else { | |
var type = "<i>elita II</i><br>"; | |
} | |
break; | |
case "elite": | |
var type = "<i>elita</i><br>"; | |
break; | |
default: | |
var type = ""; | |
break; | |
}; | |
var lvl = npc.lvl ? "Lvl: "+npc.lvl : ""; | |
var grp = npc.grp ? " grp" : ""; | |
var lvlgrp = "<span>"+lvl+grp+"</span>"; | |
return nick + type + lvlgrp; | |
}; | |
this.normalNpcTip = function(npc, type, important, before) { | |
if (interface == "old") { | |
var tip = this.oldNpcTip(npc, type, important).replace("<span ></span><br>", "").replace("<span ></span>", ""); | |
} else if (interface == "new") { | |
var tip = this.newNpcTip(npc, type, important); | |
} else { | |
var tip = this.oldMargoNpcTip(npc, type, important); | |
}; | |
if (npc.lvl > 0) tip += "<br>"; | |
return this.makeTip({ | |
txt: before+tip, | |
x: npc.x, | |
y: npc.y | |
}); | |
}; | |
var npcTrack = {}; | |
this.addNpcToTrack = function(npc, id, heros) { | |
npcTrack[id] = npc; | |
qTrack.add({ | |
type: "NPC", | |
name: npc.nick | |
}); | |
if (interface != "superold") this.checkForUnknownResp(npc, heros); | |
}; | |
this.checkForUnknownResp = function(npc, heros) { | |
var map = interface == "new" ? Engine.map.d : window.map; | |
var db = heros ? herosDB : eliteDB; | |
if (db[npc.nick] && db[npc.nick].spawns) { | |
var spawns = db[npc.nick].spawns; | |
if (spawns[map.name] || spawns[map.id]) { | |
var spawnsOnMap = spawns[map.name] ? spawns[map.name] : spawns[map.id]; | |
if (spawns[map.name]) this.unknownMapId(map.name, map.id, heros); | |
if (!this.coordsExistInSpawns(spawnsOnMap, npc.x, npc.y)) this.unknownResp(npc, map, heros); | |
}; | |
}; | |
}; | |
this.coordsExistInSpawns = function(spawns, x, y) { | |
for (var i=0; i<spawns.length; i++) { | |
if (spawns[i][0] == x && spawns[i][1] == y) return true; | |
}; | |
return false; | |
}; | |
this.unknownResp = function(npc, map, heros) { | |
var log = interface == "new" ? API.priw.console.log : window.log; | |
log("<hr>"+(heros ? "Heros" : "Elita")+" znajduje siÄ na respie, ktĂłry nie jest w bazie danych minimapy.",1); | |
log("ProsiĹbym o zamieszczenie poniĹźszej informacji w <a style='color: gold' href='https://www.margonem.pl/?task=forum&show=posts&id=488564' target='_blank'>tym temacie</a><br><br>miniMap+ - Nieznany resp: "+npc.nick+", "+map.name+"(ID: "+map.id+")("+npc.x+","+npc.y+")<br><hr>"); | |
}; | |
this.unknownMapId = function(name, id, heros) { | |
var log = interface == "new" ? API.priw.console.log : window.log; | |
log("<hr>"+"Mapa, na ktĂłrej "+(heros ? "zrespiĹ siÄ heros" : "zrespiĹa siÄ elita")+", nie jest zapisana w bazie danych po ID.",1); | |
log("ProsiĹbym o zamieszczenie poniĹźszej informacji w <a style='color: gold' href='https://www.margonem.pl/?task=forum&show=posts&id=488564' target='_blank'>tym temacie</a><br><br>miniMap+ - nieznane ID mapy - '"+name+"'="+id+"<br><hr>"); | |
}; | |
this.getNpcType = function(npc, id) { | |
if (npc.type == 2 || npc.type == 3) { | |
var flash = false; | |
if (npc.wt > 99) { | |
//tytan | |
var type = "titan"; | |
} else if (npc.wt > 79) { | |
//heros | |
var type = "heros"; | |
this.addNpcToTrack(npc, id, true); | |
flash = true; | |
} else if (eliteDB[npc.nick]) { | |
//specjalna elita | |
var type = "elite2"; | |
this.addNpcToTrack(npc, id, false); | |
flash = true; | |
} else if (npc.wt > 29) { | |
//e3 | |
var type = "elite3"; | |
} else if (npc.wt > 19) { | |
//e2 | |
var type = "elite2"; | |
} else if (npc.wt > 9) { | |
//e | |
var type = "elite"; | |
} else { | |
//nub | |
var type = "mob"; | |
}; | |
} else if (npc.type == 0 || npc.type == 5) { | |
if (gws.indexOf(npc.icon) == -1) { | |
var type = "npc"; | |
} else { | |
var type = "gw"; | |
}; | |
} else if (_l() == "en" && npc.type == 7) { | |
var type = "item"; | |
}; | |
return { | |
type: type, | |
flash: flash | |
}; | |
}; | |
this.initHeroUpdating = function() { | |
if (interface != "new") { | |
var _run = hero.run; | |
hero.run = function() { | |
self.updateHero(); | |
var ret = _run.apply(this, arguments); | |
if (interface == "superold" && self.cancelMouseMovement) { | |
self.cancelMouseMovement = false; | |
window.global.movebymouse = false; | |
} | |
return ret; | |
}; | |
} else if (interface == "new") { | |
var _draw = Engine.map.draw; | |
Engine.map.draw = function() { | |
self.updateHero(); | |
return _draw.apply(this, arguments); | |
}; | |
}; | |
}; | |
this.updateHero = function() { | |
qTrack.update(); | |
if (interface == "new") var hero = Engine.hero.d; | |
else var hero = window.hero; | |
if (oldPos.x == hero.x && oldPos.y == hero.y) return; | |
this.objectMgr.updateObject({ | |
id: "HERO", | |
x: hero.x, | |
y: hero.y, | |
tip: "Moja postaÄ", | |
type: "hero" | |
}); | |
oldPos.x = hero.x; | |
oldPos.y = hero.y; | |
}; | |
this.parseGws = function(gws, townname) { | |
for (var i=0; i<gws.length; i+=5) { | |
var tip = townname[gws[i]]; | |
if (gws[i+3]) { | |
if (gws[i+3] == 2) { | |
tip += interface != "superold" ? "<br>("+_t("require_key", null , "gtw")+")" : "<br>(wymaga klucza)"; | |
}; | |
}; | |
if (gws[i+4]) { | |
var min = (parseInt(gws[i+4]) & 65535); | |
var max = ((parseInt(gws[i+4]) >> 16) & 65535); | |
tip += "<br>" + _t("gateway_availavle", null , "gtw"); | |
tip += min ? _t("from_lvl %lvl%", {"%lvl%": min }, "gtw") : ""; | |
tip += max >= 1000 ? "" : _t("to_lvl %lvl%", { "%lvl%": max }, "gtw") + _t("lvl_lvl", null , "gtw"); | |
}; | |
this.objectMgr.updateObject({ | |
tip: this.makeTip({ | |
txt: tip + "<br>", | |
x: gws[i+1], | |
y: gws[i+2] | |
}), | |
type: "gw", | |
x: gws[i+1], | |
y: gws[i+2], | |
id: "GW-"+gws[i]+"-"+i | |
}); | |
}; | |
}; | |
this.parseOther = function(others) { | |
for (var id in others) { | |
var other = others[id]; | |
if (!other.del) { | |
if ((interface != "new" && !g.other[id]) || (interface == "new" && !Engine.others.getById(id))) { | |
if (interface != "superold" || other.nick) this.addNewOtherToMap(other, id); //dumb fix | |
} else { | |
this.updateOther(other, id); | |
}; | |
} else { | |
this.objectMgr.updateObject({ | |
id: "OTHER-"+id, | |
del: 1 | |
}); | |
}; | |
} | |
}; | |
this.updateOther = function(other, id) { | |
var evoNetwork = this.checkIfOtherFromEvoNetwork(id); | |
var data = {}; | |
var canLoadImgFromCache = !other.icon; | |
var previousData = interface == "new" ? Engine.others.getById(id).d : g.other[id]; | |
var other = Object.assign({}, previousData, other); | |
if (isset(other.x)) data.x = other.x; | |
if (isset(other.y)) data.y = other.y; | |
var {tip, ctip} = this.getOtherTip(other, evoNetwork); | |
if (canLoadImgFromCache && this.otherImgCache[id]) { | |
var img = this.otherImgCache[id]; | |
tip = '<center><div style="background-image: url('+img.src+'); width: '+(img.width/4)+'px; height: '+(img.height/4)+'px"></div></center>' + tip; | |
} else { | |
this.loadOtherImg(other, id, tip); | |
} | |
data.tip = tip; | |
data.ctip = ctip; | |
data.id = "OTHER-"+id; | |
this.objectMgr.updateObject(data); | |
}; | |
this.otherImgCache = {}; | |
this.checkIfOtherFromEvoNetwork = function(id) { | |
//rozpoznawanie postaci z innych ĹwiatĂłw dodawanych przez dodatek ccarederra | |
return String(id).split("_")[1] == "wsync"; | |
}; | |
this.addNewOtherToMap = function(other, id) { | |
var type; | |
var evoNetwork = this.checkIfOtherFromEvoNetwork(id); | |
if (evoNetwork && !settings.get("/showevonetwork")) return; | |
switch (other.relation) { | |
case "": //obcy | |
type = "other"; | |
break; | |
case "cl-fr": //sojusznik | |
case "fr-fr": //fraction friend | |
type = "ally"; | |
break; | |
case "cl": //klanowicz | |
type = "clan"; | |
break; | |
case "fr": //znajomy | |
type = "friend"; | |
break; | |
case "en": //wrĂłg | |
case "cl-en": //wrogi klan | |
case "fr-en": //fraction enemy | |
type = "enemy"; | |
break; | |
default: | |
type = "other"; | |
break; | |
}; | |
if (evoNetwork) type = "evoNetwork"; | |
var {tip, ctip} = this.getOtherTip(other, evoNetwork); | |
this.objectMgr.updateObject({ | |
tip: tip, | |
ctip: ctip, | |
type: "other", | |
type2: type, | |
x: other.x, | |
y: other.y, | |
id: "OTHER-"+id, | |
evoNetwork: evoNetwork, | |
click: function() { | |
if (evoNetwork) return; //gdy ccarderr zrobi jakieĹ kanaĹy prywatne w swoim chacie to klikniÄcie gracza bÄdzie taki otwieraÄ | |
if (interface != "old") { | |
$chatInput.value = "@" + other.nick.replace(/ /g, "_") + " "; | |
$chatInput.focus(); | |
if (interface == "superold") { | |
//switch from eq to chat | |
if (window.chat.style.display == "none") { | |
var btt = document.querySelector("#eqbutton"); | |
btt.click(); | |
btt.style["background-position"] = ""; | |
}; | |
}; | |
} else if (interface == "old") { | |
chatTo(other.nick); | |
}; | |
} | |
}); | |
this.loadOtherImg(other, id, tip); | |
}; | |
this.loadOtherImg = function(other, id, tip) { | |
var img = new Image(); | |
img.src = (interface == "superold" ? "http://oldmargonem.pl" : "") + "/obrazki/postacie/"+other.icon; | |
img.onload = function() { | |
self.otherImgCache[id] = img; | |
tip = '<center><div style="background-image: url('+img.src+'); width: '+(img.width/4)+'px; height: '+(img.height/4)+'px"></div></center>' + tip; | |
self.objectMgr.updateObject({ | |
tip: tip, | |
id: "OTHER-"+id | |
}); | |
}; | |
} | |
this.getOtherTip = function(other, evoNetwork) { | |
if (interface == "old") { | |
var tip = this.oldOtherTip(other); | |
} else if (interface == "new") { | |
var tip = this.newOtherTip(other); | |
} else { | |
var tip = this.oldMargoOtherTip(other); | |
}; | |
if (evoNetwork) { | |
tip += "<i>PostaÄ z dodatku World Sync</i>"; | |
}; | |
return { | |
tip: this.makeTip({ | |
txt: tip + (evoNetwork ? "" : "<br>"), | |
x: other.x, | |
y: other.y | |
}), | |
ctip: "t_other" + (other.relation != "" && interface != "new" ? " t_"+other.relation : "") | |
}; | |
}; | |
this.oldOtherTip = function(other) { | |
if (!g.tips.other) newOther({0:{}});newOther({0:{del:1}}); | |
var tip = g.tips.other(other); | |
return tip.replace(/'/g, "'") | |
}; | |
this.newOtherTip = function(other) { | |
//pre-wrapper | |
if (other.rights) { | |
var rank; | |
if (other.rights & 1) rank = 0; | |
else if (other.rights & 16) rank = 1; | |
else if (other.rights & 2) rank = 2; | |
else if (other.rights & 4) rank = 4; | |
else rank = 3; | |
rank = "<div class='rank'>"+otherRanks[rank]+"</div>"; | |
} else { | |
var rank = ""; | |
}; | |
var guest = isset(other.guest) ? "<div class='rank'>ZastÄpca</div>" : ""; | |
var preWrapper = rank + guest; | |
//wrapper | |
var nick = "<div class='nick'>" + other.nick + "</div>"; | |
var prof = "<div class='profs-icon "+other.prof+"'></div>"; | |
var bless = isset(other.ble) ? "<div class='bless'></div>" : ""; | |
var infoWrapper = "<div class='info-wrapper'>" + nick + bless + prof + "</div>"; | |
//post-wrapper | |
var wanted = isset(other.wanted) ? "<div class='wanted'></div>" : ""; | |
var clan = (isset(other.clan) && other.clan.name != "") ? "<div class='clan-in-tip'>"+other.clan.name+"</div><div class='line'></div>" : ""; | |
var lvl = isset(other.lvl) ? "<div class='lvl'>"+other.lvl+" lvl</div>" : ""; | |
var mute = (other.attr & 1) ? "<div class='mute'></div>" : ""; | |
var postWrapper = wanted + clan + lvl + mute; | |
return preWrapper + infoWrapper + postWrapper; | |
}; | |
this.oldMargoOtherTip = function(other) { | |
var tip = "<b style='color:yellow'>"+other.nick+"</b>"; | |
if (other.clan) tip += "<span style='color:#fd9;'>["+g.clanname[other.clan]+"]</span><br>"; | |
tip += "Lvl: "+other.lvl+other.prof; | |
return tip; | |
}; | |
this.parseItem = function(items) { | |
for (var id in items) { | |
var item = items[id]; | |
if (item.loc == "m") { | |
this.addNewItemToMap(item, id); | |
} else { | |
var previousData = interface == "new" ? Engine.items.getItemById(id) : g.item[id]; | |
if (interface == "new" && previousData) previousData = previousData.d; | |
if (previousData && previousData.loc == "m") { | |
this.objectMgr.updateObject({ | |
id: "ITEM-"+id, | |
del: 1 | |
}); | |
}; | |
} | |
} | |
}; | |
this.addNewItemToMap = function(item, id) { | |
var tip = this.getItemTip(item); | |
this.objectMgr.updateObject({ | |
id: "ITEM-"+id, | |
tip: tip, | |
ctip: "t_item", | |
x: item.x, | |
y: item.y, | |
type: "item" | |
}); | |
}; | |
this.oldMargoItemTip = function(item) { | |
return "<b>"+item.name+"</b>"+item.stats; | |
}; | |
this.getItemTip = function(item) { | |
var nocenter = true; | |
var tip = interface == "new" ? MargoTipsParser.getTip(item) : (interface == "old" ? itemTip(item) : this.oldMargoItemTip(item)); | |
if (interface == "old" && tip.indexOf("tip-section") == -1) { //kompatybilnoĹÄ z moim dodatkiem na nowe tipy | |
tip = "<img src='"+(interface == "superold" ? "http://oldmargonem.pl" : "") +"/obrazki/itemy/"+item.icon+"'>" + tip; | |
nocenter = false; | |
}; | |
return this.makeTip({ | |
txt: tip, | |
x: item.x, | |
y: item.y, | |
nocenter: nocenter | |
}); | |
}; | |
var ripCount = 0; | |
this.parseRip = function(rips) { | |
for (var i=0; i<rips.length; i+=8) { | |
this.addNewRipToMap({ | |
nick: rips[i], | |
lvl: rips[i+1], | |
prof: rips[i+2], | |
x: parseInt(rips[i+3]), | |
y: parseInt(rips[i+4]), | |
ts: parseInt(rips[i+5]), | |
desc1: rips[i+6], | |
desc2: rips[i+7] | |
}); | |
ripCount++; | |
}; | |
}; | |
this.addNewRipToMap = function(rip) { | |
var isHerosRip = false; | |
var timeToDisappear = 300 + rip.ts - unix_time(); | |
if (timeToDisappear <= 0) return; | |
var tip = "<b>" + _t("rip_prefix") + " " + htmlspecialchars(rip.nick) + "</b>Lvl: " + rip.lvl + rip.prof + "<i>" + htmlspecialchars(rip.desc1) + "</i><i>" + htmlspecialchars(rip.desc2) + "</i>"; | |
this.objectMgr.updateObject({ | |
tip: this.makeTip({ | |
txt: tip, | |
x: rip.x, | |
y: rip.y | |
}), | |
type: "other", | |
x: rip.x, | |
y: rip.y, | |
circle: true, | |
border: true, | |
id: "RIP-"+ripCount, | |
ctip: "t_rip" | |
}); | |
var id = "RIP-"+ripCount; | |
var nick; | |
if (nick = this.checkHerosRip(rip.desc1)) { | |
qTrack.add({type: "COORDS", name: "GrĂłb gracza zabitego przez herosa "+nick+"<br>MoĹźliwe, Ĺźe heros tam stoi!", coords: [rip.x, rip.y] }); | |
isHerosRip = true; | |
message("Na mapie znajduje siÄ grĂłb gracza zabitego przez herosa "+nick); | |
}; | |
setTimeout(() => { | |
self.objectMgr.updateObject({ | |
id: id, | |
del: 1 | |
}); | |
if (isHerosRip) qTrack.remove({type: "COORDS", name: "GrĂłb gracza zabitego przez herosa "+nick+"<br>MoĹźliwe, Ĺźe heros tam stoi!"}); | |
}, timeToDisappear*1000); | |
}; | |
this.checkHerosRip = function(desc) { | |
for (var nick in herosDB) { | |
var needle = nick + "(" + herosDB[nick].lvl + herosDB[nick].prof + ")"; | |
if (desc.indexOf(needle) > -1) { | |
return nick; | |
}; | |
}; | |
return false; | |
}; | |
this.objectMgr = new (function() { | |
var self = this; | |
var mgr = this; | |
var objs = {}; | |
var flashables = []; | |
function MapObject(data) { | |
var self = this; | |
this.d = data; | |
var currentColor = settings.get("/colors")[this.d.type]; | |
this.initHTML = function() { | |
this.$ = document.createElement("div"); | |
this.$.classList.add("mmpMapObject", "mmp-"+data.type); | |
if (innerDotKeys.indexOf(data.type2) != -1) { | |
var $dot = document.createElement("div"); | |
$dot.classList.add("innerDot", "mmp-"+data.type2); | |
Object.assign($dot.style, { | |
left: objSize/4 + "px", | |
top: objSize/4 + "px", | |
width: objSize/2 + "px", | |
height: objSize/2 + "px" | |
}); | |
this.$.appendChild($dot); | |
} else if (data.type2 == "evoNetwork") { | |
this.$.classList.add("evoNetwork"); | |
}; | |
var left = data.x * objScale * 32; | |
var top = data.y * objScale * 32; | |
Object.assign(this.$.style, { | |
top: top + "px", | |
left: left + "px", | |
width: objSize + "px", | |
height: objSize + "px", | |
opacity: "0" | |
}); | |
setTimeout(() => this.$.style.opacity = "1.0", 1); | |
if (interface != "new") { | |
this.$.setAttribute("tip", data.tip); | |
if (data.ctip) this.$.setAttribute("ctip", data.ctip); | |
} else { | |
this.$.setAttribute("data-tip", data.tip); | |
if (data.ctip) this.$.setAttribute("data-tip-type", data.ctip); | |
}; | |
if (data.circle) { | |
this.$.style["border-radius"] = objScale*18 + "px"; | |
}; | |
if (data.border) { | |
this.$.style["border"] = "1px solid black"; | |
}; | |
if (data.qm) { | |
this.$.innerHTML = "<img class='mmpQM' width='"+objSize+"' height='"+objSize*2+"' src='http://jaruna.margonem.pl/img/quest-mark.gif'>"; | |
}; | |
$map.appendChild(this.$); | |
}; | |
this.invertColor = function() { | |
var c = currentColor; | |
var c1 = (255 - parseInt("0x"+c.substring(1,3))).toString(16); | |
var c2 = (255 - parseInt("0x"+c.substring(3,5))).toString(16); | |
var c3 = (255 - parseInt("0x"+c.substring(5,7))).toString(16); | |
if (c1.length < 2) c1 = "0" + c1; | |
if (c2.length < 2) c2 = "0" + c2; | |
if (c3.length < 2) c3 = "0" + c3; | |
currentColor = "#"+c1+c2+c3; | |
this.$.style.background = currentColor; | |
}; | |
this.remove = function() { | |
if (this.d.flash) flashables.splice(flashables.indexOf(this), 1); | |
this.$.style["opacity"] = "0"; | |
if (settings.get("/interpolerate")) setTimeout(() => this.$.remove(), 500); | |
else this.$.remove(); | |
}; | |
this.update = function(data) { | |
Object.assign(this.d, data); | |
if (data.x) { | |
this.$.style["left"] = data.x * objScale * 32 + "px"; | |
}; | |
if (data.y) { | |
this.$.style["top"] = data.y * objScale * 32 + "px"; | |
}; | |
if (data.tip) { | |
this.$.setAttribute(interface == "new" ? "data-tip" : "tip", data.tip); | |
}; | |
if (data.invertColor) { | |
this.invertColor(); | |
}; | |
}; | |
this.initEventListener = function() { | |
if (data.click) { | |
var type = mobileDevice ? "touchstart" : "click"; | |
this.$.addEventListener(type, e => { | |
data.click(e); | |
e.stopPropagation(); | |
}); | |
};// else { | |
//this.$.addEventListener("click", this.goTo); | |
//} | |
}; | |
//this.goTo = function() { | |
// if (newInterface) { | |
// Engine.hero.autoGoTo({x :self.d.x, y: self.d.y}); | |
// } else { | |
// self.searchPath.call(window.hero, self.d.x, self.d.y); | |
// }; | |
//}; | |
this.manageDisplay = function() { | |
if (!this.d.flash && isset(this.d.lvl) && this.d.lvl < settings.get("/minlvl")) { | |
this.$.classList.add("hidden"); | |
} else { | |
this.$.classList.remove("hidden"); | |
}; | |
}; | |
this.checkStringSearch = function(str) { | |
if (this.d.tip.toLowerCase().indexOf(str) == -1 && this.d.type != "hero") { | |
this.$.classList.add("hiddenBySearch"); | |
}; | |
}; | |
this.checkRangeSearch = function(n1, n2) { | |
if (isset(this.d.lvl)) { | |
if (this.d.lvl < n1 || this.d.lvl > n2) { | |
this.$.classList.add("hiddenBySearch"); | |
}; | |
}; | |
}; | |
this.manageFilters = function() { | |
if (search.type == "string" && search.data != "") { | |
this.checkStringSearch(search.data); | |
} else if (search.type == "lvl") { | |
this.checkRangeSearch(search.data[0], search.data[1]); | |
}; | |
}; | |
this.init = function() { | |
if (data.flash) flashables.push(this); | |
this.initHTML(); | |
this.initEventListener(); | |
this.manageDisplay(); | |
this.manageFilters(); | |
}; | |
this.init(); | |
}; | |
this.getByElem = function($el) { | |
for (var i in objs) { | |
if (objs[i].$ == $el) return objs[i]; | |
}; | |
}; | |
this.deleteAll = function() { | |
for (var i in objs) { | |
objs[i].remove(); | |
delete objs[i]; | |
}; | |
}; | |
this.updateObject = function(data) { | |
if (!objs[data.id] && !data.del) { | |
if (!data.dontCreate) objs[data.id] = new MapObject(data); | |
} else if (data.del) { | |
if (objs[data.id]) { | |
objs[data.id].remove(); | |
delete objs[data.id]; | |
}; | |
} else { | |
objs[data.id].update(data); | |
} | |
}; | |
this.resetSearch = function() { | |
this.removeCoordMarker(); | |
for (var id in objs) { | |
objs[id].$.classList.remove("hiddenBySearch"); | |
}; | |
}; | |
this.filterByLvl = function(n1, n2) { | |
search.type = "lvl", | |
search.data = [n1, n2]; | |
for (var id in objs) { | |
objs[id].checkRangeSearch(n1, n2); | |
}; | |
}; | |
this.filterByString = function(str) { | |
str = str.toLowerCase(); | |
search.type = "string", | |
search.data = str; | |
for (var id in objs) { | |
objs[id].checkStringSearch(str); | |
}; | |
}; | |
this.removeCoordMarker = function() { | |
this.updateObject({ | |
id: "COORDS", | |
del: 1 | |
}); | |
}; | |
this.createCoordMarker = function(x, y) { | |
this.updateObject({ | |
id: "COORDS", | |
x: x, | |
y: y, | |
tip: "koordy "+x+","+y, | |
circle: true, | |
type: "hero", | |
flash: true | |
}) | |
}; | |
this.manageDisplay = function() { | |
for (var id in objs) { | |
objs[id].manageDisplay(); | |
}; | |
}; | |
this.invertFlashables = function() { | |
for (var i=0; i<flashables.length; i++) { | |
flashables[i].update({ | |
invertColor: true | |
}); | |
}; | |
}; | |
setInterval(this.invertFlashables, 500); | |
})(); | |
this.addSpawnsToMap = function(db, heros, map, mapId) { | |
map = map.toLowerCase(); | |
var maxlvl = settings.get("/maxlvl"); | |
var hero = interface == "new" ? Engine.hero.d : window.hero; | |
for (var i in db) { | |
var mob = db[i]; | |
if (mob.ver && mob.ver != _l()) continue; | |
var minlvl = Math.max(mob.lvl/2, mob.lvl-50); | |
if ((maxlvl+mob.lvl >= hero.lvl && minlvl <= hero.lvl) || mob.lvl >= 242 || mob.lvl == -1) { | |
for (var loc in mob.spawns) { | |
if (loc.toLowerCase() == map || loc == mapId) { | |
var spawns = mob.spawns[loc]; | |
for (var j=0; j<spawns.length; j++) { | |
var x = spawns[j][0]; | |
var y = spawns[j][1]; | |
this.objectMgr.updateObject({ | |
id: "SPAWN-"+i+"-"+j, | |
tip: this.makeTip({ | |
txt: "Resp " + (heros ? "herosa " : "elity ") + i, | |
x: x, | |
y: y | |
}), | |
x: x, | |
y: y, | |
type: heros ? "heros" : "elite2", | |
circle: true | |
}); | |
}; | |
}; | |
}; | |
}; | |
}; | |
}; | |
this.init = function() { | |
this.initSettings(); | |
this.initHTML(); | |
this.appendUserStyles(); | |
this.initResponseParser(); | |
this.initHeroUpdating(); | |
this.appendMobileButton(); | |
this.installationCounter.count(); | |
if (interface == "old") this.searchPath = function(a,t){if(this.isBlockedSearchPath())return this.blockedInfoSearchPath();for(var h=[],i=128&hero.opt?8:20,r=Math.max(0,Math.min(a,this.x)-i),s=Math.min(map.x-1,Math.max(a,this.x)+i),o=Math.max(0,Math.min(t,this.y)-i),e=Math.min(map.y-1,Math.max(t,this.y)+i),d=r-1;s+1>=d;d++){h[d]=[];for(var x=o-1;e+1>=x;x++)h[d][x]=!(d>=r&&s>=d&&x>=o&&e>=x)||isset(g.npccol[d+256*x])||map.col&&"0"!=map.col.charAt(d+x*map.x)?-2:-1}h[this.x][this.y]=0,b=-1,road=[];for(var c={x:-1,y:-1,dist:99},y=1;s-r+e-o+3>y;y++)for(var d=r;s>=d;d++)for(var x=o;e>=x;x++){if(-1!=h[d][x]||h[d][x-1]!=y-1&&h[d][x+1]!=y-1&&h[d-1][x]!=y-1&&h[d+1][x]!=y-1||(h[d][x]=y),h[a][t]>0){d=s+1;break}c.dist2=Math.abs(a-d)+Math.abs(t-x),h[d][x]==y&&c.dist2<c.dist&&(c.x=d,c.y=x,c.dist=c.dist2)}if(c.hdist=Math.abs(a-hero.x)+Math.abs(t-hero.y),h[a][t]>0||c.dist<c.hdist){h[a][t]<0&&(a>c.x?b=2:a<c.x?b=1:t>c.y?b=0:t<c.y&&(b=3),a=c.x,t=c.y),road[0]={x:a,y:t};for(var f=h[a][t]-1,l=a,m=t;f>0;f--)h[l][m-1]==f?m--:h[l][m+1]==f?m++:h[l-1][m]==f?l--:h[l+1][m]==f?l++:f=0,f&&(road[h[a][t]-f]={x:l,y:m})}road.length>1&&null==g.playerCatcher.follow&&$("#target").stop().css({left:32*a,top:32*t,display:"block",opacity:1}).fadeOut(1e3)}; | |
$chatInput = interface == "new" ? document.querySelector("[data-section='chat'] .input-wrapper input") : (interface == "superold" ? document.querySelector("#chatIn") : null); | |
}; | |
//questtrack (fuzja kodu z wersji minimapy na SI i NI wiÄc wyglÄ da jak wyglÄ da) | |
var qTrack = new (function() { | |
var self = this; | |
var hero = interface == "new" ? Engine.hero : window.hero; | |
var $hero = interface == "old" ? $("#hero") : (interface == "superold" ? document.querySelector("#oHero") : null); | |
var $canvas = interface == "new" ? $("#GAME_CANVAS") : null; | |
if (interface == "new") { | |
this.npcs = {}; | |
API.addCallbackToEvent("newNpc", function(npc) { | |
if (npc) self.npcs[npc.d.id] = npc.d; | |
}); | |
API.addCallbackToEvent("removeNpc", function(npc) { | |
if (npc) delete self.npcs[npc.d.id]; | |
}); | |
}; | |
this.getOldMargoHeroPos = function() { | |
return { | |
left: $hero.offsetLeft, | |
top: $hero.offsetTop | |
}; | |
}; | |
this.getHeroPos = function() { | |
if (interface == "old") return $hero.position(); | |
if (interface == "superold") return this.getOldMargoHeroPos(); | |
if (!Engine.map.size) return {x: 0, y: 0}; | |
var tilesX = $canvas.width()/32; | |
var tilesY = $canvas.height()/32; | |
var pos = { | |
x: Engine.hero.rx, | |
y: Engine.hero.ry | |
}; | |
var actualPos = {}; | |
if (pos.x < tilesX/2) { | |
actualPos.x = pos.x*32; | |
} else if (Engine.map.size.x - pos.x < tilesX/2) { | |
actualPos.x = (pos.x - (Engine.map.size.x - tilesX/2) + tilesX/2)*32; | |
} else { | |
actualPos.x = (tilesX/2)*32; | |
}; | |
if (pos.y < tilesY/2) { | |
actualPos.y = pos.y*32; | |
} else if (Engine.map.size.y - pos.y < tilesY/2) { | |
actualPos.y = (pos.y - (Engine.map.size.y - tilesY/2) + tilesY/2)*32; | |
} else { | |
actualPos.y = (tilesY/2)*32; | |
}; | |
var canvasOffset = $canvas.offset(); | |
return { | |
left: actualPos.x + canvasOffset.left, | |
top: actualPos.y + canvasOffset.top | |
}; | |
}; | |
this.update = function() { | |
for (var i=0; i<this.arrows.length; i++) { | |
this.drawArrow(this.arrows[i]); | |
}; | |
}; | |
this.drawArrow = function(objective) { | |
if (objective.type == "NPC") { | |
var nameKey = "nick"; | |
var obj = interface == "new" ? this.npcs : g.npc; | |
var item = false; | |
} else if (objective.type == "ITEM") { //item | |
var nameKey = "name"; | |
if (interface == "new") { | |
var itemArr = Engine.items.fetchLocationItems("m"); | |
var obj = {}; | |
for (var i in itemArr) { | |
var it = itemArr[i]; | |
if (it.id) obj[it.id] = it; | |
else obj[it.hid] = it; | |
}; | |
} else { | |
var obj = g.item; | |
}; | |
var item = true; | |
} else if (objective.type == "COORDS") { //coords | |
var coords = objective.coords; | |
var size = [32, 32]; | |
var x = Math.abs(hero.rx-coords[0]); | |
var y = Math.abs(hero.ry-coords[1]); | |
var closest = Math.sqrt(Math.pow(x,2) + Math.pow(y,2)); | |
}; | |
if (objective.type != "COORDS") { | |
var closest = Infinity; | |
var coords = false; | |
var size = false; | |
for (var i in obj) { | |
var entity = obj[i]; | |
if (entity[nameKey] == objective.name && (!item || entity.loc == "m")) { | |
var x = Math.abs(hero.rx-entity.x); | |
var y = Math.abs(hero.ry-entity.y); | |
var dist = Math.sqrt(Math.pow(x,2) + Math.pow(y,2)); | |
if (dist < closest) { | |
closest = dist; | |
coords = [entity.x, entity.y]; | |
size = item ? [32,32] : [entity.fw, entity.fh]; | |
}; | |
}; | |
}; | |
}; | |
if (coords) { | |
var cos = (coords[0] - hero.rx)/closest; | |
var sin = (coords[1] - hero.ry)/closest; | |
var heropos = this.getHeroPos(); | |
var top = 150*sin; | |
var left = 150*cos; | |
var opacity = 1; | |
if (closest < 9) { | |
top = top*Math.pow(closest/9, 1.8); | |
left = left*Math.pow(closest/9, 1.8); | |
opacity = Math.pow(closest/9, 2.1); | |
}; | |
if (interface != "new") top+=20; | |
left+= interface == "new" ? -12 : 4; | |
if ((cos >= 0 && sin >= 0) || (cos >= 0 && sin <= 0)) { | |
var angle = Math.asin(sin) * 180 / Math.PI; | |
} else { | |
var angle = 180+Math.asin(0-sin) * 180 / Math.PI; | |
}; | |
objective.$.css({ | |
top: top + heropos.top, | |
left: left + heropos.left, | |
display: opacity > 0.09 ? "block" : "none", | |
"-ms-transform": "rotate("+angle+"deg)", | |
"-webkit-transform": "rotate("+angle+"deg)", | |
transform: "rotate("+angle+"deg)", | |
opacity: opacity | |
}); | |
if (interface == "old") { | |
objective.$highlight.css({ | |
left: coords[0]*32 - 11, | |
top: coords[1]*32 + 14, | |
display: "block", | |
opacity: 1-opacity | |
}); | |
}; | |
} else { | |
objective.$.hide(); | |
if (interface == "old") objective.$highlight.hide(); | |
}; | |
}; | |
this.arrows = []; | |
this.add = function(objective) { | |
for (var i in this.arrows) { | |
if (objective.type == this.arrows[i].type && objective.name == this.arrows[i].name) return; | |
}; | |
objective.$ = this.arrowTemplate.clone().appendTo(interface == "old" ? "#centerbox" : (interface == "new" ? ".game-window-positioner" : "#oMap")); | |
objective.$.attr(interface == "new" ? "data-tip" : "tip", objective.name); | |
if (interface == "old") objective.$highlight = this.highlightTemplate.clone().appendTo(interface == "old" ? "#ground" : "#oMap"); | |
objective.index = this.arrows.push(objective) -1; | |
objective.remove = function() { | |
self.arrows.splice(this.index, 1); | |
for (var i=this.index; i<self.arrows.length; i++) { | |
self.arrows[i].index--; | |
}; | |
this.$.remove(); | |
if (interface == "old") this.$highlight.remove(); | |
}; | |
this.update(); | |
}; | |
this.remove = function(objective) { | |
for (var i=0; i<this.arrows.length; i++) { | |
if (this.arrows[i].name == objective.name && this.arrows[i].type == objective.type) this.arrows[i].remove(); | |
}; | |
}; | |
this.reset = function() { | |
while (this.arrows.length) { | |
this.arrows[0].remove(); | |
}; | |
}; | |
this.arrowTemplate = $("<div>").css({ | |
background: "url(http://priweejt.ct8.pl/addons/img/qt-arrow-red.gif)", | |
width: 24, | |
height: 24, | |
zIndex: 250, | |
position: "absolute" | |
}); | |
this.highlightTemplate = $("<div>").css({ | |
background: "url(/img/glow-blue.png)", | |
position: "absolute", | |
width: 52, | |
height: 24, | |
zIndex: 1 | |
}); | |
})(); | |
this.installationCounter = new (function() { | |
var self = this; | |
var id = 87771; | |
this.count = function() { | |
if (interface == "superold") return; | |
if (!settings.get("/counted")) { | |
//extManager.toggleLike(id, 'unlike') | |
$.ajax({ | |
url: "/tools/addons.php?task=details&id="+id, | |
type: "POST", | |
data: {like: "unlike"} | |
}); | |
settings.set("/counted", true); | |
}; | |
}; | |
this.get = function(clb) { | |
if (interface == "superold") return clb("<span tip='NiedostÄpne dla oldmargonem'>-</span>"); | |
$.ajax({ | |
url: "/tools/addons.php?task=details&id="+id, | |
datatype: "json", | |
success: function(r) { | |
clb(-r.addon.points); | |
} | |
}); | |
}; | |
})(); | |
//databases | |
//porzuciĹem rÄczne edytowanie tego wiÄc w jednej linii jest bo tak wypluwa skrypt | |
var herosDB = {"Domina Ecclesiae":{"lvl":21,"prof":"b","spawns":{"3":[[53,11],[50,23]],"169":[[14,8],[8,9]],"171":[[25,26],[7,28],[15,29],[8,8],[22,9]],"175":[[12,4]],"217":[[7,35],[22,13],[37,39]],"249":[[12,5]],"251":[[11,10],[10,13]],"290":[[11,8],[16,5]],"298":[[7,10]],"300":[[7,8]],"2070":[[6,4],[10,29],[7,17]],"2071":[[42,5],[17,4],[37,9]],"2073":[[21,9]],"2546":[[44,43],[33,10],[41,14],[50,5],[25,28],[9,11]],"2710":[[6,11],[24,6],[8,15]],"2712":[[5,7],[9,7],[7,12]],"2713":[[10,6],[8,12]],"2714":[[8,5],[27,10],[7,8],[16,8]],"2715":[[24,17],[6,13],[5,18],[32,18]],"2718":[[23,8],[15,8]],"2719":[[7,35],[4,10]],"2721":[[4,5],[29,15],[20,15],[15,9]],"2722":[[8,22],[8,7]],"2879":[[12,7],[7,20],[11,13]],"2880":[[10,19]],"2885":[[38,57],[11,22],[23,56],[48,36]],"2886":[[41,57],[13,46],[12,12],[29,60],[24,12]],"PrzeklÄty Zamek p.1":[[12,4]],"StraĹźnica pĂłĹnocno-wschodnia":[[8,3]],"StraĹźnica pĂłĹnocno-zachodnia":[[8,3]],"Mury - zbrojownia - piwnica":[[12,11]],"Mury - skrzydĹo wschodnie":[[12,13]],"Mury - kwatera gĹĂłwna":[[10,11]],"Opuszczony dom":[[5,8]],"Posterunek":[[9,10]],"Posterunek - piwnica":[[11,4]],"Podziemia siedziby maga p.1 - sala 1":[[22,28],[13,9]],"Podziemia siedziby maga p.1 - sala 2":[[10,9]],"Fortyfikacja p.1":[[13,6],[7,16]],"Fortyfikacja p.5":[[9,9]],"PrzeklÄta StraĹźnica p.1":[[9,10]]}},"Mroczny Patryk":{"lvl":35,"prof":"w","spawns":{"3":[[31,58],[19,71],[11,47],[58,46],[19,21],[2,49],[14,7],[19,52],[54,71],[33,62],[57,75],[7,17],[48,79],[52,27],[28,3],[56,4],[10,84]],"4":[[45,51],[52,39],[54,66],[17,15],[35,14],[3,87],[38,59],[55,78],[25,44],[3,68],[42,18],[45,84],[59,92],[21,25],[5,27],[2,21],[6,4]],"8":[[5,40],[15,24],[58,18],[40,36],[24,54],[52,29],[26,6],[15,44],[7,10],[38,26],[54,45],[51,55],[51,5],[48,16],[42,22],[26,29],[4,56],[37,54]],"11":[[37,11],[61,22],[14,4],[52,50],[45,28],[5,75],[55,19],[56,94],[10,47],[9,30],[21,15],[37,71],[39,51],[48,83],[25,6],[55,32],[54,65],[11,17],[57,93]],"12":[[53,47],[76,17],[5,9],[21,41],[65,15],[10,31],[74,17]],"19":[[9,10]],"110":[[20,41],[52,23],[22,24],[60,23],[41,40],[36,11],[55,3],[52,77],[30,8],[39,61],[17,89],[9,8],[29,42],[46,83],[31,21],[54,51],[0,23],[27,65],[48,2],[5,85],[31,50],[19,78],[55,12],[3,4],[4,77],[31,21],[53,77],[25,39],[18,2]],"111":[[49,20],[60,3],[11,19],[9,47],[18,58],[22,28],[42,55],[30,2]],"115":[[41,43],[52,29],[21,10],[8,19],[57,48],[34,36],[38,43],[7,55],[49,43]],"634":[[26,7]],"1110":[[52,59],[32,9],[18,24],[11,13],[35,22]],"3402":[[37,24],[47,52],[5,27],[53,11]]}},"Karmazynowy MĹciciel":{"lvl":45,"prof":"m","spawns":{"121":[[47,26],[3,2],[2,54],[41,12],[48,75],[12,39],[5,65]],"128":[[3,87],[4,55],[33,18],[42,88],[52,55],[12,18],[51,19]],"132":[[11,17]],"133":[[13,18]],"134":[[8,13]],"135":[[10,11],[12,8]],"136":[[14,8]],"151":[[12,6],[26,5],[58,37],[46,60],[22,54],[37,57],[55,5],[39,13],[47,7],[19,34],[16,4],[45,52]],"182":[[8,5]],"183":[[14,9]],"198":[[53,56],[60,5],[10,44],[10,7],[57,22],[43,4],[37,2],[24,7],[14,19],[28,62],[9,6],[58,38],[9,33],[34,37],[9,45]],"226":[[13,37],[15,71],[20,90]],"227":[[10,35],[14,35]],"228":[[51,21],[50,24]],"229":[[36,82],[45,6],[8,70],[20,14]]}},"ZĹodziej":{"lvl":50,"prof":"h","spawns":{"1180":[[12,8],[11,8]],"1188":[[6,6]],"1247":[[9,9]],"1278":[[8,6]],"1280":[[8,6]],"1320":[[8,8]],"1335":[[10,8]],"1382":[[7,8]],"1407":[[8,7],[9,7]],"1423":[[8,7]],"1433":[[7,8]],"1438":[[12,6]],"1489":[[7,8]],"1493":[[7,8]],"1500":[[10,8]],"1542":[[28,6]],"1566":[[4,11]],"1567":[[7,6]],"1568":[[4,8]],"1589":[[6,8]],"1590":[[4,7],[4,6]],"1605":[[4,10]],"Chata Ficjusza":[[3,8]]}},"ZĹodziej znajduje siÄ w tym domu (parter)":{"lvl":50,"spawns":{"589":[[39,14],[40,14],[62,14],[63,14],[74,38],[52,54],[53,54]],"630":[[69,40],[44,41]],"1233":[[68,29],[75,16]],"1262":[[52,9],[53,9]]}},"ZĹodziej znajduje siÄ w tym domu (2. piÄtro)":{"lvl":50,"spawns":{"589":[[31,33],[83,36],[84,36]]}},"ZĹodziej znajduje siÄ w tej latarnii (2. piÄtro) (uwaga na kraby przy dochodzeniu tutaj)":{"lvl":50,"spawns":{"1262":[[20,54]]}},"ZĹodziej znajduje siÄ w tym domu (1. piÄtro)":{"lvl":50,"spawns":{"589":[[17,33],[33,17]],"630":[[40,27],[41,27]],"1262":[[61,17],[62,17]]}},"ZĹodziej znajduje siÄ w tym domu (piwnica)":{"lvl":50,"spawns":{"589":[[57,14],[43,54]],"630":[[78,17],[77,17],[81,28],[82,28],[88,23]],"1233":[[57,39]]}},"ZĹodziej znajduje siÄ w tym domu (pokĂłj Grety)":{"lvl":50,"spawns":{"589":[[59,29],[60,29]]}},"ZĹy Przewodnik":{"lvl":63,"prof":"w","spawns":{"116":[[5,26],[40,35],[35,3],[52,30],[10,44],[54,43],[18,8],[28,57],[37,8],[7,17],[35,3],[53,31],[39,34],[34,2],[27,56]],"122":[[35,20],[19,6],[54,18],[32,7],[54,25]],"140":[[26,54],[44,29],[56,27],[10,49],[49,2]],"150":[[57,3],[18,4],[3,34],[40,38],[89,51],[27,50],[40,37],[57,3]],"180":[[54,28],[22,20],[15,6],[14,44],[31,4],[34,17],[4,19]],"2730":[[19,13],[28,38],[12,23],[53,6],[49,15],[38,58],[6,46],[38,58]]}},"Piekielny KoĹciej":{"lvl":74,"prof":"w","spawns":{"Labirynt Margorii":[[15,38],[49,24],[57,55],[35,18],[34,46]],"Margoria Sala KrĂłlewska":[[23,61],[10,77],[51,24],[38,82],[22,30]],"Kopalnia Margorii":[[30,22],[53,62],[11,39],[50,12],[52,40],[27,38],[8,49]],"Zdradzieckie PrzejĹcie":[[21,6],[22,56],[67,38]]}},"OpÄtany Paladyn":{"lvl":85,"prof":"w","spawns":{"180":[[49,28]],"203":[[15,28],[31,9]],"204":[[18,27]],"205":[[18,27]],"210":[[84,7],[33,45],[54,11],[78,25],[15,26]],"211":[[19,38],[19,11],[45,57]],"601":[[17,41],[87,5],[25,55],[59,35],[92,54],[22,21]],"602":[[40,31],[6,58],[4,16]],"Podziemia ĹwiÄ tyni":[[28,5],[54,32]],"Zbrojownia Andarum":[[25,59],[7,35],[7,20]]}},"Kochanka Nocy":{"lvl":100,"prof":"m","spawns":{"246":[[12,8],[28,60],[77,60]],"253":[[88,34],[77,46],[80,59],[6,34],[6,41],[34,22],[60,7],[90,20]],"268":[[83,6],[10,15],[34,47]],"330":[[6,8],[88,6],[60,24],[14,43],[45,40],[16,19]],"331":[[22,12],[5,58],[82,41],[82,8]],"332":[[77,13],[64,7],[35,19],[19,36]],"339":[[91,41],[81,1],[44,9],[39,33],[45,56],[67,59]],"3765":[[70,34],[83,51],[9,43],[29,37]],"3766":[[5,46],[11,11],[60,11],[72,52],[53,55]]}},"Perski KsiÄ ĹźÄ":{"lvl":116,"prof":"b","spawns":{"Dolina Pustynnych KrÄgĂłw":[[11,89],[11,89],[10,21]],"Piachy Zniewolonych":[[33,23],[11,7],[75,30]],"Ruchome Piaski":[[79,54],[63,29],[15,16]],"Korsarska Nora - sala 2":[[4,22]],"Korsarska Nora - sala 4":[[10,6]],"Korsarska Nora p.2":[[11,6]],"Ukryta Grota Morskich DiabĹĂłw":[[51,32],[25,16]],"Ukryta Grota Morskich DiabĹĂłw - arsenaĹ":[[4,14]],"Ukryta Grota Morskich DiabĹĂłw - skarbiec":[[8,4]],"Oaza Siedmiu WichrĂłw":[[61,15],[42,24]],"Ruiny Pustynnych Burz":[[42,46],[9,7],[42,79]],"Dolina Suchych Ĺez":[[71,16],[41,22],[61,55]]}},"Baca Bez Ĺowiec":{"lvl":123,"prof":"h","spawns":{"WyjÄ cy WÄ wĂłz":[[58,30],[7,10],[58,51],[35,3],[52,72],[8,75],[58,18],[54,50],[21,41],[50,32],[50,7],[44,71],[40,87],[14,36],[23,71],[38,53]],"WyjÄ ca Jaskinia":[[14,61],[35,28],[54,27],[23,51],[4,19],[24,19],[50,32],[10,18],[32,7],[17,60],[50,25]],"NiedĹşwiedzie Urwisko":[[20,6],[34,8],[33,23]],"Babi wzgĂłrek":[[36,43],[55,7],[40,4],[54,78],[41,2],[34,54],[41,78],[56,67],[60,36],[12,60],[19,22],[15,88],[38,25],[38,33]],"GĂłralska Pieczara p.1":[[19,17],[19,22],[25,24],[35,4],[34,12]],"GĂłralska Pieczara p.2":[[7,5],[15,20],[5,31]],"GĂłralska Pieczara p.3":[[16,28],[24,38]],"GĂłralskie przejĹcie":[[29,2],[38,46],[28,19],[48,87],[48,70],[42,64],[60,70],[3,46],[7,9],[22,39],[18,53],[56,5],[47,2],[33,27],[8,72],[6,46]],"Grota Halnego Wiatru p.1":[[4,12]],"Grota Halnego Wiatru p.2":[[26,27],[5,31],[7,5],[13,17]]}},"Lichwiarz Grauhaz":{"lvl":129,"prof":"w","spawns":{"286":[[7,16],[50,48]],"287":[[26,30]],"594":[[29,18]],"1192":[[55,48],[30,54]],"1227":[[6,43],[54,10],[51,21],[49,42]],"1228":[[8,51],[51,3],[5,18],[42,37]],"1229":[[53,9],[11,43],[8,13],[7,16],[37,40]],"1231":[[39,58],[33,47],[12,11]],"1232":[[41,14],[33,7],[58,11],[42,25]],"1234":[[21,19],[46,53],[5,39],[6,23]],"3468":[[32,32]],"3469":[[13,14]],"3470":[[18,27],[30,5],[21,31],[59,56]],"3471":[[39,6]],"3472":[[44,50]],"3473":[[36,43],[66,9]],"ĹnieĹźna Grota p.2":[[34,10]],"KrysztaĹowa Sala Smutku":[[16,7]],"PrzejĹcie magicznego mrozu":[[41,49]],"PrzejĹcie lodowatego wiatru":[[6,33]],"Szlak Thorpa p.2":[[32,32]],"Zasypane Ograbar-Dun":[[55,48],[30,54]],"PrzejĹcie zamarzniÄtych koĹci":[29,18]}},"ObĹÄ kany Ĺowca OrkĂłw":{"lvl":144,"prof":"w","spawns":{"344":[[25,8],[61,36],[45,23],[86,4],[25,38],[45,61],[14,4],[24,40],[85,33],[19,10]],"ZĹudny Trakt":[[38,13],[58,17],[17,5],[9,51],[21,6],[7,59],[32,16],[37,9]],"Orcza WyĹźyna":[[74,47],[16,16],[52,12],[59,35],[87,7]],"Grota Orczych SzamanĂłw":[[12,19]],"Osada Czerwonych OrkĂłw":[[18,24],[19,23],[14,25],[62,42],[35,27],[41,78],[43,4],[60,47]],"Siedziba Rady OrkĂłw":[[11,25]],"Nawiedzone Kazamaty p.1":[[19,33],[45,13],[10,44],[42,39],[6,43],[45,9],[12,6],[32,16],[10,16],[25,7],[40,38],[16,16],[36,7]],"Nawiedzone Kazamaty p.3":[[27,22],[26,22]],"Nawiedzone Kazamaty p.4":[[19,36],[12,13],[48,19],[4,9],[9,9],[31,18],[7,25],[45,39],[31,19],[16,22],[34,30],[41,41],[6,45],[29,42],[48,38],[32,10],[5,30]],"Nawiedzone Kazamaty p.5":[[4,41],[26,13],[49,27],[9,33],[6,15],[31,35],[10,20],[4,43],[41,26],[8,16]],"Nawiedzone Kazamaty p.6":[[27,36]]}},"CzarujÄ ca Atalia":{"lvl":157,"prof":"m","spawns":{"1293":[[5,5],[46,56],[10,59],[82,4],[62,50],[89,24]],"1294":[[34,11],[54,12],[27,16],[46,40],[19,51]],"1297":[[45,4],[55,11],[44,54],[75,33],[1,43]],"1298":[[7,7],[9,16]],"1299":[[17,7],[23,13],[19,6]],"1300":[[5,8]],"1301":[[6,8],[2,6]],"1303":[[15,10],[11,13]],"1308":[[4,5],[9,10]]}},"ĹwiÄty Braciszek":{"lvl":165,"prof":"b","spawns":{"Dom Rumiry i Dobromira p.1":[[5,7]],"Sklep z winem":[[5,7]],"Dom Wazira":[[6,6]],"Magazyn win p.1":[[6,5]],"Jezioro WaĹźek":[[17,11],[86,9],[7,57],[59,43]],"PachnÄ cy GÄ szcz":[[88,43],[26,44],[28,5]],"Las Zadumy":[[11,30],[46,47],[85,23]],"Agia Triada":[[67,38],[18,57],[34,21],[59,43]],"Grota DrÄ ĹźÄ cych Kropli p.1":[],"Grota DrÄ ĹźÄ cych Kropli p.2":[[11,8]],"Klasztor RóşanitĂłw - korytarz wejĹciowy":[[6,8],[5,8]],"Klasztor RóşanitĂłw - pomieszczenie gospodarcze":[[9,12]],"Klasztor RóşanitĂłw - klasztorny browar":[[12,6]],"Klasztor RóşanitĂłw - klasztorna piekarnia":[[2,10]],"Klasztor RóşanitĂłw - warsztat":[[12,6]],"Klasztor RóşanitĂłw - wirydarz":[[8,14]],"Klasztor RóşanitĂłw - dormitoria":[[13,15]],"Klasztor RóşanitĂłw - refektarz":[[4,22]],"Klasztor RóşanitĂłw - fraternia":[[5,15]],"Klasztor RóşanitĂłw - dzwonnica":[[11,8]],"Klasztor RóşanitĂłw - piwniczka":[[6,6]],"Klasztor RóşanitĂłw - lawaterz":[[3,10]],"Klasztor RóşanitĂłw - klatka schodowa":[[8,8],[8,12]],"Klasztor RóşanitĂłw - kapitularz":[[3,15]],"Klasztor RóşanitĂłw - ĹwiÄ tynia":[[44,25],[8,14]],"Klasztor RóşanitĂłw - magazyn ksiÄ g":[[11,5]],"Klasztor RóşanitĂłw - cela opata":[[10,6]],"Klasztor RóşanitĂłw - wieĹźa pĹn.-zach. p.1":[[9,12]],"Klasztor RóşanitĂłw - wieĹźa pĹn.-zach. p.2":[[10,12]],"Klasztor RóşanitĂłw - wieĹźa pĹn.-wsch. p.1":[[4,11]],"Klasztor RóşanitĂłw - strych p.1":[[20,12]],"Klasztor RóşanitĂłw - strych p.2":[[31,6],[22,20]],"Tunel pod SkaĹÄ p.1":[[14,53],[13,54]],"Tunel pod SkaĹÄ p.2":[[45,41]],"Tunel pod SkaĹÄ p.3":[[10,24]],"Ogrza kawerna p.1":[[26,4]],"Ogrza kawerna p.2":[[49,18]],"Ogrza kawerna p.3":[[26,16],[52,8]]}},"Viviana Nandid":{"lvl":184,"prof":"h","spawns":{"2056":[[16,6],[85,13],[68,46],[85,51],[8,26],[8,9],[56,14],[63,5],[22,23]],"Rozlewisko Kai":[[1,8],[28,14],[41,8],[12,32],[14,14],[71,62],[21,48],[13,55],[27,53],[75,26],[46,50],[42,14]],"Ruiny Tass Zhil":[[37,5],[57,21],[21,7],[55,40],[67,18],[50,12],[80,1],[10,45],[8,10],[59,52],[5,41],[37,5],[14,58],[62,58]],"BĹota Sham Al":[[31,3],[51,11],[35,26],[5,40],[6,26],[32,38],[30,10]],"Gvar Hamryd":[[15,6],[72,5],[50,37],[63,19],[73,50],[3,27],[86,39],[6,44],[16,60],[90,27],[32,60],[25,26],[32,37],[53,35],[44,57],[77,60],[39,35]]}},"Mulher Ma":{"lvl":197,"prof":"b","spawns":{"114":[[71,4],[33,44],[25,18]],"574":[[22,3]],"575":[[14,53]],"730":[[90,9],[93,61]],"731":[[91,33],[14,4]],"865":[[11,5]],"1992":[[19,18]],"2002":[[4,17]],"2020":[[22,36],[48,41],[15,40],[76,58],[70,37],[74,58]],"2056":[[13,49],[65,38],[89,41]],"2063":[[18,48],[52,11]],"2126":[[7,6]],"2127":[[8,13]],"2163":[[6,8]],"2183":[[10,11],[18,14]],"2432":[[4,5]]}},"Demonis Pan NicoĹci":{"lvl":210,"prof":"m","spawns":{"971":[[14,15],[30,41],[30,32],[59,34],[15,34],[33,7],[15,17]],"973":[[48,33],[73,24],[89,49],[48,53],[48,14],[24,30],[23,30],[48,13],[48,34],[88,50],[73,23]],"974":[[15,27]],"975":[[18,11],[44,33],[18,12]],"976":[[32,44],[50,45],[50,46]],"977":[[47,45]]}},"Vapor Veneno":{"lvl":227,"prof":"w","spawns":{"1399":[[14,10],[63,9]],"1448":[[63,50],[63,23],[81,36],[53,7],[91,10],[40,37]],"1449":[[81,34],[86,52],[57,34],[53,51],[14,50],[32,33],[87,59],[27,35]],"1458":[[30,20],[2,25],[77,42],[51,29]],"1464":[[9,18]],"2902":[[20,23],[37,26]],"3135":[[50,57],[11,24],[29,47],[14,4],[17,45],[34,19],[58,34]],"3136":[[40,84],[47,11],[29,7],[24,74],[24,43],[12,52],[57,28],[54,76],[37,53],[43,29]],"3137":[[57,50],[49,39],[57,14],[33,29],[23,9]],"3138":[[37,83],[38,56],[18,57],[47,46],[50,87]],"3209":[[55,80],[52,60],[24,46],[39,51],[10,7],[8,78],[8,49],[31,78]]}},"DÄboroĹźec":{"lvl":242,"prof":"w","spawns":{"3594":[[28,28],[41,46],[11,21],[80,50]],"3595":[[33,28],[75,27],[85,50]],"3596":[[40,8],[58,26],[60,50]],"3597":[[31,83],[2,31]],"3598":[[34,11],[46,48]],"3610":[[39,11],[7,57],[52,45]],"3611":[[30,9]],"3612":[[19,17],[17,17]],"3613":[[21,8],[52,22]],"3614":[[11,15]],"3615":[[13,11]],"3620":[[7,13]],"3621":[[11,18]],"3622":[[36,22]],"3623":[[17,17]],"3624":[[12,19]],"3625":[[23,27]],"3626":[[9,12]],"3627":[[20,23]]}},"Tepeyollotl":{"lvl":260,"prof":"b","spawns":{"1901":[[50,11],[18,71],[45,20],[24,33],[19,49]],"1924":[[10,7],[70,22],[76,47]],"1926":[[8,76],[11,16],[12,87],[5,76]],"1963":[[9,6]],"1964":[[17,7]],"1966":[[16,27]],"1982":[[13,19]],"3029":[[8,10]],"3030":[[10,20]],"3031":[[10,13]],"3032":[[49,22],[11,15],[17,35]],"3033":[[12,40],[70,40]],"3034":[[19,19]],"3035":[[31,31]],"3036":[[13,40],[14,40],[16,19],[16,8]],"3037":[[30,26],[37,13]],"3038":[[24,6],[21,32]],"3039":[[32,72]],"3040":[[12,12]],"3041":[[17,15],[15,12]],"3042":[[21,25],[22,24]],"3043":[[22,41],[32,11],[54,9],[9,19]]}},"MĹody Smok":{"lvl":282,"prof":"m","spawns":{"Pustynia Shaiharrud - wschĂłd":[[5,2],[47,24],[24,61],[4,38],[21,76]],"Pustynia Shaiharrud - zachĂłd":[[4,19],[26,8],[52,38],[22,85]],"Urwisko Vapora":[[64,37],[83,48],[29,46],[20,58]],"Jaskinia SÄpa s.1":[[27,11]],"Jaskinia Piaskowej Burzy s.1":[[16,8]],"Jaskinia Smoczej Paszczy p.1":[[31,34]],"Jaskinia Smoczej Paszczy p.2":[[25,27]],"Jurta Nomadzka":[[3,6]],"Jaskinia Piaskowej Burzy s.2":[[5,20]],"ĹwiÄ tynia Hebrehotha - przedsionek":[[26,12]],"SkaĹy UmarĹych":[[31,87],[54,70],[60,30],[30,31]],"Jaskinia PrĂłby":[[14,19]],"Jaskinia Odwagi":[[31,40],[29,11]],"Smocze Skalisko":[[52,50],[67,27]],"SÄpiarnia":[[7,5]],"Grota PoĹwiÄcenia":[[4,21]]}}}; | |
var eliteDB = { | |
//elity do dziennego questa w margonem.com | |
"Masked Blaise": { | |
lvl: -1, | |
ver: "en", | |
//spawns: {196:[[8,5]]} w sumie to ich na caĹÄ mapÄ Ĺaduje wiÄc bez sensu | |
}, | |
"Cula Joshua": { | |
lvl: -1, | |
ver: "en", | |
spawns: {} | |
}, | |
"Mola Nito": { | |
lvl: -1, | |
ver: "en", | |
spawns: {} | |
}, | |
"Toto Acirfa": { | |
lvl: -1, | |
ver: "en", | |
spawns: {} | |
}, | |
"Masked Roman": { | |
lvl: -1, | |
ver: "en", | |
spawns: {} | |
}, | |
"Possessed Fissit": { | |
lvl: -1, | |
ver: "en", | |
spawns: {} | |
}, | |
"Soda": { | |
lvl: -1, | |
ver: "en", | |
spawns: {} | |
}, | |
"Molybdenum Matityahu": { | |
lvl: -1, | |
ver: "en", | |
spawns: {} | |
}, | |
"Hummopapa": { | |
lvl: -1, | |
ver: "en", | |
spawns: {} | |
}, | |
"Shponder":{ | |
lvl: -1, | |
ver:"en", | |
spawns:{} | |
}, | |
"Mobile Jeecus":{ | |
lvl: -1, | |
ver:"en", | |
spawns:{} | |
} | |
}; | |
this.getHerosDB = function() { | |
return herosDB; | |
}; | |
var niceSettings = new (function(options) { | |
var self = this; | |
var {get, set, data, header, onSave} = options; | |
var panels = {}; | |
var $currentPanel = false; | |
var $activeLPanelEntry; | |
var $rpanel; | |
var $wrapper; | |
var shown = false; | |
this.toggle = function() { | |
var lock = interface == "new" ? Engine.lock : (interface == "old" ? g.lock : null); | |
if (shown) { | |
if (lock) lock.remove("ns-"+header); | |
else global.dontmove = false; | |
$wrapper.style["display"] = "none"; | |
} else { | |
if (lock) lock.add("ns-"+header); | |
else global.dontmove = true; | |
$wrapper.style["display"] = "block"; | |
}; | |
shown = !shown; | |
}; | |
this.initHTML = function() { | |
$wrapper = document.createElement("div"); | |
$wrapper.classList.add("ns-wrapper"); | |
document.body.appendChild($wrapper); | |
var $header = document.createElement("div"); | |
$header.innerHTML = header + " - ustawienia"; | |
$header.classList.add("ns-header"); | |
$wrapper.appendChild($header); | |
var $close = document.createElement("div"); | |
$close.innerHTML = "X"; | |
$close.classList.add("ns-close"); | |
$close.addEventListener("click", this.toggle); | |
$wrapper.appendChild($close); | |
var $panels = document.createElement("div"); | |
$panels.classList.add("ns-panels"); | |
$wrapper.appendChild($panels); | |
var $lpanel = document.createElement("div"); | |
$lpanel.addEventListener("click", this.lPanelClick); | |
$lpanel.classList.add("ns-lpanel"); | |
$panels.appendChild($lpanel); | |
$rpanel = document.createElement("div"); | |
$rpanel.classList.add("ns-rpanel"); | |
$rpanel.addEventListener("click", this.globalRpanelHandler); | |
$panels.appendChild($rpanel); | |
$lpanel.innerHTML = this.generateLpanelHtml(); | |
this.genereteRpanels(); | |
}; | |
this.lPanelClick = function(e) { | |
if (e.target.dataset["name"]) { | |
self.togglePanel(e.target.dataset["name"]); | |
if ($activeLPanelEntry) $activeLPanelEntry.classList.remove("active"); | |
$activeLPanelEntry = e.target; | |
$activeLPanelEntry.classList.add("active"); | |
}; | |
}; | |
this.globalRpanelHandler = function(e) { | |
var tar = e.target; | |
if (tar.dataset["listbtt"]) { | |
var key = tar.dataset["listbtt"]; | |
var $content = document.querySelector(".ns-list-content[data-list='"+key+"']"); | |
var $input = document.querySelector("input[data-list='"+key+"']"); | |
self.adddContentToList($content, $input); | |
} else if (tar.dataset["listitem"]) { | |
tar.remove(); | |
}; | |
}; | |
this.adddContentToList = function($content, $input) { | |
var val = $input.value; | |
if (val == "") return; | |
$input.value = ""; | |
var items = this.getContentItems($content); | |
if (items.indexOf(val) > -1) return | |
var $div = document.createElement("div"); | |
$div.classList.add("ns-list-item"); | |
$div.dataset["listitem"] = "1"; | |
$div.innerText = val; | |
$content.appendChild($div); | |
}; | |
this.getContentItems = function($content) { | |
var items = []; | |
for (var i=0; i<$content.children.length; i++) { | |
items.push($content.children[i].innerHTML); | |
}; | |
return items; | |
}; | |
this.togglePanel = function(name) { | |
if ($currentPanel) $currentPanel.remove(); | |
$currentPanel = panels[name]; | |
$rpanel.appendChild($currentPanel); | |
this.setAsyncPanelContent(name); | |
}; | |
this.setAsyncPanelContent = function(name) { | |
var entries = options.data[name]; | |
for (var i=0; i<entries.length; i++) { | |
var entry = entries[i]; | |
if (entry.asyncid) { | |
entry.fun(val => { | |
var el = document.getElementById(entry.asyncid); | |
if (el) el.innerHTML = val; | |
}); | |
}; | |
}; | |
}; | |
this.genereteRpanels = function() { | |
for (var name in data) { | |
this.generateRpanel(name, data[name]); | |
}; | |
}; | |
this.generateRpanel = function(name, content) { | |
var $panel = document.createElement("div"); | |
panels[name] = $panel; | |
var html = ""; | |
for (var i=0; i<content.length; i++) { | |
html += this.generateRpanelEntryHtml(content[i]); | |
}; | |
$panel.innerHTML = html; | |
var $btt = document.createElement("div"); | |
$btt.innerHTML = "Zapisz"; | |
$btt.classList.add("ns-save-button"); | |
$btt.addEventListener("click", () => this.savePanel(name)); | |
$panel.appendChild($btt); | |
}; | |
this.generateRpanelEntryHtml = function(entry) { | |
var {type, special} = this.getEntryType(entry.type); | |
if (!special) { | |
var input = "<input data-key='"+entry.key+"' type='"+type+"' value='"+get(entry.key)+"'></input>"; | |
return this.getRpanelEntry(entry.name, input, entry.tip); | |
} else { | |
if (type == "range") { | |
var input = "<input data-key='"+entry.key+"' type='"+type+"' value='"+get(entry.key)*100+"' min='"+entry.data[0]*100+"' max='"+entry.data[1]*100+"'></input>"; | |
return this.getRpanelEntry(entry.name, input, entry.tip); | |
} else if (type == "checkbox") { | |
var input = "<input data-key='"+entry.key+"' type='"+type+"' "+(get(entry.key) ? "checked" : "")+"></input>"; | |
return this.getRpanelEntry(entry.name, input, entry.tip); | |
} else if (special == "char") { | |
var input = "<input data-key='"+entry.key+"' type='"+type+"' value='"+String.fromCharCode(get(entry.key))+"' maxlength='1' style='width: 10px; text-align: center'></input>"; | |
return this.getRpanelEntry(entry.name, input, entry.tip); | |
} else if (special == "noinput") { | |
if (type != "async") { | |
return this.getRpanelEntry(entry.t1, entry.t2, entry.tip); | |
} else { | |
var id = "NS-async-"+Math.random()*10; | |
entry.asyncid = id; | |
return this.getRpanelEntry(entry.t1, "<div id='"+id+"'>"+entry.placeholder+"</div>", entry.tip); | |
}; | |
} else if (type == "list") { | |
return this.generateListInput(entry); | |
}; | |
}; | |
}; | |
this.generateListInput = function(entry) { | |
var list = get(entry.key); | |
var html; | |
html = "<div class='ns-list-wrapper'>"; | |
html += "<div class='ns-list-header'>"+entry.name+"</div>"; | |
html += "<div class='ns-list-content' data-list='"+entry.key+"'>"; | |
for (var i=0; i<list.length; i++) { | |
html += "<div class='ns-list-item' data-listitem='1'>"+list[i]+"</div>"; | |
}; | |
html += "</div>"; | |
html += "<div class='ns-list-bottombar'>"; | |
html += "<div class='ns-list-input'><input data-list='"+entry.key+"' type='text'></div>"; | |
html += "<div class='ns-list-addbtt' data-listbtt='"+entry.key+"'>+</div>"; | |
html += "</div>"; | |
html += "</div>"; | |
return html; | |
}; | |
this.getRpanelEntry = function(txt, input, tip) { | |
return "<div "+(tip ? (interface == "new" ? "data-tip" : "tip") + "='"+tip+"'" : "")+" class='ns-rpanel-entry'><div class='ns-rpanel-entry-left'>"+txt+"</div><div class='ns-rpanel-entry-right'>"+input+"</div></div>"; | |
}; | |
this.getEntryType = function(entrytype) { | |
var special = false; | |
switch (entrytype) { | |
case "string": | |
var type = "text"; | |
break; | |
case "color": | |
var type = "color"; | |
break; | |
case "range": | |
special = true; | |
var type = "range"; | |
break; | |
case "check": | |
special = true; | |
var type = "checkbox"; | |
break; | |
case "char": | |
special = "char"; | |
var type = "text"; | |
break; | |
case "list": | |
special = true; | |
var type = "list"; | |
break; | |
case "numstring": | |
var type = "number"; | |
break; | |
case "info-async": | |
var type = "async"; | |
special = "noinput"; | |
break; | |
default: | |
special = "noinput"; | |
}; | |
return { | |
type: type, | |
special: special | |
}; | |
} | |
this.generateLpanelHtml = function() { | |
var html = ""; | |
for (var name in data) { | |
html += "<div class='ns-lpanel-entry' data-name='"+name+"'>"+name+"</div>"; | |
}; | |
return html; | |
}; | |
this.savePanel = function(name) { | |
var panel = data[name]; | |
for (var i=0; i<panel.length; i++) { | |
this.savePanelEntry(panel[i]); | |
}; | |
onSave(); | |
}; | |
this.savePanelEntry = function(entry) { | |
var {type, special} = this.getEntryType(entry.type); | |
if (!special) { | |
var val = this.getEntryValue(entry.key); | |
if (type == "number") { | |
val = parseInt(val); | |
if (isNaN(val)) return; | |
}; | |
set(entry.key, val); | |
} else { | |
if (type == "range") { | |
set(entry.key, this.getEntryValue(entry.key)/100); | |
} else if (type == "checkbox") { | |
set(entry.key, this.getCheckboxState(entry.key)); | |
} else if (special == "char") { | |
var val = this.getEntryValue(entry.key).toUpperCase().charCodeAt(0); | |
if (isNaN(val)) return; | |
set(entry.key, val); | |
} else if (type == "list") { | |
var $content = document.querySelector(".ns-list-content[data-list='"+entry.key+"']"); | |
var items = this.getContentItems($content); | |
set(entry.key, items); | |
}; | |
}; | |
}; | |
this.getEntryValue = function(key) { | |
return document.querySelector("input[data-key='"+key+"']").value; | |
}; | |
this.getCheckboxState = function(key) { | |
return document.querySelector("input[data-key='"+key+"']").checked; | |
}; | |
this.initCss = function() { | |
var css = ` | |
.ns-wrapper { | |
width: 600px; | |
height: 600px; | |
background: rgba(0,0,0,.8); | |
border: 2px solid #222222; | |
border-radius: 20px; | |
position: absolute; | |
left: calc(50% - 300px); | |
top: calc(50% - 300px); | |
z-index: 500; | |
color: white; | |
display: none; | |
${interface == "superold" ? "transform: scale(0.8, 0.8);" : ""} | |
} | |
.ns-wrapper .ns-close { | |
width: 30px; | |
height: 30px; | |
font-size: 20px; | |
line-height: 30px; | |
text-align: center; | |
background: rgba(0,0,0,.6); | |
transition: background .1s ease-in-out; | |
position: absolute; | |
right: 3px; | |
top: 3px; | |
cursor: pointer; | |
} | |
.ns-wrapper .ns-close:hover { | |
background: rgba(0,0,0,.9); | |
} | |
.ns-wrapper .ns-header { | |
border-bottom: 1px solid #333333; | |
font-size: 26px; | |
padding-left: 15px; | |
color: white; | |
height: 39px; | |
line-height: 40px; | |
background: rgba(50,50,50,.8); | |
} | |
.ns-wrapper .ns-panels { | |
height: 560px; | |
} | |
.ns-wrapper .ns-panels .ns-lpanel { | |
height: 560px; | |
width: 200px; | |
border-right: 1px solid #333333; | |
float: left; | |
} | |
.ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry { | |
width: 75%; | |
height: 30px; | |
line-height: 30px; | |
font-size: 19px; | |
padding-left: 5px; | |
background: linear-gradient(to right, rgba(100,100,100,0.45) , rgba(100,100,100,0)); | |
transition: all .15s ease-in-out; | |
cursor: pointer; | |
margin-bottom: 1px; | |
} | |
.ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry.active { | |
background: linear-gradient(to right, rgba(150,150,150,0.45) , rgba(150,150,150,0)); | |
width: 100%; | |
padding-left: 13px; | |
} | |
.ns-wrapper .ns-panels .ns-lpanel .ns-lpanel-entry:hover { | |
width: 100%; | |
padding-left: 13px; | |
} | |
.ns-wrapper .ns-panels .ns-rpanel { | |
height: 560px; | |
width: 390px; | |
float: left; | |
} | |
.ns-wrapper .ns-panels .ns-rpanel .ns-rpanel-entry { | |
height: 30px; | |
margin: 3px; | |
line-height: 30px; | |
background: rgba(50,50,50,0.5); | |
} | |
.ns-panels .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-left { | |
float: left; | |
height: 30px; | |
width: 180px; | |
padding-left: 6px; | |
} | |
.ns-panels .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right { | |
float: right; | |
height: 30px; | |
width: 180px; | |
text-align: right; | |
padding-right: 6px; | |
} | |
.ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='color'] { | |
background: black; | |
border: none; | |
transition: background .15s ease-in-out; | |
} | |
.ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='color']:hover { | |
background: #282828; | |
} | |
.ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='text'], .ns-rpanel .ns-rpanel-entry .ns-rpanel-entry-right input[type='number'] { | |
background: rgba(0,0,0,0.8); | |
border: 1px solid black; | |
width: 80px; | |
color: #CCCCCC; | |
text-align: right; | |
} | |
.ns-rpanel .ns-save-button { | |
position: absolute; | |
bottom: 10px; | |
right: 10px; | |
height: 30px; | |
width: 70px; | |
font-size: 20px; | |
line-height: 30px; | |
text-align: center; | |
border: 1px solid #333333; | |
background: rgba(50,50,50,0.5); | |
cursor: pointer; | |
transition: background .1s ease-in-out; | |
} | |
.ns-rpanel .ns-save-button:hover { | |
background: rgba(50,50,50,0.7); | |
} | |
.ns-list-wrapper { | |
background: rgba(50,50,50,0.5); | |
width: 350px; | |
margin: 10px; | |
border: 1px solid #333333; | |
} | |
.ns-list-wrapper .ns-list-header { | |
text-align: center; | |
height: 20px; | |
font-size: 15px; | |
line-height: 20px; | |
} | |
.ns-list-wrapper .ns-list-content { | |
min-height: 80px; | |
max-height: 1700px; | |
overflow-y: auto; | |
border-top: 1px solid #333333; | |
border-bottom: 1px solid #333333; | |
} | |
.ns-list-wrapper .ns-list-content .ns-list-item { | |
cursor: pointer; | |
margin: 1px; | |
background: rgba(50,50,50,0.4); | |
text-align: center; | |
height: 15px; | |
line-height: 15px; | |
font-size: 12px; | |
} | |
.ns-list-wrapper .ns-list-bottombar { | |
height: 20px; | |
} | |
.ns-list-wrapper .ns-list-bottombar .ns-list-input { | |
float: left; | |
width: 270px; | |
} | |
.ns-list-wrapper .ns-list-bottombar .ns-list-input input { | |
background: rgba(0,0,0,0.8); | |
border: 1px solid black; | |
color: #CCCCCC; | |
width: 320px; | |
} | |
.ns-list-wrapper .ns-list-bottombar .ns-list-addbtt { | |
width: 20px; | |
float: right; | |
text-align: center; | |
line-height: 20px; | |
background: rgba(50,50,50,0.6); | |
cursor: pointer; | |
} | |
.ns-list-wrapper .ns-list-bottombar .ns-list-addbtt:hover { | |
background: rgba(50,50,50,0.9); | |
} | |
`; | |
var $style = document.createElement("style"); | |
$style.innerHTML = css; | |
document.head.appendChild($style); | |
}; | |
this.init = function() { | |
this.initHTML(); | |
this.initCss(); | |
}; | |
})({ | |
get: settings.get, | |
set: settings.set, | |
onSave: this.onSettingsUpdate, | |
header: "miniMapPlus", | |
data: { | |
"Kolory": [ | |
{ | |
key: "/colors/hero", | |
name: "Twoja postaÄ", | |
type: "color" | |
}, | |
{ | |
key: "/colors/other", | |
name: "Inni gracze", | |
type: "color" | |
}, | |
{ | |
key: "/colors/friend", | |
name: "Znajomi", | |
type: "color" | |
}, | |
{ | |
key: "/colors/enemy", | |
name: "Wrogowie", | |
type: "color" | |
}, | |
{ | |
key: "/colors/clan", | |
name: "Klanowicze", | |
type: "color" | |
}, | |
{ | |
key: "/colors/ally", | |
name: "Sojusznicy", | |
type: "color" | |
}, | |
{ | |
key: "/colors/npc", | |
name: "ZwykĹy NPC", | |
type: "color" | |
}, | |
{ | |
key: "/colors/mob", | |
name: "ZwykĹy mob", | |
type: "color" | |
}, | |
{ | |
key: "/colors/elite", | |
name: "Elita", | |
type: "color" | |
}, | |
{ | |
key: "/colors/elite2", | |
name: "Elita II/eventowa", | |
type: "color" | |
}, | |
{ | |
key: "/colors/elite3", | |
name: "Elita III", | |
type: "color" | |
}, | |
{ | |
key: "/colors/heros", | |
name: "Heros", | |
type: "color" | |
}, | |
{ | |
key: "/colors/titan", | |
name: "Tytan", | |
type: "color" | |
}, | |
{ | |
key: "/colors/item", | |
name: "Przedmiot", | |
type: "color" | |
}, | |
{ | |
key: "/colors/gw", | |
name: "PrzejĹcie", | |
type: "color" | |
} | |
], | |
"WyglÄ d mapy": [ | |
{ | |
key: "/mapsize", | |
name: "Rozmiar mapy", | |
type: "range", | |
tip: "Zmiany widoczne po odĹwieĹźeniu gry", | |
data: [0.6, 1.4] | |
}, | |
{ | |
key: "/opacity", | |
name: "WidocznoĹÄ mapy", | |
type: "range", | |
data: [0.5, 1] | |
}, | |
{ | |
key: "/darkmode", | |
name: "Motyw ciemny", | |
type: "check" | |
} | |
], | |
"Tracking": [ | |
{ | |
type: "info", | |
t1: "Co to jest?", | |
t2: "", | |
tip: "Tracking (tropienie) to alternatywna opcja wyszukiwania NPC/itemĂłw na mapie. Polega na tym, Ĺźe gdy na mapie pojawi siÄ coĹ z poniĹźszej listy, w oknie gry ukaĹźe siÄ strzaĹka, ktĂłra bÄdzie wzkazywaĹa drogÄ do tej rzeczy.<br>Dodatkowo gdy na mapie pojawia siÄ heros, automatycznie uruchamia siÄ tracking na niego, co jest przydatne np. w podchodzeniu do herosĂłw eventowych." | |
}, | |
{ | |
key: "/trackedNpcs", | |
name: "Tracking NPC", | |
type: "list" | |
}, | |
{ | |
key: "/trackedItems", | |
name: "Tracking itemĂłw", | |
type: "list" | |
} | |
], | |
"Inne": [ | |
{ | |
key: "/minlvl", | |
name: "Min. lvl potworkĂłw", | |
type: "numstring" | |
}, | |
{ | |
key: "/maxlvl", | |
name: "Max. przewaga", | |
tip: "Maksymalna róşnica poziomĂłw miÄdzy TobÄ a potworkiem przy ktĂłrej nie niszczy siÄ loot na Ĺwiecie na ktĂłrym grasz. JeĹli nie wiesz co to, zostaw 13.", | |
type: "numstring" | |
}, | |
{ | |
key: "/show", | |
name: "Hotkey", | |
type: "char" | |
}, | |
{ | |
key: "/altmobilebtt", | |
name: "PrzesuĹ przycisk mobilny", | |
type: "check", | |
tip: "Przesuwa przycisk widoczny na urzÄ dzeniach mobilnych pomiÄdzy torby" | |
}, | |
{ | |
key: "/interpolerate", | |
name: "Animacje na mapie", | |
type: "check" | |
}, | |
{ | |
key: "/showqm", | |
name: "Zaznaczaj questy", | |
type: "check" | |
}/*, | |
{ | |
key: "/showevonetwork", | |
name: "Pokazuj postacie z WSync", | |
tip: "World Sync to dodatek stworzony przez CcarderRa, ktĂłry pozwala widzieÄ graczy z innych ĹwiatĂłw. Jest czÄĹciÄ Evolution Managera, ktĂłrego moĹźna znaleĹşÄ na forum w dziale Dodatki do gry.", | |
type: "check" | |
}*/ | |
], | |
"Informacje": [ | |
{ | |
type: "info", | |
t1: "Wersja", | |
t2: "v"+this.version+(interface == "new" ? " NI" : (interface == "old" ? " SI" : " OM")) | |
}, | |
{ | |
type: "info", | |
t1: "ĹšrĂłdĹo instalacji", | |
t2: this.getInstallSource() | |
}, | |
{ | |
type: "info-async", | |
t1: "Licznik instalacji", | |
placeholder: "wczytywanie...", | |
tip: "Liczy od wersji 3.1 minimapy", | |
fun: this.installationCounter.get | |
} | |
] | |
} | |
}); | |
this.goTo(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment