« Popup.js » : différence entre les versions

De Wiki The-West FR
Aller à la navigation
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 1 : Ligne 1 :
westui={lang:{input_level:"Niveau",input_search:"Recherche",damages:"Dégâts",per_level:"par Niveau",speed:"Vitesse",level:"Niveau",unsalable:"Non vendable",auction:"Peut être acheté/vendu aux enchères",not_auction:"Ne peut pas être acheté/vendu aux enchères",not_upgrade:"Non améliorable",upgrade:"Améliorable",total:"Total",popup:{dmg:{dglvl:'<p class="popup_dmg">+ #1 Dégâts#2</p>'},skills:{fo:'<p class="popup_attribute">+ #1 Force#2</p>',mo:'<p class="popup_attribute">+ #1 Mobilité#2</p>',ha:'<p class="popup_attribute">+ #1 Habileté#2</p>',ch:'<p class="popup_attribute">+ #1 Charisme#2</p>',co:'<p class="popup_skill">+ #1 Construction#2</p>',pu:'<p class="popup_skill">+ #1 Puissance#2</p>',te:'<p class="popup_skill">+ #1 Ténacité#2</p>',pe:'<p class="popup_skill">+ #1 Persévérance#2</p>',pv:'<p class="popup_skill">+ #1 Points de vie#2</p>',mc:'<p class="popup_skill">+ #1 Monter à cheval#2</p>',rx:'<p class="popup_skill">+ #1 Réflexe#2</p>',ev:'<p class="popup_skill">+ #1 Eviter#2</p>',ca:'<p class="popup_skill">+ #1 Se cacher#2</p>',na:'<p class="popup_skill">+ #1 Nager#2</p>',vi:'<p class="popup_skill">+ #1 Viser#2</p>',ti:'<p class="popup_skill">+ #1 Tirer#2</p>',pi:'<p class="popup_skill">+ #1 Piéger#2</p>',de:'<p class="popup_skill">+ #1 Dextérité#2</p>',re:'<p class="popup_skill">+ #1 Réparer#2</p>',di:'<p class="popup_skill">+ #1 Diriger#2</p>',ta:'<p class="popup_skill">+ #1 Tactique#2</p>',ma:'<p class="popup_skill">+ #1 Marchander#2</p>',an:'<p class="popup_skill">+ #1 Manier les animaux#2</p>',pr:'<p class="popup_skill">+ #1 Prestance#2</p>'},fb:{fbdef:'<p class="popup_fb">+ #1 <b>Défense</b> (Bonus de BdF)</p>',fboff:'<p class="popup_fb">+ #1 <b>Attaque</b> (Bonus de BdF)</p>',fbres:'<p class="popup_fb">+ #1 <b>Résistance</b> (Bonus de BdF)</p>',fbdefs:'<p class="popup_fb">+ #1 <b>Défense</b> (Bonus de secteur de BdF)</p>',fboffs:'<p class="popup_fb">+ #1 <b>Attaque</b> (Bonus de secteur de BdF)</p>',fbdmgs:'<p class="popup_fb">+ #1 <b>Dégâts</b> (Bonus de secteur de BdF)</p>'},special:{xp:'<p class="popup_txtgreen">+ #1% d\'expérience pour les travaux, duels et batailles de fort#2</p>',money:'<p class="popup_txtgreen">+ #1% d\'argent en travaux et duels#2</p>',luck:'<p class="popup_txtgreen">+ #1% de probabilité de chance en plus#2</p>',regen:'<p class="popup_txtgreen">+ #1% Régénération#2</p>',drop:'<p class="popup_txtgreen">+ #1% de chance de drop#2</p>',labor_pts:'<p class="popup_txtgreen">+ #1 points de travail#2</p>',spd:'<p class="popup_txtgreen">+ #1% Vitesse#2</p>'}}},config:{enable_set_calc:!0,plain_popup:!1,redirect_on_dblclick:!1,link_on_dblclick:!1,enable_sorting:!0,cdn:"https://westzz.innogamescdn.com",img_buyprice:"/images/2/22/Achat.png",img_sellprice:"/images/3/3b/Vente.png",img_male:"/images/8/83/Homme.png",img_female:"/images/8/8c/Femme.png",set_bonus:{fo:{name:"Force",img:"/images/thumb/0/09/Force.png/40px-Force.png"},mo:{name:"Mobilité",img:"/images/thumb/c/c1/Mobilit%C3%A9.png/40px-Mobilit%C3%A9.png"},ha:{name:"Habileté",img:"/images/thumb/1/1a/Habilet%C3%A9.png/40px-Habilet%C3%A9.png"},ch:{name:"Charisme",img:"/images/thumb/8/8f/Charisme.png/40px-Charisme.png"},co:{name:"Construire",img:"/images/thumb/0/0e/Construire.png/40px-Construire.png"},pu:{name:"Puissance",img:"/images/thumb/f/f4/Puissance.png/40px-Puissance.png"},te:{name:"Ténacité",img:"/images/thumb/8/85/T%C3%A9nacit%C3%A9.png/40px-T%C3%A9nacit%C3%A9.png"},pe:{name:"Persévérance",img:"/images/thumb/e/e9/Pers%C3%A9v%C3%A9rance.png/40px-Pers%C3%A9v%C3%A9rance.png"},pv:{name:"Points de vie",img:"/images/thumb/b/bb/Points_de_vie_aptitude.png/40px-Points_de_vie_aptitude.png"},mc:{name:"Monter à cheval",img:"/images/thumb/0/01/Monter_%C3%A0_cheval.png/40px-Monter_%C3%A0_cheval.png"},rx:{name:"Réflexe",img:"/images/thumb/5/52/R%C3%A9flexe.png/40px-R%C3%A9flexe.png"},ev:{name:"Eviter",img:"/images/thumb/f/ff/Eviter.png/40px-Eviter.png"},ca:{name:"Se cacher",img:"/images/thumb/5/5f/Se_cacher.png/40px-Se_cacher.png"},na:{name:"Nager",img:"/images/thumb/b/b8/Nager.png/40px-Nager.png"},vi:{name:"Viser",img:"/images/thumb/6/68/Viser.png/40px-Viser.png"},ti:{name:"Tirer",img:"/images/thumb/f/f9/Tirer.png/40px-Tirer.png"},pi:{name:"Piéger",img:"/images/thumb/2/26/Pi%C3%A9ger.png/40px-Pi%C3%A9ger.png"},de:{name:"Dextérité",img:"/images/thumb/4/4a/Dext%C3%A9rit%C3%A9.png/40px-Dext%C3%A9rit%C3%A9.png"},re:{name:"Réparer",img:"/images/thumb/c/cc/R%C3%A9parer.png/40px-R%C3%A9parer.png"},di:{name:"Diriger",img:"/images/thumb/b/b5/Diriger.png/40px-Diriger.png"},ta:{name:"Tactique",img:"/images/thumb/2/2c/Tactique.png/40px-Tactique.png"},ma:{name:"Marchander",img:"/images/thumb/c/ca/Marchander_aptitude.png/40px-Marchander_aptitude.png"},an:{name:"Manier les animaux",img:"/images/thumb/b/be/Manier_les_animaux.png/40px-Manier_les_animaux.png"},pr:{name:"Prestance",img:"/images/thumb/c/cb/Prestance.png/40px-Prestance.png"},fbdef:{name:"<b>Défense</b> (Bonus de bataille de fort)",img:"/images/thumb/2/2d/D%C3%A9fense.png/40px-D%C3%A9fense.png"},fboff:{name:"<b>Attaque</b> (Bonus de bataille de fort)",img:"/images/thumb/e/ef/Attaque.png/40px-Attaque.png"},fbres:{name:"<b>Résistance</b> (Bonus de bataille de fort)",img:"/images/4/4a/R%C3%A9sistance.png"},fbdefs:{name:"<b>Défense</b> (Bonus de secteur de bataille de fort)",img:"/images/thumb/2/2d/D%C3%A9fense.png/40px-D%C3%A9fense.png"},fboffs:{name:"<b>Attaque</b> (Bonus de secteur de bataille de fort)",img:"/images/thumb/e/ef/Attaque.png/40px-Attaque.png"},fbdmgs:{name:"<b>Dégâts</b> (Bonus de secteur de bataille de fort)",img:"/images/5/54/Dommages.png"},fbdmg:{name:"<b>Dégâts</b> (Bonus de bataille de fort)",img:"/images/5/54/Dommages.png"},xp:{name:"Expérience pour les travaux, duels et batailles de fort (%)",img:"/images/0/01/Xxp.png"},money:{name:"Argent en travaux et duels (%)",img:"/images/f/fd/Dollarb.png"},luck:{name:"Probabilité de chance en plus (%)",img:"/images/f/f0/Luck.png"},regen:{name:"Régénération (%)",img:"/images/4/44/R%C3%A9g%C3%A9n%C3%A9ration.png"},drop:{name:"Chance de drop améliorée pour les <b>produits</b> (%)",img:"/images/thumb/f/f6/Luck_prod.png/40px-Luck_prod.png"},labor_pts:{name:"Points de travail supplémentaires (sur tous les travaux)",img:"/images/d/df/Jobs.png"},spd:{name:"Vitesse",img:"/images/thumb/f/fb/Vitesse.png/40px-Vitesse.png"}},sorting:{Aucun:'{"id":1}',Force:'{"fo":1}',"Mobilité":'{"mo":1}',"Habileté":'{"ha":1}',Charisme:'{"ch":1}',Construction:'{"fo":1,"co":1}',Puissance:'{"fo":1,"pu":1}',"Ténacité":'{"fo":1,"te":1}',"Persévérance":'{"fo":1,"pe":1}',"Points de vie":'{"fo":1,"pv":1}',"Monter à cheval":'{"mo":1,"mc":1}',"Réflexe":'{"mo":1,"rx":1}',Eviter:'{"mo":1,"ev":1}',"Se cacher":'{"mo":1,"ca":1}',Nager:'{"mo":1,"na":1}',Viser:'{"ha":1,"vi":1}',Tirer:'{"ha":1,"ti":1}',"Piéger":'{"ha":1,"pi":1}',"Dextérité":'{"ha":1,"de":1}',"Réparer":'{"ha":1,"re":1}',Diriger:'{"ch":1,"di":1}',Tactique:'{"ch":1,"ta":1}',Marchander:'{"ch":1,"ma":1}',"Manier les animaux":'{"ch":1,"an":1}',Prestance:'{"ch":1,"pr":1}',"Points de travail pour construire":'{"fo":3,"co":3,"ha":1,"re":1,"ch":1,"di":1}',"Expérience pour les travaux, duels et batailles de fort (%)":'{"xp":1}',"Argent en travaux et duels (%)":'{"money":1}',"Probabilité de chance en plus (%)":'{"luck":1}',"Régénération (%)":'{"regen":1}',"Chance de drop (%)":'{"drop":1}',"Vitesse (%)":'{"spd":1,"hspd":1,"mo":1,"mc":1}',"Dégât moyen":'{"dgmin":0.5,"dgmax":0.5,"dglvl":1}',"Dégât maximal":'{"dgmax":1,"dglvl":1}',"Items améliorables":'{"bool":true,"upg":1}',"Items non améliorables":'{"bool":true,"upg":0}',"Items vendables aux enchères":'{"bool":true,"auc":1}',"Items non vendables aux enchères":'{"bool":true,"auc":0}',"Items pouvant être droppés":'{"bool":true,"drop":1}',"Items disponibles dans les magasins":'{"bool":true,"shop":1}',"Items nobles":'{"bool":true,"shop":0,"drop":1}'}},initPage:function(){if(1===$("#input_level").length)var e=$('<input type="number" style="width:80px;" class="west" placeholder="'+westui.lang.input_level+'" min="0" max="150">').bind("propertychange keyup input paste",function(){this.value>150?this.value=150:this.value<0&&(this.value=0),$(".calc").each(function(){0==e.val()?($(this).html(this.id),$(".per_level_off").addClass("per_level").removeClass("per_level_off")):($(this).html(Math.ceil(Number(this.id)*e.val())),$(".per_level").addClass("per_level_off").removeClass("per_level"))})}).appendTo($("#input_level"));if(1===$("#input_search").length){$('<input type="search" class="west" placeholder="'+westui.lang.input_search+'">').bind("propertychange keyup input paste",function(){var e=this.value.toLowerCase();""===e?$(".item_container").show():($(".item_container").hide(),$(".item_container").filter(function(){return $(this).attr("data-popup").toLowerCase().indexOf(e)>-1}).show())}).appendTo($("#input_search"))}1===$("#switch").length&&($("#fire").hide(),$("#switch").on("click",function(){$("#melee, #fire").toggle()})),1===$("#switch_prod").length&&($("#prod2").hide(),$("#switch_prod").on("click",function(){$("#prod, #prod2").toggle()})),westui.config.plain_popup&&new RegExp(mw.config.get("wgFormattedNamespaces")[10]+":Item_*").test(mw.config.get("wgPageName"))&&1===$(".item_container").length&&($("#mw-content-text").append('<center><div id="popup_plain" class="popup_window"><div class="popup_front"><div class="tw_bg_popup_tl"></div><div class="tw_bg_popup_tr"></div><div class="tw_bg_popup_bl"></div><div class="tw_bg_popup_br"></div></div><div id="popup_plain_contents" class="popup_contents"></div></div></center>'),$("#popup_plain").hide(),$("#popup_plain_contents").append(westui.popup.createPopup($(".item_container"),0)),$("#popup_plain").slideDown()),westui.config.redirect_on_dblclick&&$(".item_container img").on("dblclick",function(){window.location="/wiki/"+mw.config.get("wgFormattedNamespaces")[10]+":Item_"+JSON.parse($(this).parent().attr("data-popup")).id/1e3}),westui.config.link_on_dblclick&&$(".item_container img").on("dblclick",function(){window.location="/wiki/"+$(this).parent().attr("data-link")})},popup:{content:"",delay:200,active:!1,show:function(e){westui.popup.content=westui.popup.createPopup($(e),parseInt($(e).attr("data-lvl"))),westui.popup.active=!0,westui.popup.setTimeout(),westui.popup.getContainer().html(westui.popup.content)},hide:function(){westui.popup.getEl().css({display:"none",top:0,left:0}),westui.popup.active=!1,westui.popup.clearTimeout()},setTimeout:function(){westui.popup.clearTimeout(),westui.popup.timer=window.setTimeout(function(){westui.popup.getEl().css("display","block")},westui.popup.delay)},clearTimeout:function(){westui.popup.timer&&window.clearTimeout(westui.popup.timer)},getEl:function(){return $("#popup_window")},getContainer:function(){return $("#popup_contents")},createPopup:function(e,t){var a=JSON.parse(e.attr("data-popup")),i=e.attr("data-cache"),s=(e.attr("data-cdn-cat"),e.attr("data-cdn-img"),'<div class="popup_image"><img src="'+westui.config.cdn+"/images/items/"+a.cdn_cat+"/"+a.cdn_img+".png"+(i?"?"+i:"")+'"/></div><div class="popup_divider"></div><p class="popup_name">'+a.name+'</p><p class="popup_type">'+a.type+"</p><br/>"),p=!1;if(t>=1&&t<=5&&(p=!0,a.auc=!1),a.dgmin&&a.dgmax&&(p&&(a.dgmin+=Math.round(Math.max(1,.1*a.dgmin*t)),a.dgmax+=Math.round(Math.max(1,.1*a.dgmax*t))),s+='<p class="popup_dmg">'+a.dgmin+"-"+a.dgmax+" "+westui.lang.damages+"</p>"),a.text){for(var n=0;n<a.text.length;n++)s+='<p class="popup_text">'+a.text[n]+"</p>";s+="<br/>"}for(var o in westui.lang.popup){var l=0;for(var c in westui.lang.popup[o])if(a.hasOwnProperty(c)){l++;var r="";a[c]<0?$("#input_level input").val()>0?(a[c]=Math.ceil($("#input_level input").val()*-a[c]),p&&(a[c]+=Math.round(Math.max(1,.1*a[c]*t)))):(a[c]=-a[c],r=" ("+westui.lang.per_level+")",p&&(a[c]=Math.round(1e6*(1*a[c]+Math.round(Math.max(1,1e3*a[c]*t))/1e4))/1e6)):p&&(a[c]<1?a[c]=Math.round(1e6*(1*a[c]+Math.round(Math.max(1,1e3*a[c]*t))/1e4))/1e6:a[c]+=Math.round(Math.max(1,.1*a[c]*t))),s+=westui.lang.popup[o][c].replace("#1",a[c]).replace("#2",r)}l>0&&(s+="<br/>")}if(a.textjob){for(var n=0;n<a.textjob.length;n++)s+='<p class="popup_txtgreen">'+a.textjob[n]+"</p>";s+="<br/>"}if(a.bonus){for(var n=0;n<a.bonus.length;n++)s+='<p class="popup_bonus">'+a.bonus[n]+"</p>";s+="<br/>"}if(a.jobs){s+='<div style="text-align:center;"><table class="popup_job">';for(var n=0;n<a.jobs.length;n++)s+='<tr><td><img src="'+westui.config.cdn+"/images/jobs/"+a.jobs[n][1]+'.png"/></td><td><span>&nbsp;&nbsp;'+a.jobs[n][0]+"</span></td></tr>";s+="</table></div>"}if(a.craft){s+='<div style="text-align:center;"><table  class="popup_crafteditem"><tr><td><img src="'+westui.config.cdn+"/images/crafting/profsymbol_"+a.craft.id+'_small.png"/></td><td><table><tr>';for(var n=0;n<a.craft.req.length;n++)s+='<td><img style="width:36px;height:36px;" src="'+westui.config.cdn+"/images/items/yield/"+a.craft.req[n][0]+'.png"/></td>';s+="</tr><tr>";for(var n=0;n<a.craft.req.length;n++)s+="<td><span>x"+a.craft.req[n][1]+"</span></td>";s+="</tr></table></td></tr></table></div>"}return s+='<div class="popup_infos">',a.hspd&&(p&&(a.hspd+=Math.round(Math.max(1,.1*a.hspd*t))),s+='<p class="popup_speed">'+westui.lang.speed+": +"+a.hspd+"%</p><br/>"),a.set&&(s+='<p><a class="popup_set" href="/wiki/'+a.set+'">'+a.set+"</a></p><br/>"),a.sp?s+='<img src="'+westui.config.img_buyprice+'"/>'+a.bp+'&nbsp;&nbsp;&nbsp;&nbsp;<img src="'+westui.config.img_sellprice+'"/>&nbsp;'+a.sp+"<br/><br/>":s+="<i>"+westui.lang.unsalable+"</i><br/><br/>",a.lvl&&(s+=westui.lang.level+" <b>"+a.lvl+"</b><br/>"),a.sex&&(0==a.sex?s+='<img src="'+westui.config.img_male+'"/>&nbsp;&nbsp;&nbsp;':s+='<img src="'+westui.config.img_female+'"/>&nbsp;&nbsp;&nbsp;'),1==a.auc?s+='<span class="popup_txtgreen">'+westui.lang.auction+"</span><br/>":s+='<span class="popup_txtred">'+westui.lang.not_auction+"</span><br/>",0==a.upg?s+='<span class="popup_txtred">'+westui.lang.not_upgrade+"</span><br/>":s+='<span class="popup_txtgreen">'+westui.lang.upgrade+"</span><br/>",s+='<br/><p class="popup_id">[item=<b>'+a.id+"</b>]</p></div>"},setPosition:function(e){var t,a,i=$(window).width(),s=$(window).height(),p=westui.popup.getEl().outerWidth(),n=westui.popup.getEl().outerHeight(),o=e.clientX,l=e.clientY;a=o+p+20>i?o-p-20<0?e.pageX-e.clientX:e.pageX-p-20:20+e.pageX,t=l+n+20>s?s-n+(e.pageY-e.clientY):20+e.pageY,westui.popup.getEl().css({top:t,left:a})},init:function(){$("body").append('<div id="popup_window" class="popup_window"><div class="popup_front"><div class="tw_bg_popup_tl"></div><div class="tw_bg_popup_tr"></div><div class="tw_bg_popup_bl"></div><div class="tw_bg_popup_br"></div></div><div id="popup_contents" class="popup_contents"></div></div>'),$(document).on("mouseenter",".item_container",function(e){westui.popup.show(this),westui.popup.setPosition(e)}),$(document).on("mouseleave",".item_container",function(){westui.popup.hide()}),$(document).on("mousemove",".item_container",function(e){westui.popup.setPosition(e)}),$(".item_level").mousedown(function(e){e.preventDefault()}),$(document).on("click",".upgrade",function(){var e=$(this).closest(".item_container"),t=parseInt(e.attr("data-lvl"));5!==t&&(e.attr("data-lvl",t+1),e.find(".level").html(t+1)),westui.popup.show(e[0])}),$(document).on("click",".downgrade",function(){var e=$(this).closest(".item_container"),t=parseInt(e.attr("data-lvl"));0!==t&&(e.attr("data-lvl",t-1),e.find(".level").html(t-1)),westui.popup.show(e[0])})}},set_calc:{bonus:{extra_set_bonus:{}},data:{},itemStatus:{},getData:function(){$(".set_container").each(function(){var e=$(this).attr("data-set-id");westui.set_calc.itemStatus[e]={},westui.set_calc.data[e]={items:{},set:{}}}),$(".infoSet").each(function(){var e=$(this).attr("data-set-id");$(this).find(".infosetatt").each(function(){var t=$(this).attr("data-nb");westui.set_calc.data[e].set[t]={},$(this).find(".set_bonus").each(function(){key=$(this).attr("data-type"),0!==$(this).find(".calc").length?westui.set_calc.data[e].set[t][key]=-parseFloat($(this).find(".calc").attr("id")):westui.set_calc.data[e].set[t][key]=parseFloat($(this).find(".val").text()),westui.config.set_bonus.hasOwnProperty(key)||(westui.set_calc.bonus.extra_set_bonus[key]={img:$(this).find("img").attr("src"),name:$(this).find("#tooltip_content").text()})})})}),$(".set_container").each(function(){var e=$(this).attr("data-set-id");$(this).find(".item_container").each(function(){var t=JSON.parse($(this).attr("data-popup"));$(this).is(":hidden")?westui.set_calc.itemStatus[e][t.id]=!1:westui.set_calc.itemStatus[e][t.id]=0;for(var a in t)t.hasOwnProperty(a)&&(westui.config.set_bonus.hasOwnProperty(a)||westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(a))&&(westui.set_calc.data[e].items[a]||(westui.set_calc.data[e].items[a]={}),westui.set_calc.data[e].items[a][t.id]=t[a])})})},calc:function(){if(0===$("#input_level").length|""!==$("#input_level input").val()){var e=parseInt($("#input_level input").val());total={};for(var t in westui.set_calc.data){for(var a in westui.set_calc.data[t].items)for(var i in westui.set_calc.data[t].items[a])if(!1!==westui.set_calc.itemStatus[t][i]){lvl=westui.set_calc.itemStatus[t][i],total[a]||(total[a]=0);var s=westui.set_calc.data[t].items[a][i];westui.set_calc.data[t].items[a][i]<0?(s=-s,westui.set_calc.itemStatus[t][i]>0?total[a]+=Math.ceil(s*e)+Math.round(Math.max(1,.1*Math.ceil(s*e)*lvl)):total[a]+=Math.ceil(s*e)):westui.set_calc.itemStatus[t][i]>0?total[a]+=s<1?Math.round(1e6*(1*s+Math.round(Math.max(1,1e3*s*lvl))/1e4))/1e6:s+Math.round(Math.max(1,.1*s*lvl)):total[a]+=s}var p=0;for(var i in westui.set_calc.itemStatus[t])!1!==westui.set_calc.itemStatus[t][i]&&p++;for(var a in westui.set_calc.data[t].set[p])total[a]||(total[a]=0),westui.set_calc.data[t].set[p][a]<0?total[a]+=Math.ceil(-westui.set_calc.data[t].set[p][a]*e):total[a]+=westui.set_calc.data[t].set[p][a]}var n='<center><table class="infoSet"><caption><br><big><b>'+westui.lang.total+"</b></big></caption><tbody><tr><td></center>";for(var a in westui.config.set_bonus)total.hasOwnProperty(a)&&(n+='<div class="set_bonus tooltip_container"><img src="'+westui.config.set_bonus[a].img+'"><b>+'+total[a]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(a)?"%":"")+'</b><div class="tooltip_outer"><div class="tooltip"><div class="tw_bg_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_br"></div><div id="tooltip_content">'+westui.config.set_bonus[a].name+"</div></div></div></div>");for(var a in westui.set_calc.bonus.extra_set_bonus)total.hasOwnProperty(a)&&(n+='<div class="set_bonus tooltip_container"><img src="'+westui.set_calc.bonus.extra_set_bonus[a].img+'"><b>+'+total[a]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(a)?"%":"")+'</b><div class="tooltip_outer"><div class="tooltip"><div class="tw_bg_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_br"></div><div id="tooltip_content">'+westui.set_calc.bonus.extra_set_bonus[a].name+"</div></div></div></div>");$("#set_calc").html(n)}else $("#set_calc").html("")},initEvents:function(){$(".item_container > img").on("click",function(){var e=$(this).closest(".item_container");e.toggleClass("item_off");var t=e.closest(".set_container").attr("data-set-id"),a=JSON.parse(e.attr("data-popup")).id;e.hasClass("item_off")||e.is(":hidden")?westui.set_calc.itemStatus[t][a]=!1:westui.set_calc.itemStatus[t][a]=parseInt(e.attr("data-lvl")),westui.set_calc.calc()}),$(document).on("click",".upgrade, .downgrade",function(){var e=$(this).closest(".item_container"),t=e.closest(".set_container").attr("data-set-id");e.hasClass("item_off")||e.is(":hidden")||(westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=parseInt(e.attr("data-lvl")),westui.set_calc.calc())}),$("#input_level").bind("propertychange keyup input paste",function(){westui.set_calc.calc()}),$("#switch").on("click",function(){$("#melee, #fire").each(function(){var e=$(this).find(".item_container"),t=$(this).closest(".set_container").attr("data-set-id");$(this).is(":hidden")?westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=!1:westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=parseInt(e.attr("data-lvl"))}),westui.set_calc.calc()})},init:function(){westui.set_calc.initEvents(),westui.set_calc.getData(),$("#mw-content-text").append('<div id="set_calc"></div>'),0===$("#input_level").length&&westui.set_calc.calc()}},sorting:{sortItems:function(e){function t(t){var a=JSON.parse($(t).attr("data-popup")),i=$("#input_level input").val();i=i||150;var s=-1!==Object.keys(e).indexOf("id")||e.bool&&!0===e.bool,p=0;if(e.bool&&!0===e.bool){p=1;for(var n in e)a[n]!==e[n]&&(p=0)}else for(var n in e)"id"===n?p-=a[n]:(!a.lvl||a.lvl<=i)&&a[n]&&(a[n]<0?p+=Math.ceil(-a[n]*i)*e[n]:p+=a[n]*e[n]);$(t).attr("data-sort",p),0==p&&$(t).hide(),0!==$(t).find(".sortval").length?s?$(t).find(".sortval").html(""):$(t).find(".sortval").html(p):s||$(t).append('<div class="sortval">'+p+"</div>")}$(".item_container").removeAttr("data-sort").show(),$("#mw-content-text").find(".sorting_hidden").hide(),$(".sorting_container").each(function(){$(this).find(".item_container").sort(function(e,a){return $(e).attr("data-sort")||t(e),$(a).attr("data-sort")||t(a),$(a).attr("data-sort")-$(e).attr("data-sort")}).appendTo($(this))})},init:function(){if(1===$("div#sort_items").length){var e="<div id='input_search'><select id='sort_items' class='west'><option selected disabled>Trier par :</option>";for(var t in westui.config.sorting)e+="<option value='"+westui.config.sorting[t]+"'>"+t+"</option>";e+="</select></div>",$("div#sort_items").html(e),$("select#sort_items").on("change",function(){westui.sorting.sortItems(JSON.parse($(this).find("option:selected").attr("value")))})}}},init:function(){westui.initPage(),westui.popup.init(),westui.config.enable_sorting&&westui.sorting.init(),westui.config.enable_set_calc&&0!==$(".infoSet").length&&westui.set_calc.init()}},westui.init();
westui={lang:{input_level:"Niveau",input_search:"Recherche",damages:"Dégâts",per_level:"par Niveau",speed:"Vitesse",level:"Niveau",unsalable:"Non vendable",auction:"Peut être acheté/vendu aux enchères",not_auction:"Ne peut pas être acheté/vendu aux enchères",not_upgrade:"Non améliorable",upgrade:"Améliorable",total:"Total",popup:{dmg:{dglvl:'<p class="popup_dmg">+ #1 Dégâts#2</p>'},skills:{fo:'<p class="popup_attribute">+ #1 Force#2</p>',mo:'<p class="popup_attribute">+ #1 Mobilité#2</p>',ha:'<p class="popup_attribute">+ #1 Habileté#2</p>',ch:'<p class="popup_attribute">+ #1 Charisme#2</p>',co:'<p class="popup_skill">+ #1 Construction#2</p>',pu:'<p class="popup_skill">+ #1 Puissance#2</p>',te:'<p class="popup_skill">+ #1 Ténacité#2</p>',pe:'<p class="popup_skill">+ #1 Persévérance#2</p>',pv:'<p class="popup_skill">+ #1 Points de vie#2</p>',mc:'<p class="popup_skill">+ #1 Monter à cheval#2</p>',rx:'<p class="popup_skill">+ #1 Réflexe#2</p>',ev:'<p class="popup_skill">+ #1 Eviter#2</p>',ca:'<p class="popup_skill">+ #1 Se cacher#2</p>',na:'<p class="popup_skill">+ #1 Nager#2</p>',vi:'<p class="popup_skill">+ #1 Viser#2</p>',ti:'<p class="popup_skill">+ #1 Tirer#2</p>',pi:'<p class="popup_skill">+ #1 Piéger#2</p>',de:'<p class="popup_skill">+ #1 Dextérité#2</p>',re:'<p class="popup_skill">+ #1 Réparer#2</p>',di:'<p class="popup_skill">+ #1 Diriger#2</p>',ta:'<p class="popup_skill">+ #1 Tactique#2</p>',ma:'<p class="popup_skill">+ #1 Marchander#2</p>',an:'<p class="popup_skill">+ #1 Manier les animaux#2</p>',pr:'<p class="popup_skill">+ #1 Prestance#2</p>'},fb:{fbdef:'<p class="popup_fb">+ #1 <b>Défense</b> (Bonus de BdF)</p>',fboff:'<p class="popup_fb">+ #1 <b>Attaque</b> (Bonus de BdF)</p>',fbres:'<p class="popup_fb">+ #1 <b>Résistance</b> (Bonus de BdF)</p>',fbdefs:'<p class="popup_fb">+ #1 <b>Défense</b> (Bonus de secteur de BdF)</p>',fboffs:'<p class="popup_fb">+ #1 <b>Attaque</b> (Bonus de secteur de BdF)</p>',fbdmgs:'<p class="popup_fb">+ #1 <b>Dégâts</b> (Bonus de secteur de BdF)</p>'},special:{xp:'<p class="popup_txtgreen">+ #1% d\'expérience pour les travaux, duels et batailles de fort#2</p>',money:'<p class="popup_txtgreen">+ #1% d\'argent en travaux et duels#2</p>',luck:'<p class="popup_txtgreen">+ #1% de probabilité de chance en plus#2</p>',regen:'<p class="popup_txtgreen">+ #1% Régénération#2</p>',drop:'<p class="popup_txtgreen">+ #1% de chance de drop#2</p>',labor_pts:'<p class="popup_txtgreen">+ #1 points de travail#2</p>',spd:'<p class="popup_txtgreen">+ #1% Vitesse#2</p>'}}},config:{enable_set_calc:!0,plain_popup:!1,redirect_on_dblclick:!1,link_on_dblclick:!1,enable_sorting:!0,cdn:"https://westzz.innogamescdn.com",img_buyprice:"/images/2/22/Achat.png",img_sellprice:"/images/3/3b/Vente.png",img_male:"/images/8/83/Homme.png",img_female:"/images/8/8c/Femme.png",set_bonus:{fo:{name:"Force",img:"/images/thumb/0/09/Force.png/40px-Force.png"},mo:{name:"Mobilité",img:"/images/thumb/c/c1/Mobilit%C3%A9.png/40px-Mobilit%C3%A9.png"},ha:{name:"Habileté",img:"/images/thumb/1/1a/Habilet%C3%A9.png/40px-Habilet%C3%A9.png"},ch:{name:"Charisme",img:"/images/thumb/8/8f/Charisme.png/40px-Charisme.png"},co:{name:"Construire",img:"/images/thumb/0/0e/Construire.png/40px-Construire.png"},pu:{name:"Puissance",img:"/images/thumb/f/f4/Puissance.png/40px-Puissance.png"},te:{name:"Ténacité",img:"/images/thumb/8/85/T%C3%A9nacit%C3%A9.png/40px-T%C3%A9nacit%C3%A9.png"},pe:{name:"Persévérance",img:"/images/thumb/e/e9/Pers%C3%A9v%C3%A9rance.png/40px-Pers%C3%A9v%C3%A9rance.png"},pv:{name:"Points de vie",img:"/images/thumb/b/bb/Points_de_vie_aptitude.png/40px-Points_de_vie_aptitude.png"},mc:{name:"Monter à cheval",img:"/images/thumb/0/01/Monter_%C3%A0_cheval.png/40px-Monter_%C3%A0_cheval.png"},rx:{name:"Réflexe",img:"/images/thumb/5/52/R%C3%A9flexe.png/40px-R%C3%A9flexe.png"},ev:{name:"Eviter",img:"/images/thumb/f/ff/Eviter.png/40px-Eviter.png"},ca:{name:"Se cacher",img:"/images/thumb/5/5f/Se_cacher.png/40px-Se_cacher.png"},na:{name:"Nager",img:"/images/thumb/b/b8/Nager.png/40px-Nager.png"},vi:{name:"Viser",img:"/images/thumb/6/68/Viser.png/40px-Viser.png"},ti:{name:"Tirer",img:"/images/thumb/f/f9/Tirer.png/40px-Tirer.png"},pi:{name:"Piéger",img:"/images/thumb/2/26/Pi%C3%A9ger.png/40px-Pi%C3%A9ger.png"},de:{name:"Dextérité",img:"/images/thumb/4/4a/Dext%C3%A9rit%C3%A9.png/40px-Dext%C3%A9rit%C3%A9.png"},re:{name:"Réparer",img:"/images/thumb/c/cc/R%C3%A9parer.png/40px-R%C3%A9parer.png"},di:{name:"Diriger",img:"/images/thumb/b/b5/Diriger.png/40px-Diriger.png"},ta:{name:"Tactique",img:"/images/thumb/2/2c/Tactique.png/40px-Tactique.png"},ma:{name:"Marchander",img:"/images/thumb/c/ca/Marchander_aptitude.png/40px-Marchander_aptitude.png"},an:{name:"Manier les animaux",img:"/images/thumb/b/be/Manier_les_animaux.png/40px-Manier_les_animaux.png"},pr:{name:"Prestance",img:"/images/thumb/c/cb/Prestance.png/40px-Prestance.png"},fbdef:{name:"<b>Défense</b> (Bonus de bataille de fort)",img:"/images/thumb/2/2d/D%C3%A9fense.png/40px-D%C3%A9fense.png"},fboff:{name:"<b>Attaque</b> (Bonus de bataille de fort)",img:"/images/thumb/e/ef/Attaque.png/40px-Attaque.png"},fbres:{name:"<b>Résistance</b> (Bonus de bataille de fort)",img:"/images/4/4a/R%C3%A9sistance.png"},fbdefs:{name:"<b>Défense</b> (Bonus de secteur de bataille de fort)",img:"/images/thumb/2/2d/D%C3%A9fense.png/40px-D%C3%A9fense.png"},fboffs:{name:"<b>Attaque</b> (Bonus de secteur de bataille de fort)",img:"/images/thumb/e/ef/Attaque.png/40px-Attaque.png"},fbdmgs:{name:"<b>Dégâts</b> (Bonus de secteur de bataille de fort)",img:"/images/5/54/Dommages.png"},fbdmg:{name:"<b>Dégâts</b> (Bonus de bataille de fort)",img:"/images/5/54/Dommages.png"},xp:{name:"Expérience pour les travaux, duels et batailles de fort (%)",img:"/images/0/01/Xxp.png"},money:{name:"Argent en travaux et duels (%)",img:"/images/f/fd/Dollarb.png"},luck:{name:"Probabilité de chance en plus (%)",img:"/images/f/f0/Luck.png"},regen:{name:"Régénération (%)",img:"/images/4/44/R%C3%A9g%C3%A9n%C3%A9ration.png"},drop:{name:"Chance de drop améliorée pour les <b>produits</b> (%)",img:"/images/thumb/f/f6/Luck_prod.png/40px-Luck_prod.png"},labor_pts:{name:"Points de travail supplémentaires (sur tous les travaux)",img:"/images/d/df/Jobs.png"},spd:{name:"Vitesse",img:"/images/thumb/f/fb/Vitesse.png/40px-Vitesse.png"}},sorting:{Aucun:'{"id":1}',Force:'{"fo":1}',"Mobilité":'{"mo":1}',"Habileté":'{"ha":1}',Charisme:'{"ch":1}',Construction:'{"fo":1,"co":1}',Puissance:'{"fo":1,"pu":1}',"Ténacité":'{"fo":1,"te":1}',"Persévérance":'{"fo":1,"pe":1}',"Points de vie":'{"fo":1,"pv":1}',"Monter à cheval":'{"mo":1,"mc":1}',"Réflexe":'{"mo":1,"rx":1}',Eviter:'{"mo":1,"ev":1}',"Se cacher":'{"mo":1,"ca":1}',Nager:'{"mo":1,"na":1}',Viser:'{"ha":1,"vi":1}',Tirer:'{"ha":1,"ti":1}',"Piéger":'{"ha":1,"pi":1}',"Dextérité":'{"ha":1,"de":1}',"Réparer":'{"ha":1,"re":1}',Diriger:'{"ch":1,"di":1}',Tactique:'{"ch":1,"ta":1}',Marchander:'{"ch":1,"ma":1}',"Manier les animaux":'{"ch":1,"an":1}',Prestance:'{"ch":1,"pr":1}',"Points de travail pour construire":'{"fo":3,"co":3,"ha":1,"re":1,"ch":1,"di":1}',"Expérience pour les travaux, duels et batailles de fort (%)":'{"xp":1}',"Argent en travaux et duels (%)":'{"money":1}',"Probabilité de chance en plus (%)":'{"luck":1}',"Régénération (%)":'{"regen":1}',"Chance de drop (%)":'{"drop":1}',"Vitesse (%)":'{"spd":1,"hspd":1,"mo":1,"mc":1}',"Dégât moyen":'{"dgmin":0.5,"dgmax":0.5,"dglvl":1}',"Dégât maximal":'{"dgmax":1,"dglvl":1}',"Items améliorables":'{"bool":true,"upg":1}',"Items non améliorables":'{"bool":true,"upg":0}',"Items vendables aux enchères":'{"bool":true,"auc":1}',"Items non vendables aux enchères":'{"bool":true,"auc":0}',"Items pouvant être droppés":'{"bool":true,"drop":1}',"Items disponibles dans les magasins":'{"bool":true,"shop":1}',"Items nobles":'{"bool":true,"shop":0,"drop":1}'}},initPage:function(){if(1===$("#input_level").length)var e=$('<input type="number" style="width:80px;" class="west" placeholder="'+westui.lang.input_level+'" min="0" max="150">').bind("propertychange keyup input paste",function(){this.value>150?this.value=150:this.value<0&&(this.value=0),$(".calc").each(function(){0==e.val()?($(this).html(this.id),$(".per_level_off").addClass("per_level").removeClass("per_level_off")):($(this).html(Math.ceil(Number(this.id)*e.val())),$(".per_level").addClass("per_level_off").removeClass("per_level"))})}).appendTo($("#input_level"));if(1===$("#input_search").length){$('<input type="search" class="west" placeholder="'+westui.lang.input_search+'">').bind("propertychange keyup input paste",function(){var e=this.value.toLowerCase();""===e?$(".item_container").show():($(".item_container").hide(),$(".item_container").filter(function(){return $(this).attr("data-popup").toLowerCase().indexOf(e)>-1}).show())}).appendTo($("#input_search"))}1===$("#switch").length&&($("#fire").hide(),$("#switch").on("click",function(){$("#melee, #fire").toggle()})),1===$("#switch_prod").length&&($("#prod2").hide(),$("#switch_prod").on("click",function(){$("#prod, #prod2").toggle()})),westui.config.plain_popup&&new RegExp(mw.config.get("wgFormattedNamespaces")[10]+":Item_*").test(mw.config.get("wgPageName"))&&1===$(".item_container").length&&($("#mw-content-text").append('<center><div id="popup_plain" class="popup_window"><div class="popup_front"><div class="tw_bg_popup_tl"></div><div class="tw_bg_popup_tr"></div><div class="tw_bg_popup_bl"></div><div class="tw_bg_popup_br"></div></div><div id="popup_plain_contents" class="popup_contents"></div></div></center>'),$("#popup_plain").hide(),$("#popup_plain_contents").append(westui.popup.createPopup($(".item_container"),0)),$("#popup_plain").slideDown()),westui.config.redirect_on_dblclick&&$(".item_container img").on("dblclick",function(){window.location="/wiki/"+mw.config.get("wgFormattedNamespaces")[10]+":Item_"+JSON.parse($(this).parent().attr("data-popup")).id/1e3}),westui.config.link_on_dblclick&&$(".item_container img").on("dblclick",function(){window.location="/wiki/"+$(this).parent().attr("data-link")})},popup:{content:"",delay:200,active:!1,show:function(e){westui.popup.content=westui.popup.createPopup($(e),parseInt($(e).attr("data-lvl"))),westui.popup.active=!0,westui.popup.setTimeout(),westui.popup.getContainer().html(westui.popup.content)},hide:function(){westui.popup.getEl().css({display:"none",top:0,left:0}),westui.popup.active=!1,westui.popup.clearTimeout()},setTimeout:function(){westui.popup.clearTimeout(),westui.popup.timer=window.setTimeout(function(){westui.popup.getEl().css("display","block")},westui.popup.delay)},clearTimeout:function(){westui.popup.timer&&window.clearTimeout(westui.popup.timer)},getEl:function(){return $("#popup_window")},getContainer:function(){return $("#popup_contents")},createPopup:function(e,t){var a=JSON.parse(e.attr("data-popup")),i=e.attr("data-cache"),s=(e.attr("data-cdn-cat"),e.attr("data-cdn-img"),'<div class="popup_image"><img src="'+westui.config.cdn+"/images/items/"+a.cdn_cat+"/"+a.cdn_img+".png"+(i?"?"+i:"")+'"/></div><div class="popup_divider"></div><p class="popup_name">'+a.name+'</p><p class="popup_type">'+a.type+"</p><br/>"),p=!1;if(t>=1&&t<=5&&(p=!0,a.auc=!1),a.dgmin&&a.dgmax&&(p&&(a.dgmin+=Math.round(Math.max(1,.1*a.dgmin*t)),a.dgmax+=Math.round(Math.max(1,.1*a.dgmax*t))),s+='<p class="popup_dmg">'+a.dgmin+"-"+a.dgmax+" "+westui.lang.damages+"</p>"),a.text){for(var n=0;n<a.text.length;n++)s+='<p class="popup_text">'+a.text[n]+"</p>";s+="<br/>"}for(var o in westui.lang.popup){var l=0;for(var c in westui.lang.popup[o])if(a.hasOwnProperty(c)){l++;var r="";a[c]<0?$("#input_level input").val()>0?(a[c]=Math.ceil($("#input_level input").val()*-a[c]),p&&(a[c]+=Math.round(Math.max(1,.1*a[c]*t)))):(a[c]=-a[c],r=" ("+westui.lang.per_level+")",p&&(a[c]=Math.round(1e6*(1*a[c]+Math.round(Math.max(1,1e3*a[c]*t))/1e4))/1e6)):p&&(a[c]<1?a[c]=Math.round(1e6*(1*a[c]+Math.round(Math.max(1,1e3*a[c]*t))/1e4))/1e6:a[c]+=Math.round(Math.max(1,.1*a[c]*t))),s+=westui.lang.popup[o][c].replace("#1",a[c]).replace("#2",r)}l>0&&(s+="<br/>")}if(a.textjob){for(var n=0;n<a.textjob.length;n++)s+='<p class="popup_txtgreen">'+a.textjob[n]+"</p>";s+="<br/>"}if(a.bonus){for(var n=0;n<a.bonus.length;n++)s+='<p class="popup_bonus">'+a.bonus[n]+"</p>";s+="<br/>"}if(a.jobs){s+='<div style="text-align:center;"><table class="popup_job">';for(var n=0;n<a.jobs.length;n++)s+='<tr><td><img src="'+westui.config.cdn+"/images/jobs/"+a.jobs[n][1]+'.png"/></td><td><span>&nbsp;&nbsp;'+a.jobs[n][0]+"</span></td></tr>";s+="</table></div>"}if(a.craft){s+='<div style="text-align:center;"><table  class="popup_crafteditem"><tr><td><img src="'+westui.config.cdn+"/images/crafting/profsymbol_"+a.craft.id+'_small.png"/></td><td><table><tr>';for(var n=0;n<a.craft.req.length;n++)s+='<td><img style="width:36px;height:36px;" src="'+westui.config.cdn+"/images/items/yield/"+a.craft.req[n][0]+'.png"/></td>';s+="</tr><tr>";for(var n=0;n<a.craft.req.length;n++)s+="<td><span>x"+a.craft.req[n][1]+"</span></td>";s+="</tr></table></td></tr></table></div>"}return s+='<div class="popup_infos">',a.hspd&&(p&&(a.hspd+=Math.round(Math.max(1,.1*a.hspd*t))),s+='<p class="popup_speed">'+westui.lang.speed+": +"+a.hspd+"%</p><br/>"),a.set&&(s+='<p><a class="popup_set" href="/wiki/'+a.set+'">'+a.set+"</a></p><br/>"),a.sp?s+='<img src="'+westui.config.img_buyprice+'"/>'+a.bp+'&nbsp;&nbsp;&nbsp;&nbsp;<img src="'+westui.config.img_sellprice+'"/>&nbsp;'+a.sp+"<br/><br/>":s+="<i>"+westui.lang.unsalable+"</i><br/><br/>",a.lvl&&(s+=westui.lang.level+" <b>"+a.lvl+"</b><br/>"),a.sex&&(0==a.sex?s+='<img src="'+westui.config.img_male+'"/>&nbsp;&nbsp;&nbsp;':s+='<img src="'+westui.config.img_female+'"/>&nbsp;&nbsp;&nbsp;'),1==a.auc?s+='<span class="popup_txtgreen">'+westui.lang.auction+"</span><br/>":s+='<span class="popup_txtred">'+westui.lang.not_auction+"</span><br/>",0==a.upg?s+='<span class="popup_txtred">'+westui.lang.not_upgrade+"</span><br/>":s+='<span class="popup_txtgreen">'+westui.lang.upgrade+"</span><br/>",s+='<br/><p class="popup_id">[item=<b>'+a.id+"</b>]</p></div>"},setPosition:function(e){var t,a,i=$(window).width(),s=$(window).height(),p=westui.popup.getEl().outerWidth(),n=westui.popup.getEl().outerHeight(),o=e.clientX,l=e.clientY;a=o+p+20>i?o-p-20<0?e.pageX-e.clientX:e.pageX-p-20:20+e.pageX,t=l+n+20>s?s-n+(e.pageY-e.clientY):20+e.pageY,westui.popup.getEl().css({top:t,left:a})},init:function(){$("body").append('<div id="popup_window" class="popup_window"><div class="popup_front"><div class="tw_bg_popup_tl"></div><div class="tw_bg_popup_tr"></div><div class="tw_bg_popup_bl"></div><div class="tw_bg_popup_br"></div></div><div id="popup_contents" class="popup_contents"></div></div>'),$(document).on("mouseenter",".item_container",function(e){westui.popup.show(this),westui.popup.setPosition(e)}),$(document).on("mouseleave",".item_container",function(){westui.popup.hide()}),$(document).on("mousemove",".item_container",function(e){westui.popup.setPosition(e)}),$(".item_level").mousedown(function(e){e.preventDefault()}),$(document).on("click",".upgrade",function(){var e=$(this).closest(".item_container"),t=parseInt(e.attr("data-lvl"));5!==t&&(e.attr("data-lvl",t+1),e.find(".level").html(t+1)),westui.popup.show(e[0])}),$(document).on("click",".downgrade",function(){var e=$(this).closest(".item_container"),t=parseInt(e.attr("data-lvl"));0!==t&&(e.attr("data-lvl",t-1),e.find(".level").html(t-1)),westui.popup.show(e[0])})}},set_calc:{bonus:{extra_set_bonus:{}},data:{},itemStatus:{},getData:function(){$(".set_container").each(function(){var e=$(this).attr("data-set-id");westui.set_calc.itemStatus[e]={},westui.set_calc.data[e]={items:{},set:{}}}),$(".infoSet").each(function(){var e=$(this).attr("data-set-id");$(this).find(".infosetatt").each(function(){var t=$(this).attr("data-nb");westui.set_calc.data[e].set[t]={},$(this).find(".set_bonus").each(function(){key=$(this).attr("data-type"),0!==$(this).find(".calc").length?westui.set_calc.data[e].set[t][key]=-parseFloat($(this).find(".calc").attr("id")):westui.set_calc.data[e].set[t][key]=parseFloat($(this).find(".val").text()),westui.config.set_bonus.hasOwnProperty(key)||(westui.set_calc.bonus.extra_set_bonus[key]={img:$(this).find("img").attr("src"),name:$(this).find("#tooltip_content").text()})})})}),$(".set_container").each(function(){var e=$(this).attr("data-set-id");$(this).find(".item_container").each(function(){var t=JSON.parse($(this).attr("data-popup"));$(this).is(":hidden")?westui.set_calc.itemStatus[e][t.id]=!1:westui.set_calc.itemStatus[e][t.id]=0;for(var a in t)t.hasOwnProperty(a)&&(westui.config.set_bonus.hasOwnProperty(a)||westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(a))&&(westui.set_calc.data[e].items[a]||(westui.set_calc.data[e].items[a]={}),westui.set_calc.data[e].items[a][t.id]=t[a])})})},calc:function(){if(0===$("#input_level").length|""!==$("#input_level input").val()){var e=parseInt($("#input_level input").val());total={};for(var t in westui.set_calc.data){for(var a in westui.set_calc.data[t].items)for(var i in westui.set_calc.data[t].items[a])if(!1!==westui.set_calc.itemStatus[t][i]){lvl=westui.set_calc.itemStatus[t][i],total[a]||(total[a]=0);var s=westui.set_calc.data[t].items[a][i];westui.set_calc.data[t].items[a][i]<0?(s=-s,westui.set_calc.itemStatus[t][i]>0?total[a]+=Math.ceil(s*e)+Math.round(Math.max(1,.1*Math.ceil(s*e)*lvl)):total[a]+=Math.ceil(s*e)):westui.set_calc.itemStatus[t][i]>0?total[a]+=s<1?Math.round(1e6*(1*s+Math.round(Math.max(1,1e3*s*lvl))/1e4))/1e6:s+Math.round(Math.max(1,.1*s*lvl)):total[a]+=s}var p=0;for(var i in westui.set_calc.itemStatus[t])!1!==westui.set_calc.itemStatus[t][i]&&p++;for(var a in westui.set_calc.data[t].set[p])total[a]||(total[a]=0),westui.set_calc.data[t].set[p][a]<0?total[a]+=Math.ceil(-westui.set_calc.data[t].set[p][a]*e):total[a]+=westui.set_calc.data[t].set[p][a]}var n='<center><table class="infoSet"><caption><br><big><b>'+westui.lang.total+"</b></big></caption><tbody><tr><td></center>";for(var a in westui.config.set_bonus)total.hasOwnProperty(a)&&(n+='<div class="set_bonus tooltip_container"><img src="'+westui.config.set_bonus[a].img+'"><b>+'+total[a]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(a)?"%":"")+'</b><div class="tooltip_outer"><div class="tooltip"><div class="tw_bg_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_br"></div><div id="tooltip_content">'+westui.config.set_bonus[a].name+"</div></div></div></div>");for(var a in westui.set_calc.bonus.extra_set_bonus)total.hasOwnProperty(a)&&(n+='<div class="set_bonus tooltip_container"><img src="'+westui.set_calc.bonus.extra_set_bonus[a].img+'"><b>+'+total[a]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(a)?"%":"")+'</b><div class="tooltip_outer"><div class="tooltip"><div class="tw_bg_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_br"></div><div id="tooltip_content">'+westui.set_calc.bonus.extra_set_bonus[a].name+"</div></div></div></div>");$("#set_calc").html(n)}else $("#set_calc").html("")},initEvents:function(){$(".item_container > img").on("click",function(){var e=$(this).closest(".item_container");e.toggleClass("item_off");var t=e.closest(".set_container").attr("data-set-id"),a=JSON.parse(e.attr("data-popup")).id;e.hasClass("item_off")||e.is(":hidden")?westui.set_calc.itemStatus[t][a]=!1:westui.set_calc.itemStatus[t][a]=parseInt(e.attr("data-lvl")),westui.set_calc.calc()}),$(document).on("click",".upgrade, .downgrade",function(){var e=$(this).closest(".item_container"),t=e.closest(".set_container").attr("data-set-id");e.hasClass("item_off")||e.is(":hidden")||(westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=parseInt(e.attr("data-lvl")),westui.set_calc.calc())}),$("#input_level").bind("propertychange keyup input paste",function(){westui.set_calc.calc()}),$("#switch").on("click",function(){$("#melee, #fire").each(function(){var e=$(this).find(".item_container"),t=$(this).closest(".set_container").attr("data-set-id");$(this).is(":hidden")?westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=!1:westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=parseInt(e.attr("data-lvl"))}),westui.set_calc.calc()})},init:function(){westui.set_calc.initEvents(),westui.set_calc.getData(),$("#mw-content-text").append('<div id="set_calc"></div>'),0===$("#input_level").length&&westui.set_calc.calc()}},sorting:{sortItems:function(e){function t(t){var a=JSON.parse($(t).attr("data-popup")),i=$("#input_level input").val();i=i||150;var s=-1!==Object.keys(e).indexOf("id")||e.bool&&!0===e.bool,p=0;if(e.bool&&!0===e.bool){p=1;for(var n in e)"bool"!==n&&a[n]!==e[n]&&(p=0)}else for(var n in e)"id"===n?p-=a[n]:(!a.lvl||a.lvl<=i)&&a[n]&&(a[n]<0?p+=Math.ceil(-a[n]*i)*e[n]:p+=a[n]*e[n]);$(t).attr("data-sort",p),0==p&&$(t).hide(),0!==$(t).find(".sortval").length?s?$(t).find(".sortval").html(""):$(t).find(".sortval").html(p):s||$(t).append('<div class="sortval">'+p+"</div>")}$(".item_container").removeAttr("data-sort").show(),$("#mw-content-text").find(".sorting_hidden").hide(),$(".sorting_container").each(function(){$(this).find(".item_container").sort(function(e,a){return $(e).attr("data-sort")||t(e),$(a).attr("data-sort")||t(a),$(a).attr("data-sort")-$(e).attr("data-sort")}).appendTo($(this))})},init:function(){if(1===$("div#sort_items").length){var e="<div id='input_search'><select id='sort_items' class='west'><option selected disabled>Trier par :</option>";for(var t in westui.config.sorting)e+="<option value='"+westui.config.sorting[t]+"'>"+t+"</option>";e+="</select></div>",$("div#sort_items").html(e),$("select#sort_items").on("change",function(){westui.sorting.sortItems(JSON.parse($(this).find("option:selected").attr("value")))})}}},init:function(){westui.initPage(),westui.popup.init(),westui.config.enable_sorting&&westui.sorting.init(),westui.config.enable_set_calc&&0!==$(".infoSet").length&&westui.set_calc.init()}},westui.init();

Version du 19 janvier 2021 à 18:35

westui={lang:{input_level:"Niveau",input_search:"Recherche",damages:"Dégâts",per_level:"par Niveau",speed:"Vitesse",level:"Niveau",unsalable:"Non vendable",auction:"Peut être acheté/vendu aux enchères",not_auction:"Ne peut pas être acheté/vendu aux enchères",not_upgrade:"Non améliorable",upgrade:"Améliorable",total:"Total",popup:{dmg:{dglvl:'

'},skills:{fo:'

',mo:'

',ha:'

',ch:'

',co:'

',pu:'

',te:'

',pe:'

',pv:'

',mc:'

',rx:'

',ev:'

',ca:'

',na:'

',vi:'

',ti:'

',pi:'

',de:'

',re:'

',di:'

',ta:'

',ma:'

',an:'

',pr:'

'},fb:{fbdef:'

',fboff:'

',fbres:'

',fbdefs:'

',fboffs:'

',fbdmgs:'

'},special:{xp:'

',money:'

',luck:'

',regen:'

',drop:'

',labor_pts:'

',spd:'

'}}},config:{enable_set_calc:!0,plain_popup:!1,redirect_on_dblclick:!1,link_on_dblclick:!1,enable_sorting:!0,cdn:"https://westzz.innogamescdn.com",img_buyprice:"/images/2/22/Achat.png",img_sellprice:"/images/3/3b/Vente.png",img_male:"/images/8/83/Homme.png",img_female:"/images/8/8c/Femme.png",set_bonus:{fo:{name:"Force",img:"/images/thumb/0/09/Force.png/40px-Force.png"},mo:{name:"Mobilité",img:"/images/thumb/c/c1/Mobilit%C3%A9.png/40px-Mobilit%C3%A9.png"},ha:{name:"Habileté",img:"/images/thumb/1/1a/Habilet%C3%A9.png/40px-Habilet%C3%A9.png"},ch:{name:"Charisme",img:"/images/thumb/8/8f/Charisme.png/40px-Charisme.png"},co:{name:"Construire",img:"/images/thumb/0/0e/Construire.png/40px-Construire.png"},pu:{name:"Puissance",img:"/images/thumb/f/f4/Puissance.png/40px-Puissance.png"},te:{name:"Ténacité",img:"/images/thumb/8/85/T%C3%A9nacit%C3%A9.png/40px-T%C3%A9nacit%C3%A9.png"},pe:{name:"Persévérance",img:"/images/thumb/e/e9/Pers%C3%A9v%C3%A9rance.png/40px-Pers%C3%A9v%C3%A9rance.png"},pv:{name:"Points de vie",img:"/images/thumb/b/bb/Points_de_vie_aptitude.png/40px-Points_de_vie_aptitude.png"},mc:{name:"Monter à cheval",img:"/images/thumb/0/01/Monter_%C3%A0_cheval.png/40px-Monter_%C3%A0_cheval.png"},rx:{name:"Réflexe",img:"/images/thumb/5/52/R%C3%A9flexe.png/40px-R%C3%A9flexe.png"},ev:{name:"Eviter",img:"/images/thumb/f/ff/Eviter.png/40px-Eviter.png"},ca:{name:"Se cacher",img:"/images/thumb/5/5f/Se_cacher.png/40px-Se_cacher.png"},na:{name:"Nager",img:"/images/thumb/b/b8/Nager.png/40px-Nager.png"},vi:{name:"Viser",img:"/images/thumb/6/68/Viser.png/40px-Viser.png"},ti:{name:"Tirer",img:"/images/thumb/f/f9/Tirer.png/40px-Tirer.png"},pi:{name:"Piéger",img:"/images/thumb/2/26/Pi%C3%A9ger.png/40px-Pi%C3%A9ger.png"},de:{name:"Dextérité",img:"/images/thumb/4/4a/Dext%C3%A9rit%C3%A9.png/40px-Dext%C3%A9rit%C3%A9.png"},re:{name:"Réparer",img:"/images/thumb/c/cc/R%C3%A9parer.png/40px-R%C3%A9parer.png"},di:{name:"Diriger",img:"/images/thumb/b/b5/Diriger.png/40px-Diriger.png"},ta:{name:"Tactique",img:"/images/thumb/2/2c/Tactique.png/40px-Tactique.png"},ma:{name:"Marchander",img:"/images/thumb/c/ca/Marchander_aptitude.png/40px-Marchander_aptitude.png"},an:{name:"Manier les animaux",img:"/images/thumb/b/be/Manier_les_animaux.png/40px-Manier_les_animaux.png"},pr:{name:"Prestance",img:"/images/thumb/c/cb/Prestance.png/40px-Prestance.png"},fbdef:{name:"Défense (Bonus de bataille de fort)",img:"/images/thumb/2/2d/D%C3%A9fense.png/40px-D%C3%A9fense.png"},fboff:{name:"Attaque (Bonus de bataille de fort)",img:"/images/thumb/e/ef/Attaque.png/40px-Attaque.png"},fbres:{name:"Résistance (Bonus de bataille de fort)",img:"/images/4/4a/R%C3%A9sistance.png"},fbdefs:{name:"Défense (Bonus de secteur de bataille de fort)",img:"/images/thumb/2/2d/D%C3%A9fense.png/40px-D%C3%A9fense.png"},fboffs:{name:"Attaque (Bonus de secteur de bataille de fort)",img:"/images/thumb/e/ef/Attaque.png/40px-Attaque.png"},fbdmgs:{name:"Dégâts (Bonus de secteur de bataille de fort)",img:"/images/5/54/Dommages.png"},fbdmg:{name:"Dégâts (Bonus de bataille de fort)",img:"/images/5/54/Dommages.png"},xp:{name:"Expérience pour les travaux, duels et batailles de fort (%)",img:"/images/0/01/Xxp.png"},money:{name:"Argent en travaux et duels (%)",img:"/images/f/fd/Dollarb.png"},luck:{name:"Probabilité de chance en plus (%)",img:"/images/f/f0/Luck.png"},regen:{name:"Régénération (%)",img:"/images/4/44/R%C3%A9g%C3%A9n%C3%A9ration.png"},drop:{name:"Chance de drop améliorée pour les produits (%)",img:"/images/thumb/f/f6/Luck_prod.png/40px-Luck_prod.png"},labor_pts:{name:"Points de travail supplémentaires (sur tous les travaux)",img:"/images/d/df/Jobs.png"},spd:{name:"Vitesse",img:"/images/thumb/f/fb/Vitesse.png/40px-Vitesse.png"}},sorting:{Aucun:'{"id":1}',Force:'{"fo":1}',"Mobilité":'{"mo":1}',"Habileté":'{"ha":1}',Charisme:'{"ch":1}',Construction:'{"fo":1,"co":1}',Puissance:'{"fo":1,"pu":1}',"Ténacité":'{"fo":1,"te":1}',"Persévérance":'{"fo":1,"pe":1}',"Points de vie":'{"fo":1,"pv":1}',"Monter à cheval":'{"mo":1,"mc":1}',"Réflexe":'{"mo":1,"rx":1}',Eviter:'{"mo":1,"ev":1}',"Se cacher":'{"mo":1,"ca":1}',Nager:'{"mo":1,"na":1}',Viser:'{"ha":1,"vi":1}',Tirer:'{"ha":1,"ti":1}',"Piéger":'{"ha":1,"pi":1}',"Dextérité":'{"ha":1,"de":1}',"Réparer":'{"ha":1,"re":1}',Diriger:'{"ch":1,"di":1}',Tactique:'{"ch":1,"ta":1}',Marchander:'{"ch":1,"ma":1}',"Manier les animaux":'{"ch":1,"an":1}',Prestance:'{"ch":1,"pr":1}',"Points de travail pour construire":'{"fo":3,"co":3,"ha":1,"re":1,"ch":1,"di":1}',"Expérience pour les travaux, duels et batailles de fort (%)":'{"xp":1}',"Argent en travaux et duels (%)":'{"money":1}',"Probabilité de chance en plus (%)":'{"luck":1}',"Régénération (%)":'{"regen":1}',"Chance de drop (%)":'{"drop":1}',"Vitesse (%)":'{"spd":1,"hspd":1,"mo":1,"mc":1}',"Dégât moyen":'{"dgmin":0.5,"dgmax":0.5,"dglvl":1}',"Dégât maximal":'{"dgmax":1,"dglvl":1}',"Items améliorables":'{"bool":true,"upg":1}',"Items non améliorables":'{"bool":true,"upg":0}',"Items vendables aux enchères":'{"bool":true,"auc":1}',"Items non vendables aux enchères":'{"bool":true,"auc":0}',"Items pouvant être droppés":'{"bool":true,"drop":1}',"Items disponibles dans les magasins":'{"bool":true,"shop":1}',"Items nobles":'{"bool":true,"shop":0,"drop":1}'}},initPage:function(){if(1===$("#input_level").length)var e=$('<input type="number" style="width:80px;" class="west" placeholder="'+westui.lang.input_level+'" min="0" max="150">').bind("propertychange keyup input paste",function(){this.value>150?this.value=150:this.value<0&&(this.value=0),$(".calc").each(function(){0==e.val()?($(this).html(this.id),$(".per_level_off").addClass("per_level").removeClass("per_level_off")):($(this).html(Math.ceil(Number(this.id)*e.val())),$(".per_level").addClass("per_level_off").removeClass("per_level"))})}).appendTo($("#input_level"));if(1===$("#input_search").length){$('<input type="search" class="west" placeholder="'+westui.lang.input_search+'">').bind("propertychange keyup input paste",function(){var e=this.value.toLowerCase();""===e?$(".item_container").show():($(".item_container").hide(),$(".item_container").filter(function(){return $(this).attr("data-popup").toLowerCase().indexOf(e)>-1}).show())}).appendTo($("#input_search"))}1===$("#switch").length&&($("#fire").hide(),$("#switch").on("click",function(){$("#melee, #fire").toggle()})),1===$("#switch_prod").length&&($("#prod2").hide(),$("#switch_prod").on("click",function(){$("#prod, #prod2").toggle()})),westui.config.plain_popup&&new RegExp(mw.config.get("wgFormattedNamespaces")[10]+":Item_*").test(mw.config.get("wgPageName"))&&1===$(".item_container").length&&($("#mw-content-text").append('

'),$("#popup_plain").hide(),$("#popup_plain_contents").append(westui.popup.createPopup($(".item_container"),0)),$("#popup_plain").slideDown()),westui.config.redirect_on_dblclick&&$(".item_container img").on("dblclick",function(){window.location="/wiki/"+mw.config.get("wgFormattedNamespaces")[10]+":Item_"+JSON.parse($(this).parent().attr("data-popup")).id/1e3}),westui.config.link_on_dblclick&&$(".item_container img").on("dblclick",function(){window.location="/wiki/"+$(this).parent().attr("data-link")})},popup:{content:"",delay:200,active:!1,show:function(e){westui.popup.content=westui.popup.createPopup($(e),parseInt($(e).attr("data-lvl"))),westui.popup.active=!0,westui.popup.setTimeout(),westui.popup.getContainer().html(westui.popup.content)},hide:function(){westui.popup.getEl().css({display:"none",top:0,left:0}),westui.popup.active=!1,westui.popup.clearTimeout()},setTimeout:function(){westui.popup.clearTimeout(),westui.popup.timer=window.setTimeout(function(){westui.popup.getEl().css("display","block")},westui.popup.delay)},clearTimeout:function(){westui.popup.timer&&window.clearTimeout(westui.popup.timer)},getEl:function(){return $("#popup_window")},getContainer:function(){return $("#popup_contents")},createPopup:function(e,t){var a=JSON.parse(e.attr("data-popup")),i=e.attr("data-cache"),s=(e.attr("data-cdn-cat"),e.attr("data-cdn-img"),'


"),p=!1;if(t>=1&&t<=5&&(p=!0,a.auc=!1),a.dgmin&&a.dgmax&&(p&&(a.dgmin+=Math.round(Math.max(1,.1*a.dgmin*t)),a.dgmax+=Math.round(Math.max(1,.1*a.dgmax*t))),s+='

"),a.text){for(var n=0;n<a.text.length;n++)s+='

";s+="
"}for(var o in westui.lang.popup){var l=0;for(var c in westui.lang.popup[o])if(a.hasOwnProperty(c)){l++;var r="";a[c]<0?$("#input_level input").val()>0?(a[c]=Math.ceil($("#input_level input").val()*-a[c]),p&&(a[c]+=Math.round(Math.max(1,.1*a[c]*t)))):(a[c]=-a[c],r=" ("+westui.lang.per_level+")",p&&(a[c]=Math.round(1e6*(1*a[c]+Math.round(Math.max(1,1e3*a[c]*t))/1e4))/1e6)):p&&(a[c]<1?a[c]=Math.round(1e6*(1*a[c]+Math.round(Math.max(1,1e3*a[c]*t))/1e4))/1e6:a[c]+=Math.round(Math.max(1,.1*a[c]*t))),s+=westui.lang.popup[o][c].replace("#1",a[c]).replace("#2",r)}l>0&&(s+="
")}if(a.textjob){for(var n=0;n<a.textjob.length;n++)s+='

";s+="
"}if(a.bonus){for(var n=0;n<a.bonus.length;n++)s+='

";s+="
"}if(a.jobs){s+='

';for(var n=0;n<a.jobs.length;n++)s+='";s+="

"}if(a.craft){s+='

"}return s+='

"},setPosition:function(e){var t,a,i=$(window).width(),s=$(window).height(),p=westui.popup.getEl().outerWidth(),n=westui.popup.getEl().outerHeight(),o=e.clientX,l=e.clientY;a=o+p+20>i?o-p-20<0?e.pageX-e.clientX:e.pageX-p-20:20+e.pageX,t=l+n+20>s?s-n+(e.pageY-e.clientY):20+e.pageY,westui.popup.getEl().css({top:t,left:a})},init:function(){$("body").append('

'),$(document).on("mouseenter",".item_container",function(e){westui.popup.show(this),westui.popup.setPosition(e)}),$(document).on("mouseleave",".item_container",function(){westui.popup.hide()}),$(document).on("mousemove",".item_container",function(e){westui.popup.setPosition(e)}),$(".item_level").mousedown(function(e){e.preventDefault()}),$(document).on("click",".upgrade",function(){var e=$(this).closest(".item_container"),t=parseInt(e.attr("data-lvl"));5!==t&&(e.attr("data-lvl",t+1),e.find(".level").html(t+1)),westui.popup.show(e[0])}),$(document).on("click",".downgrade",function(){var e=$(this).closest(".item_container"),t=parseInt(e.attr("data-lvl"));0!==t&&(e.attr("data-lvl",t-1),e.find(".level").html(t-1)),westui.popup.show(e[0])})}},set_calc:{bonus:{extra_set_bonus:{}},data:{},itemStatus:{},getData:function(){$(".set_container").each(function(){var e=$(this).attr("data-set-id");westui.set_calc.itemStatus[e]={},westui.set_calc.data[e]={items:{},set:{}}}),$(".infoSet").each(function(){var e=$(this).attr("data-set-id");$(this).find(".infosetatt").each(function(){var t=$(this).attr("data-nb");westui.set_calc.data[e].set[t]={},$(this).find(".set_bonus").each(function(){key=$(this).attr("data-type"),0!==$(this).find(".calc").length?westui.set_calc.data[e].set[t][key]=-parseFloat($(this).find(".calc").attr("id")):westui.set_calc.data[e].set[t][key]=parseFloat($(this).find(".val").text()),westui.config.set_bonus.hasOwnProperty(key)||(westui.set_calc.bonus.extra_set_bonus[key]={img:$(this).find("img").attr("src"),name:$(this).find("#tooltip_content").text()})})})}),$(".set_container").each(function(){var e=$(this).attr("data-set-id");$(this).find(".item_container").each(function(){var t=JSON.parse($(this).attr("data-popup"));$(this).is(":hidden")?westui.set_calc.itemStatus[e][t.id]=!1:westui.set_calc.itemStatus[e][t.id]=0;for(var a in t)t.hasOwnProperty(a)&&(westui.config.set_bonus.hasOwnProperty(a)||westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(a))&&(westui.set_calc.data[e].items[a]||(westui.set_calc.data[e].items[a]={}),westui.set_calc.data[e].items[a][t.id]=t[a])})})},calc:function(){if(0===$("#input_level").length|""!==$("#input_level input").val()){var e=parseInt($("#input_level input").val());total={};for(var t in westui.set_calc.data){for(var a in westui.set_calc.data[t].items)for(var i in westui.set_calc.data[t].items[a])if(!1!==westui.set_calc.itemStatus[t][i]){lvl=westui.set_calc.itemStatus[t][i],total[a]||(total[a]=0);var s=westui.set_calc.data[t].items[a][i];westui.set_calc.data[t].items[a][i]<0?(s=-s,westui.set_calc.itemStatus[t][i]>0?total[a]+=Math.ceil(s*e)+Math.round(Math.max(1,.1*Math.ceil(s*e)*lvl)):total[a]+=Math.ceil(s*e)):westui.set_calc.itemStatus[t][i]>0?total[a]+=s<1?Math.round(1e6*(1*s+Math.round(Math.max(1,1e3*s*lvl))/1e4))/1e6:s+Math.round(Math.max(1,.1*s*lvl)):total[a]+=s}var p=0;for(var i in westui.set_calc.itemStatus[t])!1!==westui.set_calc.itemStatus[t][i]&&p++;for(var a in westui.set_calc.data[t].set[p])total[a]||(total[a]=0),westui.set_calc.data[t].set[p][a]<0?total[a]+=Math.ceil(-westui.set_calc.data[t].set[p][a]*e):total[a]+=westui.set_calc.data[t].set[p][a]}var n='

<tbody>

'+westui.lang.total+"
";for(var a in westui.config.set_bonus)total.hasOwnProperty(a)&&(n+='
<img src="'+westui.config.set_bonus[a].img+'">+'+total[a]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(a)?"%":"")+'
'+westui.config.set_bonus[a].name+"
");for(var a in westui.set_calc.bonus.extra_set_bonus)total.hasOwnProperty(a)&&(n+='
<img src="'+westui.set_calc.bonus.extra_set_bonus[a].img+'">+'+total[a]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(a)?"%":"")+'
'+westui.set_calc.bonus.extra_set_bonus[a].name+"
");$("#set_calc").html(n)}else $("#set_calc").html("")},initEvents:function(){$(".item_container > img").on("click",function(){var e=$(this).closest(".item_container");e.toggleClass("item_off");var t=e.closest(".set_container").attr("data-set-id"),a=JSON.parse(e.attr("data-popup")).id;e.hasClass("item_off")||e.is(":hidden")?westui.set_calc.itemStatus[t][a]=!1:westui.set_calc.itemStatus[t][a]=parseInt(e.attr("data-lvl")),westui.set_calc.calc()}),$(document).on("click",".upgrade, .downgrade",function(){var e=$(this).closest(".item_container"),t=e.closest(".set_container").attr("data-set-id");e.hasClass("item_off")||e.is(":hidden")||(westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=parseInt(e.attr("data-lvl")),westui.set_calc.calc())}),$("#input_level").bind("propertychange keyup input paste",function(){westui.set_calc.calc()}),$("#switch").on("click",function(){$("#melee, #fire").each(function(){var e=$(this).find(".item_container"),t=$(this).closest(".set_container").attr("data-set-id");$(this).is(":hidden")?westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=!1:westui.set_calc.itemStatus[t][JSON.parse(e.attr("data-popup")).id]=parseInt(e.attr("data-lvl"))}),westui.set_calc.calc()})},init:function(){westui.set_calc.initEvents(),westui.set_calc.getData(),$("#mw-content-text").append('
'),0===$("#input_level").length&&westui.set_calc.calc()}},sorting:{sortItems:function(e){function t(t){var a=JSON.parse($(t).attr("data-popup")),i=$("#input_level input").val();i=i||150;var s=-1!==Object.keys(e).indexOf("id")||e.bool&&!0===e.bool,p=0;if(e.bool&&!0===e.bool){p=1;for(var n in e)"bool"!==n&&a[n]!==e[n]&&(p=0)}else for(var n in e)"id"===n?p-=a[n]:(!a.lvl||a.lvl<=i)&&a[n]&&(a[n]<0?p+=Math.ceil(-a[n]*i)*e[n]:p+=a[n]*e[n]);$(t).attr("data-sort",p),0==p&&$(t).hide(),0!==$(t).find(".sortval").length?s?$(t).find(".sortval").html(""):$(t).find(".sortval").html(p):s||$(t).append('
'+p+"
")}$(".item_container").removeAttr("data-sort").show(),$("#mw-content-text").find(".sorting_hidden").hide(),$(".sorting_container").each(function(){$(this).find(".item_container").sort(function(e,a){return $(e).attr("data-sort")||t(e),$(a).attr("data-sort")||t(a),$(a).attr("data-sort")-$(e).attr("data-sort")}).appendTo($(this))})},init:function(){if(1===$("div#sort_items").length){var e="",$("div#sort_items").html(e),$("select#sort_items").on("change",function(){westui.sorting.sortItems(JSON.parse($(this).find("option:selected").attr("value")))})}}},init:function(){westui.initPage(),westui.popup.init(),westui.config.enable_sorting&&westui.sorting.init(),westui.config.enable_set_calc&&0!==$(".infoSet").length&&westui.set_calc.init()}},westui.init();