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
Linia 1: Linia 1:
westui = {
westui = {
     lang: {
     lang: {
         input_level: "Your level",
         input_level: "Stufe",
         input_search: "Search",
         input_search: "Suche",
         damages: "Damages",
         damages: "Schaden",
         per_level: "per Level",
         per_level: "pro Stufe",
         speed: "Speed",
         speed: "Geschwindigkeit",
         level: "Level",
         level: "Stufe",
         unsalable: "Unsalable",
         sellable: "Verkaufbar",
         auction: "Auctionable",
         auctionable: "Auktionierbar",
         not_auction: "Not auctionable",
         upgradeable: "Veredelbar",
        not_upgrade: "Not upgradeable",
        upgrade: "Upgradeable",
         total: "Total",
         total: "Total",
        aps: "Arbeitspunkte auf ",
         popup: {
         popup: {
             dmg: {
             dmg: {
                 dmglvl: '<p class="popup_dmg">+ #1 Damages#2</p>'
                 dmg: ["Schaden", ''],
             },
             },
             skills: {
             attribute: {
                 str: '<p class="popup_attribute">+ #1 Strength#2</p>',
                 str: ["Stärke", "8/8b/Strength"],
                mob: '<p class="popup_attribute">+ #1 Mobility#2</p>',
                 fle: ["Beweglichkeit", "d/db/Flexibility"],
                dex: '<p class="popup_attribute">+ #1 Dexterity#2</p>',
                 dex: ["Geschicklichkeit", "0/0d/Dexterity"],
                cha: '<p class="popup_attribute">+ #1 Charisma#2</p>',
                 cha: ["Charisma", "c/c9/Charisma"],
                 con: '<p class="popup_skill">+ #1 Construction#2</p>',
                vig: '<p class="popup_skill">+ #1 Vigor#2</p>',
                tou: '<p class="popup_skill">+ #1 Toughness#2</p>',
                sta: '<p class="popup_skill">+ #1 Stamina#2</p>',
                 hea: '<p class="popup_skill">+ #1 Health Points#2</p>',
                rid: '<p class="popup_skill">+ #1 Horseback Riding#2</p>',
                ref: '<p class="popup_skill">+ #1 Reflex#2</p>',
                dod: '<p class="popup_skill">+ #1 Dodging#2</p>',
                 hid: '<p class="popup_skill">+ #1 Hiding#2</p>',
                swi: '<p class="popup_skill">+ #1 Swimming#2</p>',
                aim: '<p class="popup_skill">+ #1 Aiming#2</p>',
                sho: '<p class="popup_skill">+ #1 Shooting#2</p>',
                pit: '<p class="popup_skill">+ #1 Setting traps#2</p>',
                fin: '<p class="popup_skill">+ #1 Fine Motor Skills#2</p>',
                rep: '<p class="popup_skill">+ #1 Repairing#2</p>',
                lea: '<p class="popup_skill">+ #1 Leadership#2</p>',
                tac: '<p class="popup_skill">+ #1 Tactics#2</p>',
                tra: '<p class="popup_skill">+ #1 Trading#2</p>',
                ani: '<p class="popup_skill">+ #1 Animal Instinct#2</p>',
                app: '<p class="popup_skill">+ #1 Appearance#2</p>'
             },
             },
             fb: {
             skill: {
                 fbdef: '<p class="popup_fb">+ #1 <b>Defense</b> (Fort battle bonus)#2</p>',
                 bui: ["Errichten", "1/18/Build"],
                 fboff: '<p class="popup_fb">+ #1 <b>Attack</b> (Fort battle bonus)#2</p>',
                pun: ["Schlagkraft", "8/8f/Punch"],
                 fbres: '<p class="popup_fb">+ #1 <b>Resistance</b> (Fort battle bonus)#2</p>',
                tou: ["Zähigkeit", "2/24/Tough"],
                 fbdefs: '<p class="popup_fb">+ #1 <b>Defense</b> (Fort battle sector bonus)#2</p>',
                end: ["Ausdauer", "0/0a/Endurance"],
                 fboffs: '<p class="popup_fb">+ #1 <b>Attack</b> (Fort battle sector bonus)#2</p>',
                hea: ["Lebenspunkte", "9/94/Health"],
                 fbdmgs: '<p class="popup_fb">+ #1 <b>Damages</b> (Fort battle sector bonus)#2</p>'
                rid: ["Reiten", "e/e4/Ride"],
                 ref: ["Reflex", "b/b2/Reflex"],
                dod: ["Ausweichen", "b/b2/Dodge"],
                hid: ["Verstecken", "9/96/Hide"],
                swi: ["Schwimmen", "9/93/Swim"],
                aim: ["Zielen", "d/d4/Aim"],
                sho: ["Schießen", "d/dc/Shot"],
                pit: ["Fallen stellen", "6/67/Pitfall"],
                 fin: ["Fingerfertigkeit", "b/b3/Finger_dexterity"],
                rep: ["Reparieren", "e/e2/Repair"],
                lea: ["Leiten", "4/44/Leadership"],
                 tac: ["Taktik", "0/09/Tactic"],
                 tra: ["Handeln", "d/d5/Trade"],
                ani: ["Mit Tieren umgehen", "2/21/Animal"],
                 app: ["Auftreten", "0/00/Appearance"],
             },
             },
             special: {
             txtgreen: {
                 xp: '<p class="popup_txtgreen">+ #1% Experience from jobs, duels and fort battles#2</p>',
                 exp: ["Erfahrung für Arbeiten, Duelle und Fortkämpfe", "0/0c/Set_exp"],
                 money: '<p class="popup_txtgreen">+ #1% Money from jobs and duels#2</p>',
                 dol: ["Verdienst bei Arbeiten und Duellen", "6/67/Set_dol"],
                 luck: '<p class="popup_txtgreen">+ #1% Improved Luck#2</p>',
                 luc: ["Erhöhte Glückschance", "f/f0/Set_luc"],
                 regen: '<p class="popup_txtgreen">+ #1% Regeneration#2</p>',
                 dro: ["Verbesserte Produktfundchance", "3/36/Set_dro"],
                 drop: '<p class="popup_txtgreen">+ #1% Improved drop chance#2</p>',
                reg: ["Regeneration im Hotel", "9/97/Set_reg"],
                 labor_pts: '<p class="popup_txtgreen">+ #1 labor point#2</p>',
                 spe: ["Geschwindigkeit", "b/bc/Set_spe"],
                 spd: '<p class="popup_txtgreen">+ #1% Speed#2</p>'
                pra: ["Beten", "1/16/Set_pra"],
            },
            fb_stats: {
                 def: ["Multiplayer-Verteidigung", "f/f3/Set_def"],
                off: ["Multiplayer-Angriff", "6/68/Set_off"],
                res: ["Widerstand (Fortkampfbonus)", "b/bf/Set_res"],
                dam: ["Schaden", "f/f4/Set_dam"],
                defs: ["Verteidigung (Fortkampfsektorbonus)", "e/e5/Set_defs"],
                offs: ["Angriff (Fortkampfsektorbonus)", "b/ba/Set_offs"],
                 dams: ["Schaden (Fortkampfsektorbonus)", "e/e9/Set_dams"],
             }
             }
        },
        not: function(s) {
            return 'Nicht ' + s.toLowerCase();
         }
         }
     },
     },
     config: {
     config: {
         enable_set_calc: !0,
         link_on_click: !1,
        plain_popup: !0,
         cdn: "//westde.innogamescdn.com",
        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_buyprice: "/images/5/57/Buy_price.png",
         img_sellprice: "/images/f/fc/Sell_price.png",
         img_sellprice: "/images/f/fc/Sell_price.png",
         img_male: "/images/c/c5/Gender_m.png",
         img_prof: ['c/c0', 'c/c3', '2/2d', '9/9a', 'f/fc'],
        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"
            },
            labor_pts: {
                name: "Labor points (all jobs)",
                img: "/images/5/5e/Labor_pts.png"
            }
        },
         img_job: {
         img_job: {
             trader: ['d/dc', 'Fahrender Händler'],
             trader: ['d/dc', 'Fahrender Händler'],
Linia 230: Linia 80:
             all: ['d/d1', 'Alle Arbeiten'],
             all: ['d/d1', 'Alle Arbeiten'],
         },
         },
        img_m: "c/c5/Gender_m",
        img_f: "4/41/Gender_f",
        img_due: "b/bb/CharS_duelist",
        img_adv: "7/72/CharS_adventurer",
        img_wor: "2/2a/CharS_worker",
        img_sol: "5/5c/CharS_soldier",
        set_bonus: {},
         jobIcon: function(p, q) {
         jobIcon: function(p, q) {
             var wip = this.img_job[p],
             var wip = this.img_job[p],
Linia 235: Linia 92:
             ji[0] += p + '.png';
             ji[0] += p + '.png';
             return ji;
             return ji;
        },
        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() {
     initPage: function() {
         if (1 === $("#input_level").length) var t = $('<input type="number" style="width:80px;" class="west" placeholder="' + westui.lang.input_level + '" min="0" max="150">').bind("propertychange keyup input paste", function() {
         if ($("#input_level").length)
            this.value > 150 ? this.value = 150 : this.value < 0 && (this.value = 0), $(".calc").each(function() {
            var t = $('<input type="number" style="width:80px;" class="west" placeholder="' + westui.lang.input_level + '" min="0" max="150">').on("propertychange keyup input paste", 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"))
                this.value > 150 ? this.value = 150 : this.value < 0 && (this.value = 0), $(".calc").each(function() {
            })
                    0 === t.val() ? ($(this).html(this.id), $(".per_level_off").addClass("per_level").removeClass("per_level_off")) : ($(this).html(Math.ceil(Number(this.id) * t.val())), $(".per_level").addClass("per_level_off").removeClass("per_level"));
        }).appendTo($("#input_level"));
                });
         if (1 === $("#input_search").length) $('<input type="search" class="west" placeholder="' + westui.lang.input_search + '">').bind("propertychange keyup input paste", function() {
            }).appendTo($("#input_level"));
            var t = this.value.toLowerCase();
         if ($("#input_search").length) {
            "" === t ? $(".item_container").show() : ($(".item_container").hide(), $(".item_container").filter(function() {
            $('<input type="search" class="west" placeholder="' + westui.lang.input_search + '">').on("propertychange keyup input paste", function() {
                return $(this).attr("data-popup").toLowerCase().indexOf(t) > -1
                var t = this.value.toLowerCase();
            }).show())
                if ($(".set_icon").length) {
        }).appendTo($("#input_search"));
                    "" === t ? ($('.set_icon + br').show(), $(".set_icon").show()) : ($('.set_icon + br').hide(), $(".set_icon").hide(), $(".set_icon").filter(function() {
        1 === $("#switch").length && ($("#fire").hide(), $("#switch").on("click", function() {
                        return this.children[1].title.toLowerCase().indexOf(t) > -1;
            $("#melee, #fire").toggle()
                    }).show());
        })), 1 === $("#switch_prod").length && ($("#prod2").hide(), $("#switch_prod").on("click", function() {
                } else {
             $("#prod, #prod2").toggle()
                    "" === t ? $(".item_container").show() : ($(".item_container").hide(), $(".item_container").filter(function() {
         })), 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() {
                        return $(this).attr("data-popup").toLowerCase().indexOf(t) > -1;
             window.location = "/wiki/" + mw.config.get("wgFormattedNamespaces")[10] + ":Item_" + JSON.parse($(this).parent().attr("data-popup")).id / 1e3
                    }).show());
        }), westui.config.link_on_dblclick && $(".item_container img").on("dblclick", function() {
                }
            window.location = "/wiki/" + $(this).parent().attr("data-link")
            }).appendTo($("#input_search"));
         })
        }
        $(".set_switch").length && ($(".set_fire").hide(), $(".set_switch").on("click", function() {
             $('.set_melee, .set_fire').toggle();
         })), $(".set_switchF").length && ($(".set_F").hide(), $(".set_switchF").on("click", function() {
            $('.set_F, .set_F + div').toggle();
        })), $(".item_container > img").on("click", function() {
             var loc = $(this).parent().attr("data-link");
            if (loc && !$(".infoSet").length)
                location.href = '/wiki/' + loc;
         });
     },
     },
     popup: {
     popup: {
Linia 303: Linia 130:
         active: !1,
         active: !1,
         show: function(t) {
         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)
             westui.popup.content = westui.popup.createPopup($(t), parseInt($(t).attr("data-lvl"))), westui.popup.active = !0, westui.popup.setTimeout(), westui.popup.getContainer().html(westui.popup.content);
         },
         },
         hide: function() {
         hide: function() {
Linia 310: Linia 137:
                 top: 0,
                 top: 0,
                 left: 0
                 left: 0
             }), westui.popup.active = !1, westui.popup.clearTimeout()
             }), westui.popup.active = !1, westui.popup.clearTimeout();
         },
         },
         setTimeout: function() {
         setTimeout: function() {
             westui.popup.clearTimeout(), westui.popup.timer = window.setTimeout(function() {
             westui.popup.clearTimeout(), westui.popup.timer = window.setTimeout(function() {
                 westui.popup.getEl().css("display", "block")
                 westui.popup.getEl().css("display", "block");
             }, westui.popup.delay)
             }, westui.popup.delay);
         },
         },
         clearTimeout: function() {
         clearTimeout: function() {
             westui.popup.timer && window.clearTimeout(westui.popup.timer)
             westui.popup.timer && window.clearTimeout(westui.popup.timer);
         },
         },
         getEl: function() {
         getEl: function() {
             return $("#popup_window")
             return $("#popup_window");
         },
         },
         getContainer: function() {
         getContainer: function() {
             return $("#popup_contents")
             return $("#popup_contents");
        },
        getValue: function(n, a, tc, o, tn) {
            var r = "";
            tc < 0 ? $("#input_level input").val() > 0 ? (tc = Math.ceil($("#input_level input").val() * -tc), n && (tc += Math.round(Math.max(1, .1 * tc * a)))) : (tc = -tc, r = " (" + westui.lang.per_level + ")", n && (tc = Math.round(1e6 * (1 * tc + Math.round(Math.max(1, 1e3 * tc * a)) / 1e4)) / 1e6)) : n && (tc < 1 ? tc = Math.round(1e6 * (1 * tc + Math.round(Math.max(1, 1e3 * tc * a)) / 1e4)) / 1e6 : tc += Math.round(Math.max(1, .1 * tc * a)));
            return '<p class="popup_' + o + '">+ ' + tc + tn + r + '</p>';
         },
         },
         createPopup: function(t, e, i, a) {
         createPopup: function(t, a) {
             t = JSON.parse(t);
            a = a || 0;
             var var wc = westui.config,
             t = JSON.parse(t.attr("data-popup"));
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/>",
             var wl = westui.lang,
                 n = !1;
                wc = westui.config,
             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) {
                s = '<div class="popup_image"><img src="' + wc.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>',
                for (var p = 0; p < t.text.length; p++) s += '<p class="popup_text">' + t.text[p] + "</p>";
                 n = !1,
                s += "<br/>"
                p = t.dmgr && t.dmgr.split('-');
            }
             if (t.txt)
             for (var o in westui.lang.popup) {
                s += '<p class="popup_text">' + t.txt + '</p><br>';
                var l = 0;
            a >= 1 && a <= 5 && (n = !0, t.auc = !1);
                 for (var c in westui.lang.popup[o])
            var l = 0;
            p && (l = 1) && (n && (p[0] = p[0] * 1 + Math.round(Math.max(1, .1 * p[0] * a)), p[1] = p[1] * 1 + Math.round(Math.max(1, .1 * p[1] * a))), s += '<p class="popup_dmg">' + p[0] + "-" + p[1] + ' ' + wl.damages + '</p>');
             for (var o in wl.popup) {
                 for (var c in wl.popup[o])
                     if (t.hasOwnProperty(c)) {
                     if (t.hasOwnProperty(c)) {
                         l++;
                         s += westui.popup.getValue(n, a, t[c], o, (o == 'txtgreen' && c != 'pra' ? '% ' : ' ') + wl.popup[o][c][0]);
                        var r = "";
                        l = o;
                        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 == 'dmg' && (s += '<br>');
                    } l > 0 && (s += "<br/>")
                    }
             }
             }
             if (t.textjob) {
             for (var m in t) {
                 for (p = 0; p < t.textjob.length; p++) s += '<p class="popup_txtgreen">' + t.textjob[p] + "</p>";
                 if (m.startsWith('job_')) {
                 s += "<br/>"
                    s += westui.popup.getValue(n, a, t[m][0], 'txtgreen', ' ' + wl.aps + t[m][1]);
                    l = m;
                 }
             }
             }
            l && l != 'dmg' && (s += '<br>');
             if (t.bonus) {
             if (t.bonus) {
                 for (p = 0; p < t.bonus.length; p++) s += '<p class="popup_bonus">' + t.bonus[p] + "</p>";
                 s += '<p style="text-align:left">Effekt:</p>';
                 s += "<br/>"
                for (p of t.bonus)
                    s += '<p class="popup_bonus">' + p + '</p>';
                 s += '<br>';
             }
             }
             if (t.jobs) {
             if (t.jobs) {
                s += '<table class="popup_job">';
                 for (p in t.jobs)
                 for (p in t.jobs)
                     if (p == 'req') {
                     if (p == 'req') {
s += '<table class="popup_job">';
                         s += '<tr><td colspan="2">';
                         s += '<tr><td colspan="2">';
                         for (var q of t.jobs[p]) {
                         for (var q of t.jobs[p]) {
Linia 362: Linia 202:
                         }
                         }
                         s += '</td></tr>';
                         s += '</td></tr>';
s += '</table><br>';
                     } else {
                     } else {
s += '<div style="text-align:center;"><table class="popup_job">';
                        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>";
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>"
                     }
                     }
                s += '</table><br>';
             }
             }
             if (t.craft) {
             if (t.craft) {
                 s += '<div style="text-align:center;"><table class="popup_crafteditem"><tr><td><img src="' + westui.config.cdn + "/images/crafting/profsymbol_" + t.craft.id + '_small.png"/></td><td><table><tr>';
                 s += '<table class="popup_job"><tr><th><img src="/images/' + wc.img_prof[t.craft[0]] + '/Profsymbol_' + t.craft[0] + '.png"></th><td>';
                 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>';
                 for (p = 1; p < t.craft.length; p++) {
                s += "</tr><tr>";
                    var u = t.craft[p].split(',');
                for (p = 0; p < t.craft.req.length; p++) s += "<td><span>x" + t.craft.req[p][1] + "</span></td>";
                    s += '<div class="item_req"><img src="' + wc.cdn + "/images/items/yield/" + u[0] + '.png"><div class="number">' + u[1] + '</div></div>';
                 s += "</tr></table></td></tr></table></div>"
                }
                 s += '</td></tr></table><br>';
             }
             }
             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
             t.spd && (n && (t.spd += Math.round(Math.max(1, .1 * t.spd * a))), s += '<p class="popup_speed">' + wl.speed + ': +' + t.spd + '%</p><br>'), t.set && (s += '<p><span class="popup_set">' + t.set + "</span></p><br>"), (t.auc || t.sell) && (s += '<img src="' + wc.img_buyprice + '">&nbsp;$' + t.bp + '&emsp;<img src="' + wc.img_sellprice + '">&nbsp;$' + t.sp + '<br>'), s += !t.sell ? '<i>' + wl.not(wl.sellable) + '</i><br><br>' : '<br>', t.sex && (s += '<img src="/images/' + wc['img_' + t.sex] + '.png">&emsp;'), t.char && (s += '<img src="/images/' + wc['img_' + t.char] + '.png">&emsp;'), t.lvl && (s += wl.level + " <b>" + t.lvl + "</b><br>"), s += '<span class="popup_txt' + (t.auc ? 'green' : 'red') + '">' + (t.auc ? wl.auctionable : wl.not(wl.auctionable)) + '</span><br>', s += '<span class="popup_txt' + (t.upg ? 'green' : 'red') + '">' + (t.upg ? wl.upgradeable : wl.not(wl.upgradeable)) + '</span><br>';
            return s += '<br><p class="popup_id">[item=<b>' + t.id + '00' + a + ' </b>]</p>';
         },
         },
         setPosition: function(t) {
         setPosition: function(t) {
Linia 384: Linia 224:
                 p = westui.popup.getEl().outerHeight(),
                 p = westui.popup.getEl().outerHeight(),
                 o = t.clientX,
                 o = t.clientX,
                 l = t.clientY,
                 l = t.clientY;
                c = 20,
             i = o + n + 20 > a ? o - n - 20 + (t.pageX - o) : o + 20 + (t.pageX - o), e = l + p + 20 > s ? s - p + (t.pageY - l) : 20 + t.pageY, westui.popup.getEl().css({
                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,
                 top: e,
                 left: i
                 left: i
             })
             });
         },
         },
         init: function() {
         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) {
             $("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)
                 westui.popup.show(this), westui.popup.setPosition(t);
             }), $(document).on("mouseleave", ".item_container", function() {
             }), $(document).on("mouseleave", ".item_container", function() {
                 westui.popup.hide()
                 westui.popup.hide();
             }), $(document).on("mousemove", ".item_container", function(t) {
             }), $(document).on("mousemove", ".item_container", function(t) {
                 westui.popup.setPosition(t)
                 westui.popup.setPosition(t);
             }), $(".item_level").mousedown(function(t) {
             }), $(".item_level").mousedown(function(t) {
                 t.preventDefault()
                 t.preventDefault();
             }), $(document).on("click", ".upgrade", function() {
             }), $(document).on("click", ".upgrade", function() {
                 var t = $(this).closest(".item_container"),
                 var t = $(this).closest(".item_container"),
                     e = parseInt(t.attr("data-lvl"));
                     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])
                 5 !== e && (t.attr("data-lvl", e + 1), t.find(".level").html(e + 1)), westui.popup.show(t[0]);
             }), $(document).on("click", ".downgrade", function() {
             }), $(document).on("click", ".downgrade", function() {
                 var t = $(this).closest(".item_container"),
                 var t = $(this).closest(".item_container"),
                     e = parseInt(t.attr("data-lvl"));
                     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])
                 0 !== e && (t.attr("data-lvl", e - 1), t.find(".level").html(e - 1)), westui.popup.show(t[0]);
             })
             });
         }
         }
     },
     },
     set_calc: {
     set_calc: {
         bonus: {
         extra_set_bonus: {},
            extra_set_bonus: {}
        },
         data: {},
         data: {},
         itemStatus: {},
         itemStatus: {},
         getData: function() {
         getData: function() {
             $(".set_container").each(function() {
             var wsc = westui.set_calc;
                 var t = $(this).attr("data-set-id");
            for (var o in westui.lang.popup) {
                 westui.set_calc.itemStatus[t] = {}, westui.set_calc.data[t] = {
                var l = westui.lang.popup[o];
                for (var c in l) {
                    var small = ['attribute', 'skill'].includes(o) ? ['thumb/', '/40px-' + l[c][1].split('/')[2] + '.png'] : ['', ''];
                    westui.config.set_bonus[c] = {
                        name: l[c][0],
                        img: '/images/' + small[0] + l[c][1] + '.png' + small[1]
                    };
                 }
            }
            var t = 0;
            $(".infoSet").each(function() {
                t++;
                 wsc.itemStatus[t] = {}, wsc.data[t] = {
                     items: {},
                     items: {},
                     set: {}
                     set: {}
                 }
                 };
            }), $(".infoSet").each(function() {
                 $(this).find(".setbonusrow").each(function() {
                var t = $(this).attr("data-set-id");
                 $(this).find(".infosetatt").each(function() {
                     var e = $(this).attr("data-nb");
                     var e = $(this).attr("data-nb");
                     westui.set_calc.data[t].set[e] = {}, $(this).find(".set_bonus").each(function() {
                     wsc.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] = {
                         var img = $(this).find("img").attr("src"),
                             img: $(this).find("img").attr("src"),
                            exp = img.match(/\/(Set_)?((Job_)?\w+)\.png/),
                            key = (exp[1] || exp[3] ? exp[2] : exp[2].substr(0, 3)).toLowerCase();
                        0 !== $(this).find(".calc").length ? wsc.data[t].set[e][key] = -parseFloat($(this).find(".calc").attr("id")) : wsc.data[t].set[e][key] = parseFloat($(this).find(".val").text()), westui.config.set_bonus.hasOwnProperty(key) || (wsc.extra_set_bonus[key] = {
                             img: img,
                             name: $(this).find("#tooltip_content").text()
                             name: $(this).find("#tooltip_content").text()
                         })
                         });
                     })
                     });
                 })
                 });
             }), $(".set_container").each(function() {
             });
                 var t = $(this).attr("data-set-id");
            t = 0;
            $(".set_container").each(function() {
                 $(this).attr("data-set-id", ++t);
                 $(this).find(".item_container").each(function() {
                 $(this).find(".item_container").each(function() {
                     var e = JSON.parse($(this).attr("data-popup"));
                     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])
                     $(this).is(":hidden") ? wsc.itemStatus[t][e.id] = !1 : wsc.itemStatus[t][e.id] = 0;
                 })
                    for (var i in e) {
             })
                        if (i == 'dmg')
                            continue;
                        var isj = i.startsWith('job_');
                        e.hasOwnProperty(i) && (westui.config.set_bonus.hasOwnProperty(i) || wsc.extra_set_bonus.hasOwnProperty(i) || isj && (wsc.extra_set_bonus[i] = {
                            img: westui.config.jobIcon(i.replace('job_', ''))[0] + '" width="40',
                            name: westui.lang.aps + e[i][1]
                        })) && (wsc.data[t].items[i] || (wsc.data[t].items[i] = {}), wsc.data[t].items[i][e.id] = (isj ? e[i][0] : e[i]));
                    }
                 });
            });
        },
        addBon: function(c, total, w, l) {
            return total ? ('<div class="set_bonus tooltip_container"><img src="' + w.img + '"><b>+' + Math.round(total * 1000) / 1000 + (['exp', 'dol', 'luc', 'reg', 'dro', 'spe'].includes(c) ? '%' : '') + '</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">' + w.name + (l ? '<span class="per_level"/>' : '') + '</div></div></div></div>') : '';
        },
        isBon: function(c, total, w) {
            var p = '';
             if (total[c])
                for (var l = 0; l < 2; l++)
                    p += this.addBon(c, total[c][l], w[c], l);
            return p;
        },
        lvlUp: function(upg, val) {
            var d = val < 1 ? 3 : -1;
            var e = !upg ? 0 : Math.round(Math.max(1, val * Math.pow(10, d) * upg)) / Math.pow(10, d + 1);
            return val + e;
         },
         },
         calc: function() {
         calc: function() {
             if (0 === $("#input_level").length | "" !== $("#input_level input").val()) {
             var wsc = westui.set_calc,
                 var t = parseInt($("#input_level input").val());
                lvl = $("#input_level input").val() * 1,
                for (var e in total = {}, westui.set_calc.data) {
                total = {},
                    for (var i in westui.set_calc.data[e].items)
                 key;
                        for (var a in westui.set_calc.data[e].items[i])
            for (var e in wsc.data) {
                            if (!1 !== westui.set_calc.itemStatus[e][a]) {
                for (var i in wsc.data[e].items)
                                lvl = westui.set_calc.itemStatus[e][a], total[i] || (total[i] = 0);
                    for (var k in wsc.data[e].items[i]) {
                                var s = westui.set_calc.data[e].items[i][a];
                        var upg = wsc.itemStatus[e][k];
                                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
                        if (!1 !== upg) {
                            } var n = 0;
                            total[i] || (total[i] = [0, 0]);
                    for (var a in westui.set_calc.itemStatus[e]) !1 !== westui.set_calc.itemStatus[e][a] && n++;
                            var bi = wsc.data[e].items[i][k];
                    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]
                            key = 0;
                            if (bi < 0) {
                                bi *= -1;
                                key = 1;
                            }
                            bi = wsc.lvlUp(upg, (lvl && key ? Math.ceil(bi * lvl) : bi));
                            if (key && !lvl)
                                total[i][1] += bi;
                            else
                                total[i][0] += bi;
                        }
                    }
                var n = 0;
                for (var a in wsc.itemStatus[e])
                    !1 !== wsc.itemStatus[e][a] && n++;
                for (var b in wsc.data[e].set[n]) {
                    var bs = wsc.data[e].set[n][b];
                    key = 0;
                    total[b] || (total[b] = [0, 0]);
                    if (bs < 0) {
                        bs *= -1;
                        key = 1;
                    }
                    bs = lvl && key ? Math.ceil(bs * lvl) : bs;
                    if (key && !lvl)
                        total[b][1] += bs;
                    else
                        total[b][0] += bs;
                 }
                 }
                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>");
            var p = '<table class="infoSet"><caption><big><b>' + westui.lang.total + "</b></big></caption><tbody><tr><td>";
                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>");
            for (var c in westui.config.set_bonus)
                $("#set_calc").html(p)
                p += wsc.isBon(c, total, westui.config.set_bonus);
            } else $("#set_calc").html("")
            for (var d in wsc.extra_set_bonus)
                p += wsc.isBon(d, total, wsc.extra_set_bonus);
            $("#set_calc").html(p);
         },
         },
         initEvents: function() {
         initEvents: function() {
             $(".item_container > img").on("click", function() {
             $(".item_container > img").on("click", function(e) {
                 var t = $(this).closest(".item_container");
                 var t = $(this).closest(".item_container");
                 t.toggleClass("item_off");
                 t.toggleClass("item_off");
                 var e = t.closest(".set_container").attr("data-set-id"),
                 e = t.closest(".set_container").attr("data-set-id"), i = JSON.parse(t.attr("data-popup")).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();
                 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() {
             }), $(document).on("click", ".upgrade, .downgrade", function() {
                 var t = $(this).closest(".item_container"),
                 var t = $(this).closest(".item_container"),
                     e = t.closest(".set_container").attr("data-set-id");
                     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())
                 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() {
             }), $("#input_level").on("propertychange keyup input paste", function() {
                 westui.set_calc.calc()
                 westui.set_calc.calc();
             }), $("#switch").on("click", function() {
             }), $(".set_switch, .set_switchF").on("click", function() {
                 $("#melee, #fire").each(function() {
                 $(".set_melee, .set_F").each(function() {
                     var t = $(this).find(".item_container"),
                     $(this).parent().find(".item_container").each(function() {
                         e = $(this).closest(".set_container").attr("data-set-id");
                         var t = $(this);
                    $(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"))
                        e = t.closest(".set_container").attr("data-set-id");
                 }), westui.set_calc.calc()
                        t.hasClass("item_off") || t.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() {
         dragElement: function(elmnt) {
             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()
             var p = [0, 0, 0, 0];
        }
            elmnt.onmousedown = dragMouseDown;
    },
            var first = 0;
    sorting: {
 
        sortItems: function(t) {
            function dragMouseDown(e) {
            function e(e) {
                e = e || window.event;
                 var i = JSON.parse($(e).attr("data-popup")),
                e.preventDefault();
                     a = $("#input_level input").val();
                 p[3] = e.clientX;
                a = a || 150;
                p[4] = e.clientY;
                var s = -1 !== Object.keys(t).indexOf("id") || t.bool && !0 === t.bool,
                if (!first) {
                    n = 0;
                     first = 1;
                 if (t.bool && !0 === t.bool)
                    $("#set_calc").css({
                    for (var p in n = 1, t) "bool" !== p && i[p] !== t[p] && (n = 0);
                        position: 'fixed',
                 else
                        margin: 0
                    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('<p class="number">' + n + "</p>")
                    elmnt.style.top = (elmnt.offsetTop - document.documentElement.scrollTop - 20) + "px";
                }
                document.onmousemove = elementDrag;
                document.onmouseup = closeDragElement;
            }
 
            function elementDrag(e) {
                 e = e || window.event;
                e.preventDefault();
                p[1] = p[3] - e.clientX;
                 p[2] = p[4] - e.clientY;
                p[3] = e.clientX;
                p[4] = e.clientY;
                 elmnt.style.top = (elmnt.offsetTop - p[2]) + "px";
                elmnt.style.left = (elmnt.offsetLeft - p[1]) + "px";
            }
 
            function closeDragElement() {
                document.onmouseup = null;
                document.onmousemove = null;
             }
             }
            $(".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() {
         init: function() {
             if (1 === $("div#sort_items").length) {
             westui.set_calc.initEvents(), westui.set_calc.getData(), $("dl + p").after('<div id="set_calc"></div>'), westui.set_calc.dragElement($("#set_calc")[0]), westui.set_calc.calc();
                var t = "<div id='input_search'><select id='sort_items' class='west'><option selected disabled>Order by :</option>";
                for (var e in westui.config.sorting) t += "<option value='" + westui.config.sorting[e] + "'>" + e + "</option>";
                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")))
                })
            }
         }
         }
     },
     },
     init: function() {
     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.initPage(), $('.item_container').length && westui.popup.init(), $('.infoSet').length && westui.set_calc.init();
     }
     }
}, westui.init();
}, westui.init();

Versiunea de la data 22 martie 2022 20:28

westui = {

   lang: {
       input_level: "Stufe",
       input_search: "Suche",
       damages: "Schaden",
       per_level: "pro Stufe",
       speed: "Geschwindigkeit",
       level: "Stufe",
       sellable: "Verkaufbar",
       auctionable: "Auktionierbar",
       upgradeable: "Veredelbar",
       total: "Total",
       aps: "Arbeitspunkte auf ",
       popup: {
           dmg: {
               dmg: ["Schaden", ],
           },
           attribute: {
               str: ["Stärke", "8/8b/Strength"],
               fle: ["Beweglichkeit", "d/db/Flexibility"],
               dex: ["Geschicklichkeit", "0/0d/Dexterity"],
               cha: ["Charisma", "c/c9/Charisma"],
           },
           skill: {
               bui: ["Errichten", "1/18/Build"],
               pun: ["Schlagkraft", "8/8f/Punch"],
               tou: ["Zähigkeit", "2/24/Tough"],
               end: ["Ausdauer", "0/0a/Endurance"],
               hea: ["Lebenspunkte", "9/94/Health"],
               rid: ["Reiten", "e/e4/Ride"],
               ref: ["Reflex", "b/b2/Reflex"],
               dod: ["Ausweichen", "b/b2/Dodge"],
               hid: ["Verstecken", "9/96/Hide"],
               swi: ["Schwimmen", "9/93/Swim"],
               aim: ["Zielen", "d/d4/Aim"],
               sho: ["Schießen", "d/dc/Shot"],
               pit: ["Fallen stellen", "6/67/Pitfall"],
               fin: ["Fingerfertigkeit", "b/b3/Finger_dexterity"],
               rep: ["Reparieren", "e/e2/Repair"],
               lea: ["Leiten", "4/44/Leadership"],
               tac: ["Taktik", "0/09/Tactic"],
               tra: ["Handeln", "d/d5/Trade"],
               ani: ["Mit Tieren umgehen", "2/21/Animal"],
               app: ["Auftreten", "0/00/Appearance"],
           },
           txtgreen: {
               exp: ["Erfahrung für Arbeiten, Duelle und Fortkämpfe", "0/0c/Set_exp"],
               dol: ["Verdienst bei Arbeiten und Duellen", "6/67/Set_dol"],
               luc: ["Erhöhte Glückschance", "f/f0/Set_luc"],
               dro: ["Verbesserte Produktfundchance", "3/36/Set_dro"],
               reg: ["Regeneration im Hotel", "9/97/Set_reg"],
               spe: ["Geschwindigkeit", "b/bc/Set_spe"],
               pra: ["Beten", "1/16/Set_pra"],
           },
           fb_stats: {
               def: ["Multiplayer-Verteidigung", "f/f3/Set_def"],
               off: ["Multiplayer-Angriff", "6/68/Set_off"],
               res: ["Widerstand (Fortkampfbonus)", "b/bf/Set_res"],
               dam: ["Schaden", "f/f4/Set_dam"],
               defs: ["Verteidigung (Fortkampfsektorbonus)", "e/e5/Set_defs"],
               offs: ["Angriff (Fortkampfsektorbonus)", "b/ba/Set_offs"],
               dams: ["Schaden (Fortkampfsektorbonus)", "e/e9/Set_dams"],
           }
       },
       not: function(s) {
           return 'Nicht ' + s.toLowerCase();
       }
   },
   config: {
       link_on_click: !1,
       cdn: "//westde.innogamescdn.com",
       img_buyprice: "/images/5/57/Buy_price.png",
       img_sellprice: "/images/f/fc/Sell_price.png",
       img_prof: ['c/c0', 'c/c3', '2/2d', '9/9a', 'f/fc'],
       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'],
       },
       img_m: "c/c5/Gender_m",
       img_f: "4/41/Gender_f",
       img_due: "b/bb/CharS_duelist",
       img_adv: "7/72/CharS_adventurer",
       img_wor: "2/2a/CharS_worker",
       img_sol: "5/5c/CharS_soldier",
       set_bonus: {},
       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;
       }
   },
   initPage: function() {
       if ($("#input_level").length)
           var t = $('<input type="number" style="width:80px;" class="west" placeholder="' + westui.lang.input_level + '" min="0" max="150">').on("propertychange keyup input paste", function() {
               this.value > 150 ? this.value = 150 : this.value < 0 && (this.value = 0), $(".calc").each(function() {
                   0 === t.val() ? ($(this).html(this.id), $(".per_level_off").addClass("per_level").removeClass("per_level_off")) : ($(this).html(Math.ceil(Number(this.id) * t.val())), $(".per_level").addClass("per_level_off").removeClass("per_level"));
               });
           }).appendTo($("#input_level"));
       if ($("#input_search").length) {
           $('<input type="search" class="west" placeholder="' + westui.lang.input_search + '">').on("propertychange keyup input paste", function() {
               var t = this.value.toLowerCase();
               if ($(".set_icon").length) {
                   "" === t ? ($('.set_icon + br').show(), $(".set_icon").show()) : ($('.set_icon + br').hide(), $(".set_icon").hide(), $(".set_icon").filter(function() {
                       return this.children[1].title.toLowerCase().indexOf(t) > -1;
                   }).show());
               } else {
                   "" === t ? $(".item_container").show() : ($(".item_container").hide(), $(".item_container").filter(function() {
                       return $(this).attr("data-popup").toLowerCase().indexOf(t) > -1;
                   }).show());
               }
           }).appendTo($("#input_search"));
       }
       $(".set_switch").length && ($(".set_fire").hide(), $(".set_switch").on("click", function() {
           $('.set_melee, .set_fire').toggle();
       })), $(".set_switchF").length && ($(".set_F").hide(), $(".set_switchF").on("click", function() {
           $('.set_F, .set_F + div').toggle();
       })), $(".item_container > img").on("click", function() {
           var loc = $(this).parent().attr("data-link");
           if (loc && !$(".infoSet").length)
               location.href = '/wiki/' + loc;
       });
   },
   popup: {
       content: "",
       delay: 200,
       active: !1,
       show: function(t) {
           westui.popup.content = westui.popup.createPopup($(t), 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");
       },
       getValue: function(n, a, tc, o, tn) {
           var r = "";
           tc < 0 ? $("#input_level input").val() > 0 ? (tc = Math.ceil($("#input_level input").val() * -tc), n && (tc += Math.round(Math.max(1, .1 * tc * a)))) : (tc = -tc, r = " (" + westui.lang.per_level + ")", n && (tc = Math.round(1e6 * (1 * tc + Math.round(Math.max(1, 1e3 * tc * a)) / 1e4)) / 1e6)) : n && (tc < 1 ? tc = Math.round(1e6 * (1 * tc + Math.round(Math.max(1, 1e3 * tc * a)) / 1e4)) / 1e6 : tc += Math.round(Math.max(1, .1 * tc * a)));

return '

';

       },
       createPopup: function(t, a) {
           a = a || 0;
           t = JSON.parse(t.attr("data-popup"));
           var wl = westui.lang,
               wc = westui.config,

s = '


',

               n = !1,
               p = t.dmgr && t.dmgr.split('-');
           if (t.txt)

s += '


';

           a >= 1 && a <= 5 && (n = !0, t.auc = !1);
           var l = 0;

p && (l = 1) && (n && (p[0] = p[0] * 1 + Math.round(Math.max(1, .1 * p[0] * a)), p[1] = p[1] * 1 + Math.round(Math.max(1, .1 * p[1] * a))), s += '

');

           for (var o in wl.popup) {
               for (var c in wl.popup[o])
                   if (t.hasOwnProperty(c)) {
                       s += westui.popup.getValue(n, a, t[c], o, (o == 'txtgreen' && c != 'pra' ? '% ' : ' ') + wl.popup[o][c][0]);
                       l = o;
                       l == 'dmg' && (s += '
'); } } for (var m in t) { if (m.startsWith('job_')) { s += westui.popup.getValue(n, a, t[m][0], 'txtgreen', ' ' + wl.aps + t[m][1]); l = m; } } l && l != 'dmg' && (s += '
'); if (t.bonus) {

s += '

Effekt:

';

               for (p of t.bonus)

s += '

';

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

s += '

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


';

           }
           if (t.craft) {

s += '


';

           }

t.spd && (n && (t.spd += Math.round(Math.max(1, .1 * t.spd * a))), s += '


'), t.set && (s += '

' + t.set + "


"), (t.auc || t.sell) && (s += '<img src="' + wc.img_buyprice + '"> $' + t.bp + ' <img src="' + wc.img_sellprice + '"> $' + t.sp + '
'), s += !t.sell ? '' + wl.not(wl.sellable) + '

' : '
', t.sex && (s += '<img src="/images/' + wc['img_' + t.sex] + '.png"> '), t.char && (s += '<img src="/images/' + wc['img_' + t.char] + '.png"> '), t.lvl && (s += wl.level + " " + t.lvl + "
"), s += '' + (t.auc ? wl.auctionable : wl.not(wl.auctionable)) + '
', s += '' + (t.upg ? wl.upgradeable : wl.not(wl.upgradeable)) + '
'; return 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;
           i = o + n + 20 > a ? o - n - 20 + (t.pageX - o) : o + 20 + (t.pageX - o), e = l + p + 20 > s ? s - p + (t.pageY - l) : 20 + t.pageY, 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: {
       extra_set_bonus: {},
       data: {},
       itemStatus: {},
       getData: function() {
           var wsc = westui.set_calc;
           for (var o in westui.lang.popup) {
               var l = westui.lang.popup[o];
               for (var c in l) {
                   var small = ['attribute', 'skill'].includes(o) ? ['thumb/', '/40px-' + l[c][1].split('/')[2] + '.png'] : [, ];
                   westui.config.set_bonus[c] = {
                       name: l[c][0],
                       img: '/images/' + small[0] + l[c][1] + '.png' + small[1]
                   };
               }
           }
           var t = 0;
           $(".infoSet").each(function() {
               t++;
               wsc.itemStatus[t] = {}, wsc.data[t] = {
                   items: {},
                   set: {}
               };
               $(this).find(".setbonusrow").each(function() {
                   var e = $(this).attr("data-nb");
                   wsc.data[t].set[e] = {}, $(this).find(".set_bonus").each(function() {
                       var img = $(this).find("img").attr("src"),
                           exp = img.match(/\/(Set_)?((Job_)?\w+)\.png/),
                           key = (exp[1] || exp[3] ? exp[2] : exp[2].substr(0, 3)).toLowerCase();
                       0 !== $(this).find(".calc").length ? wsc.data[t].set[e][key] = -parseFloat($(this).find(".calc").attr("id")) : wsc.data[t].set[e][key] = parseFloat($(this).find(".val").text()), westui.config.set_bonus.hasOwnProperty(key) || (wsc.extra_set_bonus[key] = {
                           img: img,
                           name: $(this).find("#tooltip_content").text()
                       });
                   });
               });
           });
           t = 0;
           $(".set_container").each(function() {
               $(this).attr("data-set-id", ++t);
               $(this).find(".item_container").each(function() {
                   var e = JSON.parse($(this).attr("data-popup"));
                   $(this).is(":hidden") ? wsc.itemStatus[t][e.id] = !1 : wsc.itemStatus[t][e.id] = 0;
                   for (var i in e) {
                       if (i == 'dmg')
                           continue;
                       var isj = i.startsWith('job_');
                       e.hasOwnProperty(i) && (westui.config.set_bonus.hasOwnProperty(i) || wsc.extra_set_bonus.hasOwnProperty(i) || isj && (wsc.extra_set_bonus[i] = {
                           img: westui.config.jobIcon(i.replace('job_', ))[0] + '" width="40',
                           name: westui.lang.aps + e[i][1]
                       })) && (wsc.data[t].items[i] || (wsc.data[t].items[i] = {}), wsc.data[t].items[i][e.id] = (isj ? e[i][0] : e[i]));
                   }
               });
           });
       },
       addBon: function(c, total, w, l) {

return total ? ('

<img src="' + w.img + '">+' + Math.round(total * 1000) / 1000 + (['exp', 'dol', 'luc', 'reg', 'dro', 'spe'].includes(c) ? '%' : ) + '
' + w.name + (l ? '' : ) + '

') : ;

       },
       isBon: function(c, total, w) {
           var p = ;
           if (total[c])
               for (var l = 0; l < 2; l++)
                   p += this.addBon(c, total[c][l], w[c], l);
           return p;
       },
       lvlUp: function(upg, val) {
           var d = val < 1 ? 3 : -1;
           var e = !upg ? 0 : Math.round(Math.max(1, val * Math.pow(10, d) * upg)) / Math.pow(10, d + 1);
           return val + e;
       },
       calc: function() {
           var wsc = westui.set_calc,
               lvl = $("#input_level input").val() * 1,
               total = {},
               key;
           for (var e in wsc.data) {
               for (var i in wsc.data[e].items)
                   for (var k in wsc.data[e].items[i]) {
                       var upg = wsc.itemStatus[e][k];
                       if (!1 !== upg) {
                           total[i] || (total[i] = [0, 0]);
                           var bi = wsc.data[e].items[i][k];
                           key = 0;
                           if (bi < 0) {
                               bi *= -1;
                               key = 1;
                           }
                           bi = wsc.lvlUp(upg, (lvl && key ? Math.ceil(bi * lvl) : bi));
                           if (key && !lvl)
                               total[i][1] += bi;
                           else
                               total[i][0] += bi;
                       }
                   }
               var n = 0;
               for (var a in wsc.itemStatus[e])
                   !1 !== wsc.itemStatus[e][a] && n++;
               for (var b in wsc.data[e].set[n]) {
                   var bs = wsc.data[e].set[n][b];
                   key = 0;
                   total[b] || (total[b] = [0, 0]);
                   if (bs < 0) {
                       bs *= -1;
                       key = 1;
                   }
                   bs = lvl && key ? Math.ceil(bs * lvl) : bs;
                   if (key && !lvl)
                       total[b][1] += bs;
                   else
                       total[b][0] += bs;
               }
           }

var p = '

<tbody>
' + westui.lang.total + "
";
           for (var c in westui.config.set_bonus)
               p += wsc.isBon(c, total, westui.config.set_bonus);
           for (var d in wsc.extra_set_bonus)
               p += wsc.isBon(d, total, wsc.extra_set_bonus);
           $("#set_calc").html(p);
       },
       initEvents: function() {
           $(".item_container > img").on("click", function(e) {
               var t = $(this).closest(".item_container");
               t.toggleClass("item_off");
               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").on("propertychange keyup input paste", function() {
               westui.set_calc.calc();
           }), $(".set_switch, .set_switchF").on("click", function() {
               $(".set_melee, .set_F").each(function() {
                   $(this).parent().find(".item_container").each(function() {
                       var t = $(this);
                       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] = !1 : westui.set_calc.itemStatus[e][JSON.parse(t.attr("data-popup")).id] = parseInt(t.attr("data-lvl"));
                   });
               }), westui.set_calc.calc();
           });
       },
       dragElement: function(elmnt) {
           var p = [0, 0, 0, 0];
           elmnt.onmousedown = dragMouseDown;
           var first = 0;
           function dragMouseDown(e) {
               e = e || window.event;
               e.preventDefault();
               p[3] = e.clientX;
               p[4] = e.clientY;
               if (!first) {
                   first = 1;
                   $("#set_calc").css({
                       position: 'fixed',
                       margin: 0
                   });
                   elmnt.style.top = (elmnt.offsetTop - document.documentElement.scrollTop - 20) + "px";
               }
               document.onmousemove = elementDrag;
               document.onmouseup = closeDragElement;
           }
           function elementDrag(e) {
               e = e || window.event;
               e.preventDefault();
               p[1] = p[3] - e.clientX;
               p[2] = p[4] - e.clientY;
               p[3] = e.clientX;
               p[4] = e.clientY;
               elmnt.style.top = (elmnt.offsetTop - p[2]) + "px";
               elmnt.style.left = (elmnt.offsetLeft - p[1]) + "px";
           }
           function closeDragElement() {
               document.onmouseup = null;
               document.onmousemove = null;
           }
       },
       init: function() {
westui.set_calc.initEvents(), westui.set_calc.getData(), $("dl + p").after('
'), westui.set_calc.dragElement($("#set_calc")[0]), westui.set_calc.calc();
       }
   },
   init: function() {
       westui.initPage(), $('.item_container').length && westui.popup.init(), $('.infoSet').length && westui.set_calc.init();
   }

}, westui.init();