Popup.js: Diferență între versiuni

De la Wiki The-West RO
Jump to navigation
Fără descriere a modificării
Fără descriere a modificării
 
(Nu s-au afișat 71 de versiuni intermediare efectuate de alți 2 utilizatori)
Linia 1: Linia 1:
westui = {
westui = {
  lang: {
    lang: {
    input_level: "Levelul tau",
        input_level: "Nivelul tău",
    input_search: "Caută",
        input_search: "Caută",
    damages: "Daună",
        damages: "Daune",
    per_level: "per nivel",
        per_level: "pe nivel",
    speed: "Speed",
        speed: "Viteză",
    level: "Level",
        level: "Nivel",
    unsalable: "Unsalable",
        unsalable: "Nevandabil",
    auction: "Auctionable",
        auction: "Licitabil",
    not_auction: "Not auctionable",
        not_auction: "Nelicitabil",
    not_upgrade: "Not upgradeable",
        not_upgrade: "Nu poate fi îmbunătățit",
    upgrade: "Upgradeable",
        upgrade: "Poate fi îmbunătățit",
    total: "Total",
        total: "Total",
    popup: {
        popup: {
      dmg: {
            dmg: {
        dmglvl: '<p class="popup_dmg">+ #1 Damages#2</p>'
                dmglvl: '<p class="popup_dmg">+ #1 Daune#2</p>'
      },
            },
      skills: {
            skills: {
        str: '<p class="popup_attribute">+ #1 Strength#2</p>',
                str: '<p class="popup_attribute">+ #1 Putere#2</p>',
        mob: '<p class="popup_attribute">+ #1 Mobility#2</p>',
                mob: '<p class="popup_attribute">+ #1 Mobilitate#2</p>',
        dex: '<p class="popup_attribute">+ #1 Dexterity#2</p>',
                dex: '<p class="popup_attribute">+ #1 Dexteritate#2</p>',
        cha: '<p class="popup_attribute">+ #1 Charisma#2</p>',
                cha: '<p class="popup_attribute">+ #1 Carismă#2</p>',
        con: '<p class="popup_skill">+ #1 Construction#2</p>',
                con: '<p class="popup_skill">+ #1 Construcție#2</p>',
        vig: '<p class="popup_skill">+ #1 Vigor#2</p>',
                vig: '<p class="popup_skill">+ #1 Vigoare#2</p>',
        tou: '<p class="popup_skill">+ #1 Toughness#2</p>',
                tou: '<p class="popup_skill">+ #1 Rezistență#2</p>',
        sta: '<p class="popup_skill">+ #1 Stamina#2</p>',
                sta: '<p class="popup_skill">+ #1 Perseverență#2</p>',
        hea: '<p class="popup_skill">+ #1 Health Points#2</p>',
                hea: '<p class="popup_skill">+ #1 Puncte de viață#2</p>',
        rid: '<p class="popup_skill">+ #1 Horseback Riding#2</p>',
                rid: '<p class="popup_skill">+ #1 Călărie#2</p>',
        ref: '<p class="popup_skill">+ #1 Reflex#2</p>',
                ref: '<p class="popup_skill">+ #1 Reflex#2</p>',
        dod: '<p class="popup_skill">+ #1 Dodging#2</p>',
                dod: '<p class="popup_skill">+ #1 Ferire#2</p>',
        hid: '<p class="popup_skill">+ #1 Hiding#2</p>',
                hid: '<p class="popup_skill">+ #1 Ascundere#2</p>',
        swi: '<p class="popup_skill">+ #1 Swimming#2</p>',
                swi: '<p class="popup_skill">+ #1 Înot#2</p>',
        aim: '<p class="popup_skill">+ #1 Aiming#2</p>',
                aim: '<p class="popup_skill">+ #1 Țintire#2</p>',
        sho: '<p class="popup_skill">+ #1 Shooting#2</p>',
                sho: '<p class="popup_skill">+ #1 Împușcare#2</p>',
        pit: '<p class="popup_skill">+ #1 Setting traps#2</p>',
                pit: '<p class="popup_skill">+ #1 Pune capcane#2</p>',
        fin: '<p class="popup_skill">+ #1 Fine Motor Skills#2</p>',
                fin: '<p class="popup_skill">+ #1 Îndemânare motrică#2</p>',
        rep: '<p class="popup_skill">+ #1 Repairing#2</p>',
                rep: '<p class="popup_skill">+ #1 Reparare#2</p>',
        lea: '<p class="popup_skill">+ #1 Leadership#2</p>',
                lea: '<p class="popup_skill">+ #1 Conducere#2</p>',
        tac: '<p class="popup_skill">+ #1 Tactics#2</p>',
                tac: '<p class="popup_skill">+ #1 Tactică#2</p>',
        tra: '<p class="popup_skill">+ #1 Trading#2</p>',
                tra: '<p class="popup_skill">+ #1 Comerț#2</p>',
        ani: '<p class="popup_skill">+ #1 Animal Instinct#2</p>',
                ani: '<p class="popup_skill">+ #1 Instinct pentru animale#2</p>',
        app: '<p class="popup_skill">+ #1 Appearance#2</p>'
                app: '<p class="popup_skill">+ #1 Aspect#2</p>'
      },
            },
      fb: {
            fb: {
        fbdef: '<p class="popup_fb">+ #1 <b>Defense</b> (Fort battle bonus)#2</p>',
                fbdef: '<p class="popup_fb">+ #1 <b>Apărare</b> (bonus pentru bătălie fort)#2</p>',
        fboff: '<p class="popup_fb">+ #1 <b>Attack</b> (Fort battle bonus)#2</p>',
                fboff: '<p class="popup_fb">+ #1 <b>Atac</b> (bonus pentru bătălie fort)#2</p>',
        fbres: '<p class="popup_fb">+ #1 <b>Resistance</b> (Fort battle bonus)#2</p>',
                fbres: '<p class="popup_fb">+ #1 <b>Rezistență</b> (bonus pentru bătălie fort)#2</p>',
        fbdefs: '<p class="popup_fb">+ #1 <b>Defense</b> (Fort battle sector bonus)#2</p>',
                fbdefs: '<p class="popup_fb">+ #1 <b>Apărare</b> (bonus pentru sectorul bătăliei de fort)#2</p>',
        fboffs: '<p class="popup_fb">+ #1 <b>Attack</b> (Fort battle sector bonus)#2</p>',
                fboffs: '<p class="popup_fb">+ #1 <b>Atac</b> (bonus pentru sectorul bătăliei de fort)#2</p>',
        fbdmgs: '<p class="popup_fb">+ #1 <b>Damages</b> (Fort battle sector bonus)#2</p>'
                fbdmgs: '<p class="popup_fb">+ #1 <b>Daune</b> (bonus pentru sectorul bătăliei de fort)#2</p>'
      },
            },
      special: {
            special: {
        xp: '<p class="popup_txtgreen">+ #1% Experience from jobs, duels and fort battles#2</p>',
                xp: '<p class="popup_txtgreen">+ #1% Experiență din munci, dueluri și bătălii pentru fort#2</p>',
        money: '<p class="popup_txtgreen">+ #1% Money from jobs and duels#2</p>',
                money: '<p class="popup_txtgreen">+ #1% Bani din munci și dueluri#2</p>',
        luck: '<p class="popup_txtgreen">+ #1% Improved Luck#2</p>',
                luck: '<p class="popup_txtgreen">+ #1% Bonus de noroc#2</p>',
        regen: '<p class="popup_txtgreen">+ #1% Regeneration#2</p>',
                regen: '<p class="popup_txtgreen">+ #1% Regenerare#2</p>',
        drop: '<p class="popup_txtgreen">+ #1% Improved drop chance#2</p>',
                drop: '<p class="popup_txtgreen">+ #1% Șanse#2</p>',
        labor_pts: '<p class="popup_txtgreen">+ #1 labor point#2</p>',
                labor_pts: '<p class="popup_txtgreen">+ #1 puncte de muncă#2</p>',
        spd: '<p class="popup_txtgreen">+ #1% Speed#2</p>'
                spd: '<p class="popup_txtgreen">+ #1% Viteză#2</p>',
      }
                pray: '<p class="popup_txtgreen">+ #1% Rugăciune#2</p>'
    }
             }
  },
  config: {
    enable_set_calc: true,
    plain_popup: true,
    redirect_on_dblclick: false,
    link_on_dblclick: true,
    enable_sorting: true,
    cdn: "https://westzz.innogamescdn.com",
    img_buyprice: "/images/5/57/Buy_price.png",
    img_sellprice: "/images/f/fc/Sell_price.png",
    img_male: "/images/c/c5/Gender_m.png",
    img_female: "/images/4/41/Gender_f.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"
      },
      spd: {
        name: "Speed",
        img: "/images/thumb/1/1a/QuarterHorse.png/40px-QuarterHorse.png"
      }
    },
    sorting: {
      'Strength': '{"str":1}',
      'Mobility': '{"mob":1}',
      'Dexterity': '{"dex":1}',
      'Charisma': '{"cha":1}',
      'Construction': '{"str":1,"con":1}',
      'Vigor': '{"str":1,"vig":1}',
      'Toughness': '{"str":1,"tou":1}',
      'Stamina': '{"str":1,"sta":1}',
      'Health Points': '{"str":1,"hea":1}',
      'Horseback Riding': '{"mob":1,"rid":1}',
      'Reflex': '{"mob":1,"ref":1}',
      'Dodging': '{"mob":1,"dod":1}',
      'Hiding': '{"mob":1,"hid":1}',
      'Swimming': '{"mob":1,"swi":1}',
      'Aiming': '{"dex":1,"aim":1}',
      'Shooting': '{"dex":1,"sho":1}',
      'Setting traps': '{"dex":1,"pit":1}',
      'Fine Motor Skills': '{"dex":1,"fin":1}',
      'Repairing': '{"dex":1,"rep":1}',
      'Leadership': '{"cha":1,"lea":1}',
      'Tactics': '{"cha":1,"tac":1}',
      'Trading': '{"cha":1,"tra":1}',
      'Animal Instinct': '{"cha":1,"ani":1}',
      'Appearance': '{"cha":1,"app":1}',
      'Labor points towards building': '{"str":3,"con":3,"dex":1,"rep":1,"cha":1,"lea":1}',
      'Experience from jobs, duels, and fort battles (%)': '{"xp":1}',
      'Money from jobs and duels (%)': '{"money":1}',
      'Increased Luck (%)': '{"luck":1}',
      'Regeneration (%)': '{"regen":1}',
      'Improved drop chance (%)': '{"drop":1}',
      'Speed (%)': '{"spd":1,"hspd":1,"mob":1,"rid":1}',
      'Average damage': '{"dmg_min":0.5,"dmg_max":0.5,"dmglvl":1}',
      'Maximum damage': '{"dmg_max":1,"dmglvl":1}',
      'Upgradeable items': '{"bool":true,"upg":1}',
      'Not upgradeable items': '{"bool":true,"upg":0}',
      'Auctionable items': '{"bool":true,"auc":1}',
      'Not auctionable items': '{"bool":true,"auc":0}'
    }
  },
  initPage: function() {
    //Append input level
    if ($("#input_level").length === 1) {
      var input_level = $('<input type="number" style="width:80px;" class="west" placeholder="' + westui.lang.input_level + '" 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" class="west" placeholder="' + westui.lang.input_search + '">').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();
      });
    }
    //Show a "plain text" popup in the template
    if (westui.config.plain_popup && (new RegExp(mw.config.get('wgFormattedNamespaces')[10] + '\:Item\_*').test(mw.config.get('wgPageName'))) && ($('.item_container').length === 1)) {
      $('#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();
    }
    //On dbl click on item, redirect the user to the template
    if (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 / 1000;
      });
    }
    if (westui.config.link_on_dblclick) {
      $('.item_container img').on('dblclick', function() {
        window.location = '/wiki/' + $(this).parent().attr('data-link');
      });
    }
  },
  popup: {
    content: "",
    delay: 200,
    active: false,
    show: function(obj) {
      westui.popup.content = westui.popup.createPopup($(obj).attr('data-popup'), $(obj).attr('data-cdn-cat'), $(obj).attr('data-cdn-img'), parseInt($(obj).attr('data-lvl')));
      westui.popup.active = true;
      westui.popup.setTimeout();
      westui.popup.getContainer().html(westui.popup.content);
     },
     },
     hide: function() {
     config: {
      westui.popup.getEl().css({
        enable_set_calc: !0,
         display: 'none',
        plain_popup: !0,
         top: 0,
         redirect_on_dblclick: !1,
         left: 0
         link_on_dblclick: !0,
      });
         enable_sorting: !0,
      westui.popup.active = false;
        cdn: "https://westzz.innogamescdn.com",
      westui.popup.clearTimeout();
        img_buyprice: "/images/5/57/Buy_price.png",
    },
        img_sellprice: "/images/f/fc/Sell_price.png",
    setTimeout: function() {
        img_male: "https://wiki.the-west.net/images/c/c5/Gender_m.png",
      westui.popup.clearTimeout();
        img_female: "https://wiki.the-west.net/images/4/41/Gender_f.png",
      westui.popup.timer = window.setTimeout(function() {
        set_bonus: {
        westui.popup.getEl().css('display', 'block');
            str: {
      }, westui.popup.delay);
                name: "Putere",
    },
                img: "https://wiki.the-west.net//images/thumb/8/8b/Strength.png/40px-Strength.png"
    clearTimeout: function() {
            },
      if (westui.popup.timer) window.clearTimeout(westui.popup.timer);
            mob: {
    },
                name: "Mobilitate",
    getEl: function() {
                img: "https://wiki.the-west.net//images/thumb/5/5a/Mobility.png/40px-Mobility.png"
      return $('#popup_window');
            },
    },
            dex: {
    getContainer: function() {
                name: "Dexteritate",
      return $('#popup_contents');
                img: "https://wiki.the-west.net//images/thumb/0/0d/Dexterity.png/40px-Dexterity.png"
    },
            },
    createPopup: function(data, cdn_cat, cdn_name, lvl) {
            cha: {
      data = JSON.parse(data);
                name: "Carismă",
      var html = '<div class="popup_image"><img src="' + westui.config.cdn + '/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/>';
                img: "https://wiki.the-west.net//images/thumb/c/c9/Charisma.png/40px-Charisma.png"
      var upgraded = false;
            },
      if ((lvl >= 1) && (lvl <= 5)) {
            con: {
        upgraded = true;
                name: "Construcție",
        data.auc = false;
                img: "https://wiki.the-west.net//images/thumb/3/37/Construction.png/40px-Construction.png"
      }
            },
      if (data.dmg_min && data.dmg_max) {
            vig: {
        if (upgraded) {
                name: "Vigoare",
          data.dmg_min += Math.round(Math.max(1, data.dmg_min * 0.1 * lvl));
                img: "https://wiki.the-west.net//images/thumb/9/90/Skill_Punch.png/40px-Skill_Punch.png"
          data.dmg_max += Math.round(Math.max(1, data.dmg_max * 0.1 * lvl));
            },
        }
            tou: {
        html += '<p class="popup_dmg">' + data.dmg_min + '-' + data.dmg_max + ' ' + westui.lang.damages + '</p>';
                name: "Rezistență",
      }
                img: "https://wiki.the-west.net//images/thumb/f/f8/Skill_Tough.png/40px-Skill_Tough.png"
      if (data.text) {
            },
        for (var i = 0; i < data.text.length; i++) {
            sta: {
          html += '<p class="popup_text">' + data.text[i] + '</p>';
                name: "Perseverență",
        }
                img: "https://wiki.the-west.net//images/thumb/8/8d/Stamina.png/40px-Stamina.png"
        html += '<br/>';
            },
      }
            hea: {
      for (var cat in westui.lang.popup) {
                name: "Puncte de viață",
        var cnt = 0;
                img: "https://wiki.the-west.net//images/thumb/9/94/Health.png/40px-Health.png"
        for (var key in westui.lang.popup[cat]) {
            },
          if (data.hasOwnProperty(key)) {
            rid: {
            cnt++;
                name: "Călărie",
             var per_level = "";
                img: "https://wiki.the-west.net//images/thumb/7/78/Hbr.png/40px-Hbr.png"
             if (data[key] < 0) {
            },
              if ($('#input_level input').val() > 0) {
            ref: {
                 data[key] = Math.ceil($('#input_level input').val() * -data[key]);
                name: "Reflex",
                 if (upgraded) {
                img: "https://wiki.the-west.net//images/thumb/e/e9/Skill_Reflex.png/40px-Skill_Reflex.png"
                  data[key] += Math.round(Math.max(1, data[key] * 0.1 * lvl));
            },
                }
            dod: {
              } else {
                name: "Ferire",
                 data[key] = -data[key];
                img: "https://wiki.the-west.net//images/thumb/0/07/Skill_Dodge.png/40px-Skill_Dodge.png"
                 per_level = " (" + westui.lang.per_level + ")";
            },
                 if (upgraded) {
            hid: {
                  data[key] = Math.round(1e6 * (data[key] * 1 + Math.round(Math.max(1, data[key] * 1000 * lvl)) / 10000)) / 1e6;
                name: "Ascundere",
                 }
                img: "https://wiki.the-west.net//images/thumb/9/97/Hiding.png/40px-Hiding.png"
              }
            },
             } else if (upgraded) {
            swi: {
              if (data[key] < 1) {
                name: "Înot",
                 data[key] = Math.round(1e6 * (data[key] * 1 + Math.round(Math.max(1, data[key] * 1000 * lvl)) / 10000)) / 1e6;
                img: "https://wiki.the-west.net//images/thumb/f/f4/Swimming.png/40px-Swimming.png"
              } else {
            },
                 data[key] += Math.round(Math.max(1, data[key] * 0.1 * lvl));
            aim: {
              }
                name: "Țintire",
                img: "https://wiki.the-west.net//images/thumb/5/53/Skill_Aim.png/40px-Skill_Aim.png"
            },
            sho: {
                name: "Împușcare",
                img: "https://wiki.the-west.net//images/thumb/7/73/Skill_Shot.png/40px-Skill_Shot.png"
            },
            pit: {
                name: "Pune capcane",
                img: "https://wiki.the-west.net//images/thumb/e/e1/Trapping.png/40px-Trapping.png"
            },
            fin: {
                name: "Îndemânare motrică",
                img: "https://wiki.the-west.net//images/thumb/1/18/Fms.png/40px-Fms.png"
            },
            rep: {
                name: "Reparare",
                img: "https://wiki.the-west.net//images/thumb/d/d5/Repairing.png/40px-Repairing.png"
            },
            lea: {
                name: "Conducere",
                img: "https://wiki.the-west.net//images/thumb/4/44/Leadership.png/40px-Leadership.png"
            },
            tac: {
                name: "Tactică",
                img: "https://wiki.the-west.net//images/thumb/9/91/Skill_Tactic.png/40px-Skill_Tactic.png"
            },
            tra: {
                name: "Comerț",
                img: "https://wiki.the-west.net//images/thumb/f/f3/Skill_Trading.png/40px-Skill_Trading.png"
            },
            ani: {
                name: "Instinct pentru animale",
                img: "https://wiki.the-west.net//images/thumb/9/9d/AnimalInstinct.png/40px-AnimalInstinct.png"
            },
            app: {
                name: "Aspect",
                img: "https://wiki.the-west.net//images/thumb/4/4c/Skill_Appearance.png/40px-Skill_Appearance.png"
            },
            fbdef: {
                name: "<b>Apărare</b> (bonus pentru bătălie fort)",
                img: "https://wiki.the-west.net//images/8/82/Set_Fb_defense.png"
             },
             fboff: {
                name: "<b>Atac</b> (bonus pentru bătălie fort)",
                img: "https://wiki.the-west.net//images/3/30/Set_Fb_offense.png"
            },
            fbres: {
                 name: "<b>Rezistență</b> (bonus pentru bătălie fort)",
                img: "https://wiki.the-west.net//images/4/4b/Resistance.png"
            },
            fbdefs: {
                 name: "<b>Apărare</b> (bonus pentru sectorul bătăliei de fort)",
                img: "https://wiki.the-west.net//images/1/1a/Set_Fb_defense_sec.png"
            },
            fboffs: {
                 name: "<b>Atac</b> (bonus pentru sectorul bătăliei de fort)",
                img: "https://wiki.the-west.net//images/f/fe/Set_Fb_offense_sec.png"
            },
            fbdmgs: {
                 name: "<b>Daune</b> (bonus pentru sectorul bătăliei de fort)",
                img: "https://wiki.the-west.net//images/b/b3/Damages_sector.png"
            },
            xp: {
                 name: "Experiență din munci, dueluri și bătălii pentru fort (%)",
                img: "https://wiki.the-west.net//images/7/71/Set_xp.png"
            },
            money: {
                name: "Bani din munci și dueluri (%)",
                img: "https://wiki.the-west.net//images/d/df/Set_money.png"
            },
            luck: {
                name: "Bonus de noroc",
                 img: "https://wiki.the-west.net//images/c/c1/Set_luck.png"
            },
             regen: {
                name: "Regenerare",
                 img: "https://wiki.the-west.net//images/5/53/Regeneration.png"
            },
            drop: {
                name: "Șanse",
                img: "https://wiki.the-west.net//images/thumb/b/b8/Drop.png/40px-Drop.png"
            },
            spd: {
                 name: "Viteză",
                img: "https://wiki.the-west.net//images/thumb/1/1a/QuarterHorse.png/40px-QuarterHorse.png"
            },
            labor_pts: {
                name: "Puncte de muncă (toate muncile)",
                img: "https://wiki.the-west.net//images/5/5e/Labor_pts.png"
             }
             }
             html += westui.lang.popup[cat][key].replace('#1', data[key]).replace('#2', per_level);
        },
          }
        img_job: {
         }
            trader: ['d/dc', 'Fahrender Händler'],
        if (cnt > 0) {
            tailor: ['d/de', 'Schneider'],
          html += '<br/>';
            gunsmith: ['2/21', 'Büchsenmacher'],
        }
            general: ['e/ef', 'Gemischwaren'],
      }
             all: ['d/d1', 'Alle Arbeiten'],
      if (data.textjob) {
        },
        for (var i = 0; i < data.textjob.length; i++) {
        jobIcon: function(p, q) {
          html += '<p class="popup_txtgreen">' + data.textjob[i] + '</p>';
            var wip = this.img_job[p],
                ji = wip ? ['/images/' + wip[0] + '/Job_', wip[1] + (q || '')] : [this.cdn + '/images/jobs/', q];
            ji[0] += p + '.png';
            return ji;
        },
         sorting: {
            Strength: '{"str":1}',
            Mobility: '{"mob":1}',
            Dexterity: '{"dex":1}',
            Charisma: '{"cha":1}',
            Construction: '{"str":1,"con":1}',
            Vigoare: '{"str":1,"vig":1}',
            Toughness: '{"str":1,"tou":1}',
            Stamina: '{"str":1,"sta":1}',
            "Health Points": '{"str":1,"hea":1}',
            "Horseback Riding": '{"mob":1,"rid":1}',
            Reflex: '{"mob":1,"ref":1}',
            Dodging: '{"mob":1,"dod":1}',
            Hiding: '{"mob":1,"hid":1}',
            Swimming: '{"mob":1,"swi":1}',
            Aiming: '{"dex":1,"aim":1}',
            Shooting: '{"dex":1,"sho":1}',
            "Setting traps": '{"dex":1,"pit":1}',
            "Fine Motor Skills": '{"dex":1,"fin":1}',
            Repairing: '{"dex":1,"rep":1}',
            Leadership: '{"cha":1,"lea":1}',
            Tactics: '{"cha":1,"tac":1}',
            Trading: '{"cha":1,"tra":1}',
            "Animal Instinct": '{"cha":1,"ani":1}',
            Appearance: '{"cha":1,"app":1}',
            "Labor points towards building": '{"str":3,"con":3,"dex":1,"rep":1,"cha":1,"lea":1}',
            "Experience from jobs, duels, and fort battles (%)": '{"xp":1}',
            "Money from jobs and duels (%)": '{"money":1}',
            "Increased Luck (%)": '{"luck":1}',
            "Regeneration (%)": '{"regen":1}',
            "Improved drop chance (%)": '{"drop":1}',
            "Speed (%)": '{"spd":1,"hspd":1,"mob":1,"rid":1}',
            "Average damage": '{"dmg_min":0.5,"dmg_max":0.5,"dmglvl":1}',
            "Maximum damage": '{"dmg_max":1,"dmglvl":1}',
            "Upgradeable items": '{"bool":true,"upg":1}',
            "Not upgradeable items": '{"bool":true,"upg":0}',
            "Auctionable items": '{"bool":true,"auc":1}',
            "Not auctionable items": '{"bool":true,"auc":0}'
         }
         }
        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="' + westui.config.cdn + '/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="' + westui.config.cdn + '/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="' + westui.config.cdn + '/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.hspd) {
        if (upgraded) {
          data.hspd += Math.round(Math.max(1, data.hspd * 0.1 * lvl));
        }
        html += '<p class="popup_speed">' + westui.lang.speed + ': +' + data.hspd + '%</p><br/>';
      }
      if (data.set) html += '<p><a class="popup_set" href="/wiki/' + data.set + '">' + data.set + '</a></p><br/>';
      if (data.sp) {
        html += '<img src="' + westui.config.img_buyprice + '"/>' + data.bp + '&nbsp;&nbsp;&nbsp;&nbsp;<img src="' + westui.config.img_sellprice + '"/>&nbsp;' + data.sp + '<br/><br/>';
      } else {
        html += '<i>' + westui.lang.unsalable + '</i><br/><br/>';
      }
      if (data.lvl) html += westui.lang.level + ' <b>' + data.lvl + '</b><br/>';
      if (data.sex) {
        if (data.sex == 0) {
          html += '<img src="' + westui.config.img_male + '"/>&nbsp;&nbsp;&nbsp;';
        } else {
          html += '<img src="' + westui.config.img_female + '"/>&nbsp;&nbsp;&nbsp;';
        }
      }
      if (data.auc == 1) {
        html += '<span class="popup_txtgreen">' + westui.lang.auction + '</span><br/>';
      } else {
        html += '<span class="popup_txtred">' + westui.lang.not_auction + '</span><br/>';
      }
      if (data.upg == 0) {
        html += '<span class="popup_txtred">' + westui.lang.not_upgrade + '</span><br/>';
      } else {
        html += '<span class="popup_txtgreen">' + westui.lang.upgrade + '</span><br/>';
      }
      html += '<br/><p class="popup_id">[item=<b>' + data.id + '</b>]</p></div>';
      return html;
     },
     },
     setPosition: function(e) {
     initPage: function() {
      var window_width = $(window).width();
        if (1 === $("#input_level").length) var t = $('<input type="number" style="width:80px;" class="west" placeholder="' + westui.lang.input_level + '" min="0" max="250">').bind("propertychange keyup input paste", function() {
      var window_height = $(window).height();
            this.value > 250 ? this.value = 250 : this.value < 0 && (this.value = 0), $(".calc").each(function() {
      var popup_width = westui.popup.getEl().outerWidth();
                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"))
      var popup_height = westui.popup.getEl().outerHeight();
            })
      var pos_x = e.clientX;
        }).appendTo($("#input_level"));
      var pos_y = e.clientY;
        if (1 === $("#input_search").length) $('<input type="search" class="west" placeholder="' + westui.lang.input_search + '">').bind("propertychange keyup input paste", function() {
      var top;
            var t = this.value.toLowerCase();
      var left;
            "" === t ? $(".item_container").show() : ($(".item_container").hide(), $(".item_container").filter(function() {
      var margin_top = 20;
                return $(this).attr("data-popup").toLowerCase().indexOf(t) > -1
      var margin_left = 20;
            }).show())
      if (pos_x + popup_width + margin_left > window_width) {
        }).appendTo($("#input_search"));
        left = pos_x - popup_width - margin_left + (e.pageX - e.clientX);
         1 === $("#switch").length && ($("#fire").hide(), $("#switch").on("click", function() {
      } else {
            $("#melee, #fire").toggle()
         left = pos_x + margin_left + (e.pageX - e.clientX);
        })), 1 === $("#switch_prod").length && ($("#prod2").hide(), $("#switch_prod").on("click", function() {
      }
            $("#prod, #prod2").toggle()
      if (pos_y + popup_height + margin_top > window_height) {
         })), 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() {
         top = window_height - popup_height + (e.pageY - e.clientY);
            window.location = "/wiki/" + mw.config.get("wgFormattedNamespaces")[10] + ":Item_" + JSON.parse($(this).parent().attr("data-popup")).id / 1e3
      } else {
        }), westui.config.link_on_dblclick && $(".item_container img").on("dblclick", function() {
        top = pos_y + margin_top + (e.pageY - e.clientY);
            window.location = "/wiki/" + $(this).parent().attr("data-link")
      }
         })
      westui.popup.getEl().css({
        top: top,
         left: left
      });
     },
     },
     init: function() {
     popup: {
 
        content: "",
      //Append popup container
        delay: 200,
      $('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>');
        active: !1,
 
        show: function(t) {
      //Set events
            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)
      $(document).on('mouseenter', '.item_container', function(e) {
        },
        westui.popup.show(this);
        hide: function() {
        westui.popup.setPosition(e);
            westui.popup.getEl().css({
      });
                display: "none",
      $(document).on('mouseleave', '.item_container', function() {
                top: 0,
        westui.popup.hide();
                left: 0
      });
            }), westui.popup.active = !1, westui.popup.clearTimeout()
      $(document).on('mousemove', '.item_container', function(e) {
        },
        westui.popup.setPosition(e);
        setTimeout: function() {
      });
            westui.popup.clearTimeout(), westui.popup.timer = window.setTimeout(function() {
 
                westui.popup.getEl().css("display", "block")
      $('.item_level').mousedown(function(e) {
            }, westui.popup.delay)
        e.preventDefault();
        },
      });
        clearTimeout: function() {
      $(document).on('click', '.upgrade', function() {
            westui.popup.timer && window.clearTimeout(westui.popup.timer)
        var container = $(this).closest('.item_container');
        },
        var lvl = parseInt(container.attr('data-lvl'));
        getEl: function() {
        if (lvl !== 5) {
            return $("#popup_window")
          container.attr('data-lvl', lvl + 1);
        },
          container.find('.level').html(lvl + 1);
        getContainer: function() {
        }
            return $("#popup_contents")
        westui.popup.show(container[0]);
        },
      });
        createPopup: function(t, e, i, a) {
      $(document).on('click', '.downgrade', function() {
            t = JSON.parse(t);
        var container = $(this).closest('.item_container');
            var wc = westui.config,
        var lvl = parseInt(container.attr('data-lvl'));
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/>",
        if (lvl !== 0) {
                n = !1;
          container.attr('data-lvl', lvl - 1);
            if (a >= 1 && a <= 5 && (n = !0, t.auc = !1), t.dmg_min && t.dmg_max && (n && (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) {
          container.find('.level').html(lvl - 1);
                for (var p = 0; p < t.text.length; p++) s += '<p class="popup_text">' + t.text[p] + "</p>";
        }
                s += "<br/>"
        westui.popup.show(container[0]);
            }
      });
// var MinValuePLVL = $("#input_level input").val();
    }
// var DamPerLvl = -t.dmglvl;
  },
  set_calc: {
            // if (a >= 1 && a <= 5 && (n = !0, t.auc = !1), t.dmg_min && t.dmg_max && (n && (t.dmg_min += Math.floor(Math.max(1, .1 * t.dmg_min * a)), t.dmg_max += Math.floor(Math.max(1, .1 * t.dmg_max * a))), s += '<p class="popup_dmg">' + Math.round(t.dmg_min + (MinValuePLVL * DamPerLvl)) + "-" + Math.round(t.dmg_max + (MinValuePLVL * DamPerLvl)) + " " + westui.lang.damages + "</p>"), t.text) {
    bonus: {
                // for (var p = 0; p < t.text.length; p++) s += '<p class="popup_text">' + t.text[p] + "</p>";
      //If there are any other "special" bonuses, they will be dynamically retrieved and stored there
                // s += "<br/>"
      extra_set_bonus: {}
            // }
    },
            for (var o in westui.lang.popup) {
    //Bonuses from all sets / items :
                var l = 0;
    data: {},
                for (var c in westui.lang.popup[o])
    //Status of all items (item lvl, activated or not)
                    if (t.hasOwnProperty(c)) {
    itemStatus: {},
                        l++;
    getData: function() {
                        var r = "";
      $('.set_container').each(function() {
                        t[c] < 0 ? $("#input_level input").val() > 0 ? (t[c] = Math.ceil($("#input_level input").val() * -t[c]), n && (t[c] += Math.round(Math.max(1, .1 * t[c] * a)))) : (t[c] = -t[c], r = " (" + westui.lang.per_level + ")", n && (t[c] = Math.round(1e6 * (1 * t[c] + Math.round(Math.max(1, 1e3 * t[c] * a)) / 1e4)) / 1e6)) : n && (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[o][c].replace("#1", t[c]).replace("#2", r)
        var set_id = $(this).attr('data-set-id');
                    } l > 0 && (s += "<br/>")
        westui.set_calc.itemStatus[set_id] = {};
             }
        westui.set_calc.data[set_id] = {
            if (t.textjob) {
          items: {},
                for (p = 0; p < t.textjob.length; p++) s += '<p class="popup_txtgreen">' + t.textjob[p] + "</p>";
          set: {}
                s += "<br/>"
        };
      });
      //Get bonuses from all sets
      $('.infoSet').each(function() {
        var set_id = $(this).attr('data-set-id');
        $(this).find('.infosetatt').each(function() {
          var nb = $(this).attr('data-nb');
          westui.set_calc.data[set_id].set[nb] = {};
          $(this).find('.set_bonus').each(function() {
            key = $(this).attr('data-type');
            if ($(this).find('.calc').length !== 0) {
              westui.set_calc.data[set_id].set[nb][key] = -parseFloat($(this).find('.calc').attr('id'));
             } else {
              westui.set_calc.data[set_id].set[nb][key] = parseFloat($(this).find('.val').text());
             }
             }
             if (!westui.config.set_bonus.hasOwnProperty(key)) {
             if (t.bonus) {
              westui.set_calc.bonus.extra_set_bonus[key] = {
                for (p = 0; p < t.bonus.length; p++) s += '<p class="popup_bonus">' + t.bonus[p] + "</p>";
                img: $(this).find('img').attr('src'),
                 s += "<br/>"
                 name: $(this).find('#tooltip_content').text()
              };
             }
             }
          });
        });
      });
            // if (t.jobs) {
      //Get bonuses from all item sets
                // s += '<div style="text-align:center;"><table class="popup_job">';
      $('.set_container').each(function() {
                // for (p = 0; p < t.jobs.length; p++) s += '<tr><td><img src="' + westui.config.cdn + "/images/jobs/" + t.jobs[p][1] + '.png"/></td><td><span>&nbsp;&nbsp;' + t.jobs[p][0] + "</span></td></tr>";
        var set_id = $(this).attr('data-set-id');
                // s += "</table></div>"
        $(this).find('.item_container').each(function() {
            // }
          var json = JSON.parse($(this).attr('data-popup'));
          if ($(this).is(":hidden")) {
// if (t.jobs) {
            westui.set_calc.itemStatus[set_id][json.id] = false;
// for (p in t.jobs)
          } else {
// if (p == 'req') {
            westui.set_calc.itemStatus[set_id][json.id] = 0;
// s += '<table class="popup_job">';
          }
          for (var prop in json) {
// }
            if (json.hasOwnProperty(prop) && (westui.config.set_bonus.hasOwnProperty(prop) || westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(prop))) {
// }
              if (!westui.set_calc.data[set_id].items[prop]) {
                 westui.set_calc.data[set_id].items[prop] = {};
            if (t.jobs) {
              }
                 s += '<div style="text-align:center;"><table class="popup_job">';
              westui.set_calc.data[set_id].items[prop][json.id] = json[prop];
                for (p = 0; p < t.jobs.length; p++) s += '<tr><td><img src="' + westui.config.cdn + "/images/jobs/" + t.jobs[p][1] + '.png"/></td><td><span>&nbsp;&nbsp;' + t.jobs[p][0] + "</span></td></tr>";
                s += "</table></div>"
             }
             }
          }
        });
if (t.requi) {
      });
                s += '<table class="popup_job">';
    },
                for (p in t.requi)
    calc: function() {
                    if (p == 'req') {
      //Only calc if a player level is provided
                        s += '<tr><td colspan="2">';
      if ($('#input_level').length === 0 | $('#input_level input').val() !== "") {
                        for (var q of t.requi[p]) {
        var level = parseInt($('#input_level input').val());
                            q = q.split(',');
        total = {};
                            s += '<div class="item_req"><img src="' + wc.cdn + '/images/items/' + (q[0].includes('/') ? '' : 'yield/') + q[0] + '.png"><div class="item_flag ' + q[2] + '"/>' + (q[2] == 'eqp' ? '' : '<div class="number">' + q[1] + '</div>') + '</div>';
        for (var set_id in westui.set_calc.data) {
                        }
          for (var key in westui.set_calc.data[set_id].items) {
                        s += '</td></tr>';
            for (var item_id in westui.set_calc.data[set_id].items[key]) {
              if (westui.set_calc.itemStatus[set_id][item_id] !== false) {
                lvl = westui.set_calc.itemStatus[set_id][item_id];
                if (!total[key]) {
                  total[key] = 0;
                }
                var value = westui.set_calc.data[set_id].items[key][item_id];
 
                if (westui.set_calc.data[set_id].items[key][item_id] < 0) {
                  //If bonus (per Level)
                  value = -value;
 
                  if (westui.set_calc.itemStatus[set_id][item_id] > 0) {
                    //If item upgraded
                    total[key] += Math.ceil(value * level) + Math.round(Math.max(1, Math.ceil(value * level) * 0.1 * lvl));
                  } else {
                    total[key] += Math.ceil(value * level);
                  }
                } else {
                  if (westui.set_calc.itemStatus[set_id][item_id] > 0) {
                    if (value < 1) {
                      total[key] += Math.round(1e6 * (value * 1 + Math.round(Math.max(1, value * 1000 * lvl)) / 10000)) / 1e6;
                     } else {
                     } else {
                      total[key] += value + Math.round(Math.max(1, value * 0.1 * lvl));
                        var ji = wc.jobIcon(p, t.requi[p]);
                        s += '<tr><th><img src="' + ji[0] + '"></th><td>&nbsp;' + ji[1] + '</td></tr>';
                     }
                     }
                  } else {
                 s += '</table><br>';
                    total[key] += value;
                  }
                 }
              }
            }
          }
          var item_nb = 0;
          for (var item_id in westui.set_calc.itemStatus[set_id]) {
            if (westui.set_calc.itemStatus[set_id][item_id] !== false) {
              item_nb++;
            }
          }
          for (var key in westui.set_calc.data[set_id].set[item_nb]) {
            if (!total[key]) {
              total[key] = 0;
             }
             }
             if (westui.set_calc.data[set_id].set[item_nb][key] < 0) {
              total[key] += Math.ceil(-westui.set_calc.data[set_id].set[item_nb][key] * level);
             if (t.craft) {
            } else {
                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>';
              total[key] += westui.set_calc.data[set_id].set[item_nb][key];
                for (p = 0; p < t.craft.req.length; p++) s += '<td><img style="width:36px;height:36px;" src="' + westui.config.cdn + "/images/items/yield/" + t.craft.req[p][0] + '.png"/></td>';
                s += "</tr><tr>";
                for (p = 0; p < t.craft.req.length; p++) s += "<td><span>x" + t.craft.req[p][1] + "</span></td>";
                s += "</tr></table></td></tr></table></div>"
             }
             }
          }
            return s += '<div class="popup_infos">', t.hspd && (n && (t.hspd += Math.round(Math.max(1, .1 * t.hspd * a))), s += '<p class="popup_speed">' + westui.lang.speed + ": +" + t.hspd + "%</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>", s
        }
         },
        //Create the html table
         setPosition: function(t) {
        var html = '<center><table class="infoSet"><caption><br><big><b>' + westui.lang.total + '</b></big></caption><tbody><tr><td></center>';
            var e, i, a = $(window).width(),
        for (var key in westui.config.set_bonus) {
                s = $(window).height(),
          if (total.hasOwnProperty(key)) {
                n = westui.popup.getEl().outerWidth(),
            html += '<div class="set_bonus tooltip_container"><img src="' + westui.config.set_bonus[key].img + '"><b>+' + total[key] + (['xp', 'money', 'luck', 'spd', 'regen', 'drop'].indexOf(key) !== -1 ? "%" : "") + '</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[key].name + '</div></div></div></div>';
                p = westui.popup.getEl().outerHeight(),
          }
                o = t.clientX,
         }
                l = t.clientY,
         for (var key in westui.set_calc.bonus.extra_set_bonus) {
                c = 20,
          if (total.hasOwnProperty(key)) {
                r = 20;
             html += '<div class="set_bonus tooltip_container"><img src="' + westui.set_calc.bonus.extra_set_bonus[key].img + '"><b>+' + total[key] + (['xp', 'money', 'luck', 'spd', 'regen', 'drop'].indexOf(key) !== -1 ? "%" : "") + '</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[key].name + '</div></div></div></div>';
             i = o + n + r > a ? o - n - r + (t.pageX - t.clientX) : o + r + (t.pageX - t.clientX), e = l + p + c > s ? s - p + (t.pageY - t.clientY) : l + c + (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])
            })
         }
         }
        //Display the result at the bottom of the page
        $('#set_calc').html(html);
      } else {
        $('#set_calc').html("");
      }
     },
     },
     initEvents: function() {
     set_calc: {
      //Deactivate / activate item on click
        bonus: {
      $('.item_container > img').on('click', function() {
            extra_set_bonus: {}
        var item_container = $(this).closest('.item_container');
        },
        item_container.toggleClass('item_off');
        data: {},
        var set_id = item_container.closest('.set_container').attr('data-set-id');
        itemStatus: {},
        var item_id = JSON.parse(item_container.attr('data-popup')).id;
        getData: function() {
        if (item_container.hasClass('item_off') || item_container.is(":hidden")) {
            $(".set_container").each(function() {
          westui.set_calc.itemStatus[set_id][item_id] = false;
                var t = $(this).attr("data-set-id");
        } else {
                westui.set_calc.itemStatus[t] = {}, westui.set_calc.data[t] = {
          westui.set_calc.itemStatus[set_id][item_id] = parseInt(item_container.attr('data-lvl'));
                    items: {},
                    set: {}
                }
            }), $(".infoSet").each(function() {
                var t = $(this).attr("data-set-id");
                $(this).find(".infosetatt").each(function() {
                    var e = $(this).attr("data-nb");
                    westui.set_calc.data[t].set[e] = {}, $(this).find(".set_bonus").each(function() {
                        key = $(this).attr("data-type"), 0 !== $(this).find(".calc").length ? westui.set_calc.data[t].set[e][key] = -parseFloat($(this).find(".calc").attr("id")) : westui.set_calc.data[t].set[e][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 t = $(this).attr("data-set-id");
                $(this).find(".item_container").each(function() {
                    var e = JSON.parse($(this).attr("data-popup"));
                    for (var i in $(this).is(":hidden") ? westui.set_calc.itemStatus[t][e.id] = !1 : westui.set_calc.itemStatus[t][e.id] = 0, e) e.hasOwnProperty(i) && (westui.config.set_bonus.hasOwnProperty(i) || westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(i)) && (westui.set_calc.data[t].items[i] || (westui.set_calc.data[t].items[i] = {}), westui.set_calc.data[t].items[i][e.id] = e[i])
                })
            })
        },
        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, westui.set_calc.itemStatus[e][a] > 0 ? total[i] += Math.ceil(s * t) + Math.round(Math.max(1, .1 * Math.ceil(s * t) * lvl)) : total[i] += Math.ceil(s * t)) : westui.set_calc.itemStatus[e][a] > 0 ? total[i] += 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[i] += s
                            } var n = 0;
                    for (var a in westui.set_calc.itemStatus[e]) !1 !== westui.set_calc.itemStatus[e][a] && n++;
                    for (var i in westui.set_calc.data[e].set[n]) total[i] || (total[i] = 0), westui.set_calc.data[e].set[n][i] < 0 ? total[i] += Math.ceil(-westui.set_calc.data[e].set[n][i] * t) : total[i] += westui.set_calc.data[e].set[n][i]
                }
                var p = '<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) && (p += '<div class="set_bonus tooltip_container"><img src="' + westui.config.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.config.set_bonus[i].name + "</div></div></div></div>");
                for (var i in westui.set_calc.bonus.extra_set_bonus) total.hasOwnProperty(i) && (p += '<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(p)
            } 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()
         }
         }
        westui.set_calc.calc();
      });
      //Update item level on upgrade / downgrade
      $(document).on('click', '.upgrade, .downgrade', function() {
        var item = $(this).closest('.item_container');
        var set_id = item.closest('.set_container').attr('data-set-id');
        if (!item.hasClass('item_off') && !item.is(":hidden")) {
          westui.set_calc.itemStatus[set_id][JSON.parse(item.attr('data-popup')).id] = parseInt(item.attr('data-lvl'));
          westui.set_calc.calc();
        }
      });
      //Calc again when player level changes
      $("#input_level").bind("propertychange keyup input paste", function() {
        westui.set_calc.calc();
      });
      //Activate/deactivate melee/fire weapon when the switch btn is clicked
      $("#switch").on('click', function() {
        $('#melee, #fire').each(function() {
          var item = $(this).find('.item_container');
          var set_id = $(this).closest('.set_container').attr('data-set-id');
          if ($(this).is(":hidden")) {
            westui.set_calc.itemStatus[set_id][JSON.parse(item.attr('data-popup')).id] = false;
          } else {
            westui.set_calc.itemStatus[set_id][JSON.parse(item.attr('data-popup')).id] = parseInt(item.attr('data-lvl'));
          }
        });
        westui.set_calc.calc();
      });
     },
     },
     init: function() {
     sorting: {
      westui.set_calc.initEvents();
         sortItems: function(t) {
      westui.set_calc.getData();
            function e(e) {
      $('#mw-content-text').append('<div id="set_calc"></div>');
                var i = JSON.parse($(e).attr("data-popup")),
      if ($('#input_level').length === 0)
                    a = $("#input_level input").val();
         westui.set_calc.calc();
                a = a || 250;
    }
                var s = -1 !== Object.keys(t).indexOf("id") || t.bool && !0 === t.bool,
  },
                    n = 0;
  sorting: {
                if (t.bool && !0 === t.bool)
    sortItems: function(param) {
                    for (var p in n = 1, t) "bool" !== p && i[p] !== t[p] && (n = 0);
      $('.item_container').removeAttr('data-sort').show();
                else
 
                    for (var p in t) "id" === p ? n -= i[p] : (!i.lvl || i.lvl <= a) && i[p] && (i[p] < 0 ? n += Math.ceil(-i[p] * a) * t[p] : n += i[p] * t[p]);
      function calcSortVal(el) {
                $(e).attr("data-sort", n), 0 == n && $(e).hide(), 0 !== $(e).find(".number").length ? s ? $(e).find(".number").html("") : $(e).find(".number").html(n) : s || $(e).append('<p class="number">' + n + "</p>")
        var data = JSON.parse($(el).attr('data-popup'));
        var char_lvl = $('#input_level input').val();
        char_lvl = (char_lvl ? char_lvl : 150);
        var none = (Object.keys(param).indexOf('id') !== -1 || (param.bool && param.bool === true));
        var val = 0;
        if (param.bool && param.bool === true) {
          val = 1;
          for (var prop in param) {
            if (prop !== "bool" && data[prop] !== param[prop]) {
              val = 0;
             }
             }
          }
            $(".item_container").removeAttr("data-sort").show(), $("#mw-content-text").find(".sorting_hidden").hide(), $(".sorting_container").each(function() {
        } else {
                $(this).find(".item_container").sort(function(t, i) {
          for (var prop in param) {
                    return $(t).attr("data-sort") || e(t), $(i).attr("data-sort") || e(i), $(i).attr("data-sort") - $(t).attr("data-sort")
            if (prop === "id") {
                }).appendTo($(this))
              val -= data[prop];
            })
            } else if ((!data.lvl || data.lvl <= char_lvl)) {
        },
              if (data[prop]) {
        init: function() {
                 if (data[prop] < 0) {
            if (1 === $("div#sort_items").length) {
                  val += Math.ceil(-data[prop] * char_lvl) * param[prop];
                 var t = "<div id='input_search'><select id='sort_items' class='west'><option selected disabled>Order by :</option>";
                } else {
                for (var e in westui.config.sorting) t += "<option value='" + westui.config.sorting[e] + "'>" + e + "</option>";
                  val += data[prop] * param[prop];
                t += "</select></div>", $("div#sort_items").html(t), $("select#sort_items").on("change", function() {
                 }
                    westui.sorting.sortItems(JSON.parse($(this).find("option:selected").attr("value")))
              }
                 })
             }
             }
          }
         }
         }
        $(el).attr('data-sort', val);
        if (val == 0) {
          $(el).hide();
        }
        if ($(el).find('.number').length !== 0) {
          if (none) {
            $(el).find('.number').html('');
          } else {
            $(el).find('.number').html(val);
          }
        } else if (!none) {
          $(el).append('<p class="number">' + val + '</p>');
        }
      }
      $('#mw-content-text').find('.sorting_hidden').hide();
      $('.sorting_container').each(function() {
        $(this).find('.item_container').sort(function(a, b) {
          if (!$(a).attr('data-sort')) {
            calcSortVal(a);
          }
          if (!$(b).attr('data-sort')) {
            calcSortVal(b);
          }
          return $(b).attr('data-sort') - $(a).attr('data-sort');
        }).appendTo($(this));
      })
     },
     },
     init: function() {
     init: function() {
      if ($('div#sort_items').length === 1) {
         westui.initPage(), westui.popup.init(), westui.config.enable_sorting && westui.sorting.init(), westui.config.enable_set_calc && 0 !== $(".infoSet").length && westui.set_calc.init()
         var html = "<div id='input_search'><select id='sort_items' class='west'><option selected disabled>Order by :</option>";
        for (var prop in westui.config.sorting) {
          html += "<option value='" + westui.config.sorting[prop] + "'>" + prop + "</option>";
        }
        html += "</select></div>";
        $('div#sort_items').html(html);
        $('select#sort_items').on('change', function() {
          westui.sorting.sortItems(JSON.parse($(this).find("option:selected").attr('value')));
        });
      }
    }
  },
  init: function() {
    westui.initPage();
    westui.popup.init();
    if (westui.config.enable_sorting)
      westui.sorting.init();
    if (westui.config.enable_set_calc && $('.infoSet').length !== 0) {
      westui.set_calc.init();
     }
     }
  }
}, westui.init();
};
westui.init();

Versiunea curentă din 15 octombrie 2022 19:42

westui = {

   lang: {
       input_level: "Nivelul tău",
       input_search: "Caută",
       damages: "Daune",
       per_level: "pe nivel",
       speed: "Viteză",
       level: "Nivel",
       unsalable: "Nevandabil",
       auction: "Licitabil",
       not_auction: "Nelicitabil",
       not_upgrade: "Nu poate fi îmbunătățit",
       upgrade: "Poate fi îmbunătățit",
       total: "Total",
       popup: {
           dmg: {

dmglvl: '

'

           },
           skills: {

str: '

', mob: '

', dex: '

', cha: '

', con: '

', vig: '

', tou: '

', sta: '

', hea: '

', rid: '

', ref: '

', dod: '

', hid: '

', swi: '

', aim: '

', sho: '

', pit: '

', fin: '

', rep: '

', lea: '

', tac: '

', tra: '

', ani: '

', app: '

'

           },
           fb: {

fbdef: '

', fboff: '

', fbres: '

', fbdefs: '

', fboffs: '

', fbdmgs: '

'

           },
           special: {

xp: '

', money: '

', luck: '

', regen: '

', drop: '

', labor_pts: '

', spd: '

', pray: '

'

           }
       }
   },
   config: {
       enable_set_calc: !0,
       plain_popup: !0,
       redirect_on_dblclick: !1,
       link_on_dblclick: !0,
       enable_sorting: !0,
       cdn: "https://westzz.innogamescdn.com",
       img_buyprice: "/images/5/57/Buy_price.png",
       img_sellprice: "/images/f/fc/Sell_price.png",
       img_male: "https://wiki.the-west.net/images/c/c5/Gender_m.png",
       img_female: "https://wiki.the-west.net/images/4/41/Gender_f.png",
       set_bonus: {
           str: {
               name: "Putere",
               img: "https://wiki.the-west.net//images/thumb/8/8b/Strength.png/40px-Strength.png"
           },
           mob: {
               name: "Mobilitate",
               img: "https://wiki.the-west.net//images/thumb/5/5a/Mobility.png/40px-Mobility.png"
           },
           dex: {
               name: "Dexteritate",
               img: "https://wiki.the-west.net//images/thumb/0/0d/Dexterity.png/40px-Dexterity.png"
           },
           cha: {
               name: "Carismă",
               img: "https://wiki.the-west.net//images/thumb/c/c9/Charisma.png/40px-Charisma.png"
           },
           con: {
               name: "Construcție",
               img: "https://wiki.the-west.net//images/thumb/3/37/Construction.png/40px-Construction.png"
           },
           vig: {
               name: "Vigoare",
               img: "https://wiki.the-west.net//images/thumb/9/90/Skill_Punch.png/40px-Skill_Punch.png"
           },
           tou: {
               name: "Rezistență",
               img: "https://wiki.the-west.net//images/thumb/f/f8/Skill_Tough.png/40px-Skill_Tough.png"
           },
           sta: {
               name: "Perseverență",
               img: "https://wiki.the-west.net//images/thumb/8/8d/Stamina.png/40px-Stamina.png"
           },
           hea: {
               name: "Puncte de viață",
               img: "https://wiki.the-west.net//images/thumb/9/94/Health.png/40px-Health.png"
           },
           rid: {
               name: "Călărie",
               img: "https://wiki.the-west.net//images/thumb/7/78/Hbr.png/40px-Hbr.png"
           },
           ref: {
               name: "Reflex",
               img: "https://wiki.the-west.net//images/thumb/e/e9/Skill_Reflex.png/40px-Skill_Reflex.png"
           },
           dod: {
               name: "Ferire",
               img: "https://wiki.the-west.net//images/thumb/0/07/Skill_Dodge.png/40px-Skill_Dodge.png"
           },
           hid: {
               name: "Ascundere",
               img: "https://wiki.the-west.net//images/thumb/9/97/Hiding.png/40px-Hiding.png"
           },
           swi: {
               name: "Înot",
               img: "https://wiki.the-west.net//images/thumb/f/f4/Swimming.png/40px-Swimming.png"
           },
           aim: {
               name: "Țintire",
               img: "https://wiki.the-west.net//images/thumb/5/53/Skill_Aim.png/40px-Skill_Aim.png"
           },
           sho: {
               name: "Împușcare",
               img: "https://wiki.the-west.net//images/thumb/7/73/Skill_Shot.png/40px-Skill_Shot.png"
           },
           pit: {
               name: "Pune capcane",
               img: "https://wiki.the-west.net//images/thumb/e/e1/Trapping.png/40px-Trapping.png"
           },
           fin: {
               name: "Îndemânare motrică",
               img: "https://wiki.the-west.net//images/thumb/1/18/Fms.png/40px-Fms.png"
           },
           rep: {
               name: "Reparare",
               img: "https://wiki.the-west.net//images/thumb/d/d5/Repairing.png/40px-Repairing.png"
           },
           lea: {
               name: "Conducere",
               img: "https://wiki.the-west.net//images/thumb/4/44/Leadership.png/40px-Leadership.png"
           },
           tac: {
               name: "Tactică",
               img: "https://wiki.the-west.net//images/thumb/9/91/Skill_Tactic.png/40px-Skill_Tactic.png"
           },
           tra: {
               name: "Comerț",
               img: "https://wiki.the-west.net//images/thumb/f/f3/Skill_Trading.png/40px-Skill_Trading.png"
           },
           ani: {
               name: "Instinct pentru animale",
               img: "https://wiki.the-west.net//images/thumb/9/9d/AnimalInstinct.png/40px-AnimalInstinct.png"
           },
           app: {
               name: "Aspect",
               img: "https://wiki.the-west.net//images/thumb/4/4c/Skill_Appearance.png/40px-Skill_Appearance.png"
           },
           fbdef: {
               name: "Apărare (bonus pentru bătălie fort)",
               img: "https://wiki.the-west.net//images/8/82/Set_Fb_defense.png"
           },
           fboff: {
               name: "Atac (bonus pentru bătălie fort)",
               img: "https://wiki.the-west.net//images/3/30/Set_Fb_offense.png"
           },
           fbres: {
               name: "Rezistență (bonus pentru bătălie fort)",
               img: "https://wiki.the-west.net//images/4/4b/Resistance.png"
           },
           fbdefs: {
               name: "Apărare (bonus pentru sectorul bătăliei de fort)",
               img: "https://wiki.the-west.net//images/1/1a/Set_Fb_defense_sec.png"
           },
           fboffs: {
               name: "Atac (bonus pentru sectorul bătăliei de fort)",
               img: "https://wiki.the-west.net//images/f/fe/Set_Fb_offense_sec.png"
           },
           fbdmgs: {
               name: "Daune (bonus pentru sectorul bătăliei de fort)",
               img: "https://wiki.the-west.net//images/b/b3/Damages_sector.png"
           },
           xp: {
               name: "Experiență din munci, dueluri și bătălii pentru fort (%)",
               img: "https://wiki.the-west.net//images/7/71/Set_xp.png"
           },
           money: {
               name: "Bani din munci și dueluri (%)",
               img: "https://wiki.the-west.net//images/d/df/Set_money.png"
           },
           luck: {
               name: "Bonus de noroc",
               img: "https://wiki.the-west.net//images/c/c1/Set_luck.png"
           },
           regen: {
               name: "Regenerare",
               img: "https://wiki.the-west.net//images/5/53/Regeneration.png"
           },
           drop: {
               name: "Șanse",
               img: "https://wiki.the-west.net//images/thumb/b/b8/Drop.png/40px-Drop.png"
           },
           spd: {
               name: "Viteză",
               img: "https://wiki.the-west.net//images/thumb/1/1a/QuarterHorse.png/40px-QuarterHorse.png"
           },
           labor_pts: {
               name: "Puncte de muncă (toate muncile)",
               img: "https://wiki.the-west.net//images/5/5e/Labor_pts.png"
           }
       },
       img_job: {
           trader: ['d/dc', 'Fahrender Händler'],
           tailor: ['d/de', 'Schneider'],
           gunsmith: ['2/21', 'Büchsenmacher'],
           general: ['e/ef', 'Gemischwaren'],
           all: ['d/d1', 'Alle Arbeiten'],
       },
       jobIcon: function(p, q) {
           var wip = this.img_job[p],
               ji = wip ? ['/images/' + wip[0] + '/Job_', wip[1] + (q || )] : [this.cdn + '/images/jobs/', q];
           ji[0] += p + '.png';
           return ji;
       },
       sorting: {
           Strength: '{"str":1}',
           Mobility: '{"mob":1}',
           Dexterity: '{"dex":1}',
           Charisma: '{"cha":1}',
           Construction: '{"str":1,"con":1}',
           Vigoare: '{"str":1,"vig":1}',
           Toughness: '{"str":1,"tou":1}',
           Stamina: '{"str":1,"sta":1}',
           "Health Points": '{"str":1,"hea":1}',
           "Horseback Riding": '{"mob":1,"rid":1}',
           Reflex: '{"mob":1,"ref":1}',
           Dodging: '{"mob":1,"dod":1}',
           Hiding: '{"mob":1,"hid":1}',
           Swimming: '{"mob":1,"swi":1}',
           Aiming: '{"dex":1,"aim":1}',
           Shooting: '{"dex":1,"sho":1}',
           "Setting traps": '{"dex":1,"pit":1}',
           "Fine Motor Skills": '{"dex":1,"fin":1}',
           Repairing: '{"dex":1,"rep":1}',
           Leadership: '{"cha":1,"lea":1}',
           Tactics: '{"cha":1,"tac":1}',
           Trading: '{"cha":1,"tra":1}',
           "Animal Instinct": '{"cha":1,"ani":1}',
           Appearance: '{"cha":1,"app":1}',
           "Labor points towards building": '{"str":3,"con":3,"dex":1,"rep":1,"cha":1,"lea":1}',
           "Experience from jobs, duels, and fort battles (%)": '{"xp":1}',
           "Money from jobs and duels (%)": '{"money":1}',
           "Increased Luck (%)": '{"luck":1}',
           "Regeneration (%)": '{"regen":1}',
           "Improved drop chance (%)": '{"drop":1}',
           "Speed (%)": '{"spd":1,"hspd":1,"mob":1,"rid":1}',
           "Average damage": '{"dmg_min":0.5,"dmg_max":0.5,"dmglvl":1}',
           "Maximum damage": '{"dmg_max":1,"dmglvl":1}',
           "Upgradeable items": '{"bool":true,"upg":1}',
           "Not upgradeable items": '{"bool":true,"upg":0}',
           "Auctionable items": '{"bool":true,"auc":1}',
           "Not auctionable items": '{"bool":true,"auc":0}'
       }
   },
   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="250">').bind("propertychange keyup input paste", function() {
           this.value > 250 ? this.value = 250 : 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 $(this).attr("data-popup").toLowerCase().indexOf(t) > -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").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
       }), 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(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 wc = westui.config,

s = '


",

               n = !1;

if (a >= 1 && a <= 5 && (n = !0, t.auc = !1), t.dmg_min && t.dmg_max && (n && (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 p = 0; p < t.text.length; p++) s += '

";

               s += "
" }

// var MinValuePLVL = $("#input_level input").val(); // var DamPerLvl = -t.dmglvl;

// if (a >= 1 && a <= 5 && (n = !0, t.auc = !1), t.dmg_min && t.dmg_max && (n && (t.dmg_min += Math.floor(Math.max(1, .1 * t.dmg_min * a)), t.dmg_max += Math.floor(Math.max(1, .1 * t.dmg_max * a))), s += '

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

";

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

for (p = 0; p < t.textjob.length; p++) s += '

";

               s += "
" } if (t.bonus) {

for (p = 0; p < t.bonus.length; p++) s += '

";

               s += "
" }


           // if (t.jobs) {

// s += '

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

"

           // }

// if (t.jobs) { // for (p in t.jobs) // if (p == 'req') {

// s += '

'; // } // } if (t.jobs) { s += '
'; for (p = 0; p < t.jobs.length; p++) s += '"; s += "

"

           }

if (t.requi) {

s += '

'; for (p in t.requi) if (p == 'req') { s += ''; } else { var ji = wc.jobIcon(p, t.requi[p]); s += '';
                   }
s += '


';

           }
           if (t.craft) {

s += '

"

           }

return s += '

", s

       },
       setPosition: function(t) {
           var e, i, a = $(window).width(),
               s = $(window).height(),
               n = westui.popup.getEl().outerWidth(),
               p = westui.popup.getEl().outerHeight(),
               o = t.clientX,
               l = t.clientY,
               c = 20,
               r = 20;
           i = o + n + r > a ? o - n - r + (t.pageX - t.clientX) : o + r + (t.pageX - t.clientX), e = l + p + c > s ? s - p + (t.pageY - t.clientY) : l + c + (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 t = $(this).attr("data-set-id");
               westui.set_calc.itemStatus[t] = {}, westui.set_calc.data[t] = {
                   items: {},
                   set: {}
               }
           }), $(".infoSet").each(function() {
               var t = $(this).attr("data-set-id");
               $(this).find(".infosetatt").each(function() {
                   var e = $(this).attr("data-nb");
                   westui.set_calc.data[t].set[e] = {}, $(this).find(".set_bonus").each(function() {
                       key = $(this).attr("data-type"), 0 !== $(this).find(".calc").length ? westui.set_calc.data[t].set[e][key] = -parseFloat($(this).find(".calc").attr("id")) : westui.set_calc.data[t].set[e][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 t = $(this).attr("data-set-id");
               $(this).find(".item_container").each(function() {
                   var e = JSON.parse($(this).attr("data-popup"));
                   for (var i in $(this).is(":hidden") ? westui.set_calc.itemStatus[t][e.id] = !1 : westui.set_calc.itemStatus[t][e.id] = 0, e) e.hasOwnProperty(i) && (westui.config.set_bonus.hasOwnProperty(i) || westui.set_calc.bonus.extra_set_bonus.hasOwnProperty(i)) && (westui.set_calc.data[t].items[i] || (westui.set_calc.data[t].items[i] = {}), westui.set_calc.data[t].items[i][e.id] = e[i])
               })
           })
       },
       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, westui.set_calc.itemStatus[e][a] > 0 ? total[i] += Math.ceil(s * t) + Math.round(Math.max(1, .1 * Math.ceil(s * t) * lvl)) : total[i] += Math.ceil(s * t)) : westui.set_calc.itemStatus[e][a] > 0 ? total[i] += 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[i] += s
                           } var n = 0;
                   for (var a in westui.set_calc.itemStatus[e]) !1 !== westui.set_calc.itemStatus[e][a] && n++;
                   for (var i in westui.set_calc.data[e].set[n]) total[i] || (total[i] = 0), westui.set_calc.data[e].set[n][i] < 0 ? total[i] += Math.ceil(-westui.set_calc.data[e].set[n][i] * t) : total[i] += westui.set_calc.data[e].set[n][i]
               }

var p = '

<tbody>

' + westui.lang.total + "
"; for (var i in westui.config.set_bonus) total.hasOwnProperty(i) && (p += '
<img src="' + westui.config.set_bonus[i].img + '">+' + total[i] + (-1 !== ["xp", "money", "luck", "spd", "regen", "drop"].indexOf(i) ? "%" : "") + '
' + westui.config.set_bonus[i].name + "
"); for (var i in westui.set_calc.bonus.extra_set_bonus) total.hasOwnProperty(i) && (p += '
<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(p)
           } 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()
       }
   },
   sorting: {
       sortItems: function(t) {
           function e(e) {
               var i = JSON.parse($(e).attr("data-popup")),
                   a = $("#input_level input").val();
               a = a || 250;
               var s = -1 !== Object.keys(t).indexOf("id") || t.bool && !0 === t.bool,
                   n = 0;
               if (t.bool && !0 === t.bool)
                   for (var p in n = 1, t) "bool" !== p && i[p] !== t[p] && (n = 0);
               else
                   for (var p in t) "id" === p ? n -= i[p] : (!i.lvl || i.lvl <= a) && i[p] && (i[p] < 0 ? n += Math.ceil(-i[p] * a) * t[p] : n += i[p] * t[p]);
$(e).attr("data-sort", n), 0 == n && $(e).hide(), 0 !== $(e).find(".number").length ? s ? $(e).find(".number").html("") : $(e).find(".number").html(n) : s || $(e).append('

' + n + "

")
           }
           $(".item_container").removeAttr("data-sort").show(), $("#mw-content-text").find(".sorting_hidden").hide(), $(".sorting_container").each(function() {
               $(this).find(".item_container").sort(function(t, i) {
                   return $(t).attr("data-sort") || e(t), $(i).attr("data-sort") || e(i), $(i).attr("data-sort") - $(t).attr("data-sort")
               }).appendTo($(this))
           })
       },
       init: function() {
           if (1 === $("div#sort_items").length) {
var t = "", $("div#sort_items").html(t), $("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();