« 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 :
$('body').append('<div 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 class="popup_contents"></div></div>');
westui={lang:{input_level:"Votre 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>'}}},config:{enable_set_calc:!1,plain_popup:!1,redirect_on_dblclick:!1,cdn:"https://westfr.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:{str:{name:"Strength",img:"/images/thumb/8/8b/Strength.png/40px-Strength.png"},mob:{name:"Mobility",img:"/images/thumb/5/5a/Mobility.png/40px-Mobility.png"},dex:{name:"Dexterity",img:"/images/thumb/0/0d/Dexterity.png/40px-Dexterity.png"},cha:{name:"Charisma",img:"/images/thumb/c/c9/Charisma.png/40px-Charisma.png"},con:{name:"Construction",img:"/images/thumb/3/37/Construction.png/40px-Construction.png"},vig:{name:"Vigor",img:"/images/thumb/9/90/Skill_Punch.png/40px-Skill_Punch.png"},tou:{name:"Toughness",img:"/images/thumb/f/f8/Skill_Tough.png/40px-Skill_Tough.png"},sta:{name:"Stamina",img:"/images/thumb/8/8d/Stamina.png/40px-Stamina.png"},hea:{name:"Health Points",img:"/images/thumb/9/94/Health.png/40px-Health.png"},rid:{name:"Horseback Riding",img:"/images/thumb/7/78/Hbr.png/40px-Hbr.png"},ref:{name:"Reflex",img:"/images/thumb/e/e9/Skill_Reflex.png/40px-Skill_Reflex.png"},dod:{name:"Dodging",img:"/images/thumb/0/07/Skill_Dodge.png/40px-Skill_Dodge.png"},hid:{name:"Hiding",img:"/images/thumb/9/97/Hiding.png/40px-Hiding.png"},swi:{name:"Swimming",img:"/images/thumb/f/f4/Swimming.png/40px-Swimming.png"},aim:{name:"Aiming",img:"/images/thumb/5/53/Skill_Aim.png/40px-Skill_Aim.png"},sho:{name:"Shooting",img:"/images/thumb/7/73/Skill_Shot.png/40px-Skill_Shot.png"},pit:{name:"Setting traps",img:"/images/thumb/e/e1/Trapping.png/40px-Trapping.png"},fin:{name:"Fine Motor Skills",img:"/images/thumb/1/18/Fms.png/40px-Fms.png"},rep:{name:"Repairing",img:"/images/thumb/d/d5/Repairing.png/40px-Repairing.png"},lea:{name:"Leadership",img:"/images/thumb/4/44/Leadership.png/40px-Leadership.png"},tac:{name:"Tactics",img:"/images/thumb/9/91/Skill_Tactic.png/40px-Skill_Tactic.png"},tra:{name:"Trading",img:"/images/thumb/f/f3/Skill_Trading.png/40px-Skill_Trading.png"},ani:{name:"Animal Instinct",img:"/images/thumb/9/9d/AnimalInstinct.png/40px-AnimalInstinct.png"},app:{name:"Appearance",img:"/images/thumb/4/4c/Skill_Appearance.png/40px-Skill_Appearance.png"},fbdef:{name:"<b>Defense</b> (Fort battle bonus)",img:"/images/8/82/Set_Fb_defense.png"},fboff:{name:"<b>Attack</b> (Fort battle bonus)",img:"/images/3/30/Set_Fb_offense.png"},fbres:{name:"<b>Resistance</b> (Fort battle bonus)",img:"/images/4/4b/Resistance.png"},fbdefs:{name:"<b>Defense</b> (Fort battle sector bonus)",img:"/images/1/1a/Set_Fb_defense_sec.png"},fboffs:{name:"<b>Attack</b> (Fort battle sector bonus)",img:"/images/f/fe/Set_Fb_offense_sec.png"},fbdmgs:{name:"<b>Damages</b> (Fort battle sector bonus)",img:"/images/b/b3/Damages_sector.png"},xp:{name:"Experience from jobs, duels, and fort battles (%)",img:"/images/7/71/Set_xp.png"},money:{name:"Money from jobs and duels (%)",img:"/images/d/df/Set_money.png"},luck:{name:"Increased Luck",img:"/images/c/c1/Set_luck.png"},regen:{name:"Regeneration",img:"/images/5/53/Regeneration.png"},drop:{name:"Improved drop chance",img:"/images/thumb/b/b8/Drop.png/40px-Drop.png"},labor_pts:{name:"Labor points (all jobs)",img:"/images/5/5e/Labor_pts.png"}}},initPage:function(){if(1===$("#input_level").length)var t=$('<input type="number" style="width:80px;" class="west" placeholder="'+westui.lang.input_level+'" min="0" max="150">').bind("propertychange keyup input paste",function(){150<this.value?this.value=150:this.value<0&&(this.value=0),$(".calc").each(function(){0==t.val()?($(this).html(this.id),$(".per_level_off").addClass("per_level").removeClass("per_level_off")):($(this).html(Math.ceil(Number(this.id)*t.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 t=this.value.toLowerCase();""===t?$(".item_container").show():($(".item_container").hide(),$(".item_container").filter(function(){return-1<$(this).attr("data-popup").toLowerCase().indexOf(t)}).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_tl"></div><div class="tw_bg_tr"></div><div class="tw_bg_bl"></div><div class="tw_bg_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").attr("data-popup"),$(".item_container").attr("data-cdn-cat"),$(".item_container").attr("data-cdn-img"),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})},popup:{content:"",delay:200,active:!1,show:function(t){westui.popup.content=westui.popup.createPopup($(t).attr("data-popup"),$(t).attr("data-cdn-cat"),$(t).attr("data-cdn-img"),parseInt($(t).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(t,e,i,a){t=JSON.parse(t);var s='<div class="popup_image"><img src="'+westui.config.cdn+"/images/items/"+t.cdn_cat+"/"+t.cdn_img+'.png"/></div><div class="popup_divider"></div><p class="popup_name">'+t.name+'</p><p class="popup_type">'+t.type+"</p><br/>",p=!1;if(1<=a&&a<=5&&(p=!0,t.auc=!1),t.dmg_min&&t.dmg_max&&(p&&(t.dmg_min+=Math.round(Math.max(1,.1*t.dmg_min*a)),t.dmg_max+=Math.round(Math.max(1,.1*t.dmg_max*a))),s+='<p class="popup_dmg">'+t.dmg_min+"-"+t.dmg_max+" "+westui.lang.damages+"</p>"),t.text){for(var n=0;n<t.text.length;n++)s+='<p class="popup_text">'+t.text[n]+"</p>";s+="<br/>"}for(var l in westui.lang.popup){var o=0;for(var c in westui.lang.popup[l])if(t.hasOwnProperty(c)){o++;var u="";t[c]<0?0<$("#input_level input").val()?(t[c]=Math.ceil($("#input_level input").val()*-t[c]),p&&(t[c]+=Math.round(Math.max(1,.1*t[c]*a)))):(t[c]=-t[c],u=" ("+westui.lang.per_level+")",p&&(t[c]=Math.round(1e6*(1*t[c]+Math.round(Math.max(1,1e3*t[c]*a))/1e4))/1e6)):p&&(t[c]<1?t[c]=Math.round(1e6*(1*t[c]+Math.round(Math.max(1,1e3*t[c]*a))/1e4))/1e6:t[c]+=Math.round(Math.max(1,.1*t[c]*a))),s+=westui.lang.popup[l][c].replace("#1",t[c]).replace("#2",u)}0<o&&(s+="<br/>")}if(t.textjob){for(n=0;n<t.textjob.length;n++)s+='<p class="popup_txtgreen">'+t.textjob[n]+"</p>";s+="<br/>"}if(t.bonus){for(n=0;n<t.bonus.length;n++)s+='<p class="popup_bonus">'+t.bonus[n]+"</p>";s+="<br/>"}if(t.jobs){s+='<div style="text-align:center;"><table class="popup_job">';for(n=0;n<t.jobs.length;n++)s+='<tr><td><img src="'+westui.config.cdn+"/images/jobs/"+t.jobs[n][1]+'.png"/></td><td><span>&nbsp;&nbsp;'+t.jobs[n][0]+"</span></td></tr>";s+="</table></div>"}if(t.craft){s+='<div style="text-align:center;"><table  class="popup_crafteditem"><tr><td><img src="'+westui.config.cdn+"/images/crafting/profsymbol_"+t.craft.id+'_small.png"/></td><td><table><tr>';for(n=0;n<t.craft.req.length;n++)s+='<td><img style="width:36px;height:36px;" src="'+westui.config.cdn+"/images/items/yield/"+t.craft.req[n][0]+'.png"/></td>';s+="</tr><tr>";for(n=0;n<t.craft.req.length;n++)s+="<td><span>x"+t.craft.req[n][1]+"</span></td>";s+="</tr></table></td></tr></table></div>"}return s+='<div class="popup_infos">',t.spd&&(p&&(t.spd+=Math.round(Math.max(1,.1*t.spd*a))),s+='<p class="popup_speed">'+westui.lang.speed+": +"+t.spd+"%</p><br/>"),t.set&&(s+='<p><a class="popup_set" href="/wiki/'+t.set+'">'+t.set+"</a></p><br/>"),t.sp?s+='<img src="'+westui.config.img_buyprice+'"/>'+t.bp+'&nbsp;&nbsp;&nbsp;&nbsp;<img src="'+westui.config.img_sellprice+'"/>&nbsp;'+t.sp+"<br/><br/>":s+="<i>"+westui.lang.unsalable+"</i><br/><br/>",t.lvl&&(s+=westui.lang.level+" <b>"+t.lvl+"</b><br/>"),t.sex&&(0==t.sex?s+='<img src="'+westui.config.img_male+'"/>&nbsp;&nbsp;&nbsp;':s+='<img src="'+westui.config.img_female+'"/>&nbsp;&nbsp;&nbsp;'),1==t.auc?s+='<span class="popup_txtgreen">'+westui.lang.auction+"</span><br/>":s+='<span class="popup_txtred">'+westui.lang.not_auction+"</span><br/>",0==t.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>'+t.id+"</b>]</p></div>"},setPosition:function(t){var e,i,a=$(window).width(),s=$(window).height(),p=westui.popup.getEl().outerWidth(),n=westui.popup.getEl().outerHeight(),l=t.clientX,o=t.clientY;i=a<l+p+20?l-p-20+(t.pageX-t.clientX):l+20+(t.pageX-t.clientX),e=s<o+n+20?s-n+(t.pageY-t.clientY):o+20+(t.pageY-t.clientY),westui.popup.getEl().css({top:e,left:i})},init:function(){$("body").append('<div id="popup_window" class="popup_window"><div class="popup_front"><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><div id="popup_contents" class="popup_contents"></div></div>'),$(document).on("mouseenter",".item_container",function(t){westui.popup.show(this),westui.popup.setPosition(t)}),$(document).on("mouseleave",".item_container",function(){westui.popup.hide()}),$(document).on("mousemove",".item_container",function(t){westui.popup.setPosition(t)}),$(".item_level").mousedown(function(t){t.preventDefault()}),$(document).on("click",".upgrade",function(){var t=$(this).closest(".item_container"),e=parseInt(t.attr("data-lvl"));5!==e&&(t.attr("data-lvl",e+1),t.find(".level").html(e+1)),westui.popup.show(t[0])}),$(document).on("click",".downgrade",function(){var t=$(this).closest(".item_container"),e=parseInt(t.attr("data-lvl"));0!==e&&(t.attr("data-lvl",e-1),t.find(".level").html(e-1)),westui.popup.show(t[0])})}},set_calc:{bonus:{extra_set_bonus:{}},data:{},itemStatus:{},getData:function(){$(".set_container").each(function(){var i=$(this).attr("data-set-id");westui.set_calc.itemStatus[i]={},westui.set_calc.data[i]={items:{},set:{}},$(this).find(".item_container").each(function(){var t=JSON.parse($(this).attr("data-popup"));for(var e in $(this).is(":hidden")?westui.set_calc.itemStatus[i][t.id]=!1:westui.set_calc.itemStatus[i][t.id]=0,t)t.hasOwnProperty(e)&&westui.config.set_bonus.hasOwnProperty(e)&&(westui.set_calc.data[i].items[e]||(westui.set_calc.data[i].items[e]={}),westui.set_calc.data[i].items[e][t.id]=t[e])})}),$(".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()})})})})},calc:function(){if(0===$("#input_level").length|""!==$("#input_level input").val()){var t=parseInt($("#input_level input").val());for(var e in total={},westui.set_calc.data){for(var i in westui.set_calc.data[e].items)for(var a in westui.set_calc.data[e].items[i])if(!1!==westui.set_calc.itemStatus[e][a]){lvl=westui.set_calc.itemStatus[e][a],total[i]||(total[i]=0);var s=westui.set_calc.data[e].items[i][a];westui.set_calc.data[e].items[i][a]<0?(s=-s,0<westui.set_calc.itemStatus[e][a]?total[i]+=Math.ceil(s*t)+Math.round(Math.max(1,.1*Math.ceil(s*t)*lvl)):total[i]+=Math.ceil(s*t)):0<westui.set_calc.itemStatus[e][a]?total[i]+=s<1?Math.round(1e6*(1*s+Math.round(Math.max(1,1e3*s*lvl))/1e4))/1e6:Math.round(Math.max(1,.1*s*lvl)):total[i]+=s}var p=0;for(var a in westui.set_calc.itemStatus[e])!1!==westui.set_calc.itemStatus[e][a]&&p++;for(var i in westui.set_calc.data[e].set[p])total[i]||(total[i]=0),westui.set_calc.data[e].set[p][i]<0?total[i]+=Math.ceil(-westui.set_calc.data[e].set[p][i]*t):total[i]+=westui.set_calc.data[e].set[p][i]}var n='<center><table class="infoSet"><caption><br><big><b>'+westui.lang.total+"</b></big></caption><tbody><tr><td></center>";for(var i in westui.config.set_bonus)total.hasOwnProperty(i)&&(n+='<div class="set_bonus tooltip_container"><img src="'+westui.config.set_bonus[i].img+'"><b>+'+total[i]+'</b><div class="tooltip_outer"><div class="tooltip"><div class="tt_bg_tl"></div><div class="tt_bg_tr"></div><div class="tt_bg_bl"></div><div class="tt_bg_br"></div><div id="tooltip_content">'+westui.config.set_bonus[i].name+"</div></div></div></div>");for(var i in westui.set_calc.bonus.extra_set_bonus)total.hasOwnProperty(i)&&(n+='<div class="set_bonus tooltip_container"><img src="'+westui.set_calc.bonus.extra_set_bonus[i].img+'"><b>+'+total[i]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(i)?"%":"")+'</b><div class="tooltip_outer"><div class="tooltip"><div class="tt_bg_tl"></div><div class="tt_bg_tr"></div><div class="tt_bg_bl"></div><div class="tt_bg_br"></div><div id="tooltip_content">'+westui.set_calc.bonus.extra_set_bonus[i].name+"</div></div></div></div>");$("#set_calc").html(n)}else $("#set_calc").html("")},initEvents:function(){$(".item_container > img").on("click",function(){var t=$(this).closest(".item_container");t.toggleClass("item_off");var e=t.closest(".set_container").attr("data-set-id"),i=JSON.parse(t.attr("data-popup")).id;t.hasClass("item_off")||t.is(":hidden")?westui.set_calc.itemStatus[e][i]=!1:westui.set_calc.itemStatus[e][i]=parseInt(t.attr("data-lvl")),westui.set_calc.calc()}),$(document).on("click",".upgrade, .downgrade",function(){var t=$(this).closest(".item_container"),e=t.closest(".set_container").attr("data-set-id");t.hasClass("item_off")||t.is(":hidden")||(westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=parseInt(t.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 t=$(this).find(".item_container"),e=$(this).closest(".set_container").attr("data-set-id");$(this).is(":hidden")?westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=!1:westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=parseInt(t.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()}},init:function(){westui.initPage(),westui.popup.init(),westui.config.enable_set_calc&&0!==$(".infoSet").length&&westui.set_calc.init()}},westui.init();
$(document).on('mouseenter','.item_container',function(e){Popup.show(this);Popup.setPosition(e);});
$(document).on('mouseleave','.item_container',function(){Popup.hide();});
$(document).on('mousemove','.item_container', function(e){Popup.setPosition(e);});
 
$('.item_level').mousedown(function(e){ e.preventDefault(); });
$(document).on('click','.upgrade',function(){
    var container = $(this).closest('.item_container');
    var lvl = parseInt(container.attr('data-lvl'));
    if (lvl!==5){
        container.attr('data-lvl',lvl+1);
        container.find('.level').html(lvl+1);
    }
    Popup.show(container[0]);
});
$(document).on('click','.downgrade',function(){
    var container = $(this).closest('.item_container');
    var lvl = parseInt(container.attr('data-lvl'));
    if (lvl!==0){
        container.attr('data-lvl',lvl-1);
        container.find('.level').html(lvl-1);
    }
    Popup.show(container[0]);
});
 
if ($("#input_level").length == 1) {
    var input_level = $('<input type="number" style="width:95px;" class="west" placeholder="Votre niveau" min="0" max="150">').bind("propertychange keyup input paste", function() {
        if (this.value > 150) {
            this.value = 150;
        } else if (this.value < 0) {
            this.value = 0;
        }
        $(".calc").each(function() {
            if (input_level.val() == 0) {
                $(this).html(this.id);
                $('.per_level_off').addClass('per_level').removeClass('per_level_off');
            } else {
                $(this).html(Math.ceil(Number(this.id) * input_level.val()));
                $('.per_level').addClass('per_level_off').removeClass('per_level');
            }
        });
    }).appendTo($("#input_level"));
}
 
 
//Search
if ($("#input_search").length == 1) {
    var input_search = $('<input type="search" style="width:200px;" class="west" placeholder="Recherche">').bind("propertychange keyup input paste", function() {
        var val = this.value.toLowerCase();
        if (val == '') {
            $('.item_container').show();
        } else {
            $('.item_container').hide();
            $('.item_container').filter(function() {
                return $(this).attr('data-popup').toLowerCase().indexOf(val) > -1;
            }).show();
        }
    }).appendTo($("#input_search"));
}
 
//Switch weapons
if ($("#switch").length == 1) {
    $("#fire").hide();
    $("#switch").on("click", function() {
        $('#melee, #fire').toggle()
    });
}
//Switch products
if ($("#switch_prod").length == 1) {
    $("#prod2").hide();
    $("#switch_prod").on("click", function() {
        $('#prod, #prod2').toggle()
    });
}
 
var Popup = {
    content : "",
    delay : 200,
    active : false,
    show: function(obj) {
        Popup.content = Popup.createPopup($(obj).attr('data-popup'), $(obj).attr('data-cdn-cat'), $(obj).attr('data-cdn-img'), parseInt($(obj).attr('data-lvl')));
        Popup.active = true;
        Popup.setTimeout();
        Popup.getContainer().html(Popup.content);
    },
    hide: function() {
        Popup.getEl().css({
            display: 'none',
            top: 0,
            left: 0
        });
        Popup.active = false;
        Popup.clearTimeout();
    },
    setTimeout: function() {
        Popup.clearTimeout();
        Popup.timer = window.setTimeout(function() {
            Popup.getEl().css('display', 'block');
        }, Popup.delay);
    },
    clearTimeout : function() {
        if (Popup.timer) window.clearTimeout(Popup.timer);
    },
    getEl : function() {
        return $('.popup_window');
    },
    getContainer : function() {
        return $('.popup_contents');
    },
    createPopup: function(data, cdn_cat, cdn_name, lvl) {
        data = JSON.parse(data);
        var html = '<div class="popup_image"><img src="https://westzz.innogamescdn.com/images/items/' + data.cdn_cat + '/' + data.cdn_img + '.png' + '"/></div><div class="popup_divider"></div><p class="popup_name">' + data.name + '</p><p class="popup_type">' + data.type + '</p><br/>';
        var upgraded = false;
        if ((lvl>=1)&&(lvl<=5)){
            upgraded = true;
            data.auc = false;
        }
        if (data.dgmin&&data.dgmax){
            if (upgraded) {
                data.dgmin += Math.round(Math.max(1, data.dgmin * 0.1  * lvl));
                data.dgmax += Math.round(Math.max(1, data.dgmax * 0.1  * lvl));
            }
            html += '<p class="popup_dmg">'+data.dgmin+'-'+data.dgmax+' Dégâts</p>';
        }
        for (var cat in Popup.data) {
            var cnt = 0;
            for (var key in Popup.data[cat]) {
                if (data.hasOwnProperty(key)) {
                    cnt++;
                    var per_level = "";
                    if (data[key] < 0) {
                        if ($('#input_level input').val() > 0) {
                            data[key] = Math.ceil($('#input_level input').val() * -data[key]);
                            if (upgraded){
                                data[key] += Math.round(Math.max(1, data[key] * 0.1  * lvl));
                            }
                        } else {
                            data[key] = -data[key];
                            per_level = " (par Niveau)";
                            if (upgraded){
                                data[key] = Math.round(1e6 * (data[key] * 1 + Math.round(Math.max(1, data[key] * 1000 * lvl)) / 10000)) / 1e6;
                            }
                        }
                    } else if (upgraded) {
if (data[key]<1){
data[key] = Math.round(1e6 * (data[key] * 1 + Math.round(Math.max(1, data[key] * 1000 * lvl)) / 10000)) / 1e6;
} else {
    data[key] += Math.round(Math.max(1, data[key] * 0.1  * lvl));
}
                    }
                    html += Popup.data[cat][key].replace('#1', data[key]).replace('#2', per_level);
                }
            }
            if (cnt > 0) {
                html += '<br/>';
            }
        }
        if (data.text){
            for (var i = 0; i < data.text.length;i++){
                html += '<p class="popup_text">'+data.text[i]+'</p>';
            }
            html+='<br/>';
        }
        if (data.bonus){
            for (var i = 0; i < data.bonus.length;i++){
                html += '<p class="popup_bonus">'+data.bonus[i]+'</p>';
            }
            html+='<br/>';
        }
        if (data.jobs){
            html += '<div style="text-align:center;"><table class="popup_job">';
            for (var i =0; i<data.jobs.length;i++){
                html += '<tr><td><img src="https://westfr.innogamescdn.com/images/jobs/'+data.jobs[i][1]+'.png"/></td><td><span>&nbsp;&nbsp;'+data.jobs[i][0]+'</span></td></tr>';
            }
            html += '</table></div>';
        }
        if (data.craft){
            html += '<div style="text-align:center;"><table  class="popup_crafteditem"><tr><td><img src="https://westfr.innogamescdn.com/images/crafting/profsymbol_'+data.craft.id+'_small.png"/></td><td><table><tr>';
            for (var i = 0;i<data.craft.req.length;i++){
                html += '<td><img style="width:36px;height:36px;" src="https://westfr.innogamescdn.com/images/items/yield/'+data.craft.req[i][0]+'.png"/></td>';
            }
            html += '</tr><tr>';
            for (var i = 0;i<data.craft.req.length;i++){
                html += '<td><span>x'+data.craft.req[i][1]+'</span></td>';
            }
            html += '</tr></table></td></tr></table></div>';
        }
        html += '<div class="popup_infos">';
        if (data.spd){
if (upgraded){
data.spd += Math.round(Math.max(1, data.spd * 0.1  * lvl));
}
html += '<p class="popup_speed">Vitesse: +' + data.spd + '%</p><br/>';
}
        if (data.set) html += '<p class="popup_set">' + data.set + '</p><br/>';
if (data.quete) html += '<p class="popup_quest"><strong> Quête(s) : </strong>' + data.quete + '</p><br/>';
        if (data.sp) {
            html += '<img src="/images/2/22/Achat.png"/>' + data.bp + '&nbsp;&nbsp;&nbsp;&nbsp;<img src="/images/3/3b/Vente.png"/>&nbsp;' + data.sp + '<br/><br/>';
        } else {
            html += '<i>Non vendable</i><br/><br/>';
        }
        if (data.lvl) html += 'Niveau <b>' + data.lvl + '</b><br/>';
        if (data.sex) {
            if (data.sex == 0) {
                html += '<img src="/images/8/83/Homme.png"/>&nbsp;&nbsp;&nbsp;';
            } else {
                html += '<img src="/images/8/8c/Femme.png"/>&nbsp;&nbsp;&nbsp;';
            }
        }
        if (data.auc == 1){
            html += '<span class="popup_txtgreen">Peut être acheté/vendu aux enchères</span><br/>';
        } else {
            html += '<span class="popup_txtred">Ne peut pas être acheté/vendu aux enchères</span><br/>';
        }
        if (data.upg == 0) {
            html += '<span class="popup_txtred">Non améliorable</span><br/>';
        } else {
            html += '<span class="popup_txtgreen">Améliorable</span><br/>';
        }
        html += '<br/><p class="popup_id">[item=<b>' + data.id + '</b>]</p></div>';
        return html;
    },
    setPosition : function (e) {
        var window_width = $(window).width();
        var window_height = $(window).height();
        var popup_width = Popup.getEl().outerWidth();
        var popup_height = Popup.getEl().outerHeight();
        var pos_x = e.clientX;
        var pos_y = e.clientY;
        var top;
        var left;
        var margin_top = 20;
        var margin_left = 20;
        if (pos_x + popup_width + margin_left > window_width) {
            left = pos_x - popup_width - margin_left + (e.pageX - e.clientX);
        } else {
            left = pos_x + margin_left + (e.pageX - e.clientX);
        }
        if (pos_y + popup_height + margin_top > window_height) {
            top = window_height - popup_height + (e.pageY - e.clientY);
        } else {
            top = pos_y + margin_top + (e.pageY - e.clientY);
        }
        Popup.getEl().css({
            top: top,
            left: left
        });
    },
    data: {
        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>'
        }
    }
};

Version du 7 juillet 2018 à 17:06

westui={lang:{input_level:"Votre 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:'

'}}},config:{enable_set_calc:!1,plain_popup:!1,redirect_on_dblclick:!1,cdn:"https://westfr.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:{str:{name:"Strength",img:"/images/thumb/8/8b/Strength.png/40px-Strength.png"},mob:{name:"Mobility",img:"/images/thumb/5/5a/Mobility.png/40px-Mobility.png"},dex:{name:"Dexterity",img:"/images/thumb/0/0d/Dexterity.png/40px-Dexterity.png"},cha:{name:"Charisma",img:"/images/thumb/c/c9/Charisma.png/40px-Charisma.png"},con:{name:"Construction",img:"/images/thumb/3/37/Construction.png/40px-Construction.png"},vig:{name:"Vigor",img:"/images/thumb/9/90/Skill_Punch.png/40px-Skill_Punch.png"},tou:{name:"Toughness",img:"/images/thumb/f/f8/Skill_Tough.png/40px-Skill_Tough.png"},sta:{name:"Stamina",img:"/images/thumb/8/8d/Stamina.png/40px-Stamina.png"},hea:{name:"Health Points",img:"/images/thumb/9/94/Health.png/40px-Health.png"},rid:{name:"Horseback Riding",img:"/images/thumb/7/78/Hbr.png/40px-Hbr.png"},ref:{name:"Reflex",img:"/images/thumb/e/e9/Skill_Reflex.png/40px-Skill_Reflex.png"},dod:{name:"Dodging",img:"/images/thumb/0/07/Skill_Dodge.png/40px-Skill_Dodge.png"},hid:{name:"Hiding",img:"/images/thumb/9/97/Hiding.png/40px-Hiding.png"},swi:{name:"Swimming",img:"/images/thumb/f/f4/Swimming.png/40px-Swimming.png"},aim:{name:"Aiming",img:"/images/thumb/5/53/Skill_Aim.png/40px-Skill_Aim.png"},sho:{name:"Shooting",img:"/images/thumb/7/73/Skill_Shot.png/40px-Skill_Shot.png"},pit:{name:"Setting traps",img:"/images/thumb/e/e1/Trapping.png/40px-Trapping.png"},fin:{name:"Fine Motor Skills",img:"/images/thumb/1/18/Fms.png/40px-Fms.png"},rep:{name:"Repairing",img:"/images/thumb/d/d5/Repairing.png/40px-Repairing.png"},lea:{name:"Leadership",img:"/images/thumb/4/44/Leadership.png/40px-Leadership.png"},tac:{name:"Tactics",img:"/images/thumb/9/91/Skill_Tactic.png/40px-Skill_Tactic.png"},tra:{name:"Trading",img:"/images/thumb/f/f3/Skill_Trading.png/40px-Skill_Trading.png"},ani:{name:"Animal Instinct",img:"/images/thumb/9/9d/AnimalInstinct.png/40px-AnimalInstinct.png"},app:{name:"Appearance",img:"/images/thumb/4/4c/Skill_Appearance.png/40px-Skill_Appearance.png"},fbdef:{name:"Defense (Fort battle bonus)",img:"/images/8/82/Set_Fb_defense.png"},fboff:{name:"Attack (Fort battle bonus)",img:"/images/3/30/Set_Fb_offense.png"},fbres:{name:"Resistance (Fort battle bonus)",img:"/images/4/4b/Resistance.png"},fbdefs:{name:"Defense (Fort battle sector bonus)",img:"/images/1/1a/Set_Fb_defense_sec.png"},fboffs:{name:"Attack (Fort battle sector bonus)",img:"/images/f/fe/Set_Fb_offense_sec.png"},fbdmgs:{name:"Damages (Fort battle sector bonus)",img:"/images/b/b3/Damages_sector.png"},xp:{name:"Experience from jobs, duels, and fort battles (%)",img:"/images/7/71/Set_xp.png"},money:{name:"Money from jobs and duels (%)",img:"/images/d/df/Set_money.png"},luck:{name:"Increased Luck",img:"/images/c/c1/Set_luck.png"},regen:{name:"Regeneration",img:"/images/5/53/Regeneration.png"},drop:{name:"Improved drop chance",img:"/images/thumb/b/b8/Drop.png/40px-Drop.png"},labor_pts:{name:"Labor points (all jobs)",img:"/images/5/5e/Labor_pts.png"}}},initPage:function(){if(1===$("#input_level").length)var t=$('<input type="number" style="width:80px;" class="west" placeholder="'+westui.lang.input_level+'" min="0" max="150">').bind("propertychange keyup input paste",function(){150<this.value?this.value=150:this.value<0&&(this.value=0),$(".calc").each(function(){0==t.val()?($(this).html(this.id),$(".per_level_off").addClass("per_level").removeClass("per_level_off")):($(this).html(Math.ceil(Number(this.id)*t.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 t=this.value.toLowerCase();""===t?$(".item_container").show():($(".item_container").hide(),$(".item_container").filter(function(){return-1<$(this).attr("data-popup").toLowerCase().indexOf(t)}).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").attr("data-popup"),$(".item_container").attr("data-cdn-cat"),$(".item_container").attr("data-cdn-img"),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})},popup:{content:"",delay:200,active:!1,show:function(t){westui.popup.content=westui.popup.createPopup($(t).attr("data-popup"),$(t).attr("data-cdn-cat"),$(t).attr("data-cdn-img"),parseInt($(t).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(t,e,i,a){t=JSON.parse(t);var s='


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

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

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

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

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

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

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

"}return s+='

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

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

<tbody>

'+westui.lang.total+"
";for(var i in westui.config.set_bonus)total.hasOwnProperty(i)&&(n+='
<img src="'+westui.config.set_bonus[i].img+'">+'+total[i]+'
'+westui.config.set_bonus[i].name+"
");for(var i in westui.set_calc.bonus.extra_set_bonus)total.hasOwnProperty(i)&&(n+='
<img src="'+westui.set_calc.bonus.extra_set_bonus[i].img+'">+'+total[i]+(-1!==["xp","money","luck","spd","regen","drop"].indexOf(i)?"%":"")+'
'+westui.set_calc.bonus.extra_set_bonus[i].name+"
");$("#set_calc").html(n)}else $("#set_calc").html("")},initEvents:function(){$(".item_container > img").on("click",function(){var t=$(this).closest(".item_container");t.toggleClass("item_off");var e=t.closest(".set_container").attr("data-set-id"),i=JSON.parse(t.attr("data-popup")).id;t.hasClass("item_off")||t.is(":hidden")?westui.set_calc.itemStatus[e][i]=!1:westui.set_calc.itemStatus[e][i]=parseInt(t.attr("data-lvl")),westui.set_calc.calc()}),$(document).on("click",".upgrade, .downgrade",function(){var t=$(this).closest(".item_container"),e=t.closest(".set_container").attr("data-set-id");t.hasClass("item_off")||t.is(":hidden")||(westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=parseInt(t.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 t=$(this).find(".item_container"),e=$(this).closest(".set_container").attr("data-set-id");$(this).is(":hidden")?westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=!1:westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id]=parseInt(t.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()}},init:function(){westui.initPage(),westui.popup.init(),westui.config.enable_set_calc&&0!==$(".infoSet").length&&westui.set_calc.init()}},westui.init();