此处公告通常对读者进行申明或对该WIKI某些规则进行公告,请在确认后修改本通告。本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~

全站通知:

Widget:SkillTreeCalculator/js

来自无主之地3WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

<script> class SkillTreeCalculator { constructor(dom) { this.dom = $(dom) this.dom.data("STC", this) let block = this.dom.data("block").split(",") let style = this.dom.data("style").split(",")

let $top = $(`

`)

this.dom.append($top)

let $bottom = $(`
`)

block.forEach((e, i, a) => { let info = SkillTreeCalculator.block[e]

let $block = $(`
`)

$block.css("--p", 0)

let $header = $(`
${info.title}
`)

$block.append($header)

let $body = $(`
`) $body.append(`
`) let $icons = $(`
`)

$body.append($icons) let iconIndex = 0 info.body.forEach((e, i, a) => { e.forEach((f, j, b) => { if (!f) { return }

let $icon = $(`
`)

$icon.css({ "--c": j + 1, "--r": i + 1 }) $icon.data({ allow: i * 5, p: 0, max: f })

$icon.append($(`
${info?.icon?.[iconIndex] ? `<img src="${info.icon[iconIndex]}">` : "图标"}
`))

iconIndex++

let $ctrl = $(`
`) $ctrl.append(`
`) $ctrl.append(`
0/${f}
`) $ctrl.append(`
`)

$icon.append($ctrl) $icons.append($icon) }) }) $block.append($body)

$block.append(``)

this.refresh($block) $bottom.append($block) }) this.dom.append($bottom) }

refresh($block) { let $icon = $block.find(".body .icons .icon") let allowFlag = true let ap = 0 $icon.each((i, e) => { let data = $(e).data() if (allowFlag) { if (ap < data.allow) { allowFlag = false } else { if (data.p < 0) { data.p = 0 } else if (data.p > data.max) { data.p = data.max } $(e).removeClass("locked") } } if (!allowFlag) { data.p = 0 $(e).addClass("locked") } data.p ? $(e).addClass("used") : $(e).removeClass("used") $(e).find(".current").html(data.p) ap += data.p }) $block.css("--p", ap) }

plus($icon) { $icon.data().p++ this.refresh($icon.closest(".block")) }

minus($icon) { $icon.data().p-- this.refresh($icon.closest(".block")) }

point($icon) { $icon.data().p ? $icon.data().p = 0 : $icon.data().p = $icon.data().p = $icon.data().max this.refresh($icon.closest(".block")) } }

SkillTreeCalculator.block = { underCover: { title: "Under Cover", body: [ [5, 3, 5], [5, 3, 5], [0, 1, 0], [1, 5, 1], [3, 1, 3], [0, 1, 0], ], icon: [ "https://patchwiki.biligame.com/images/borderlands3/d/d9/h5qpkrnkca2y7ejh9k9kwrk82g4q6ep.png?", "https://patchwiki.biligame.com/images/borderlands3/7/78/hwctngvigbg78co0u15qqks95v5l9pk.png?",

           "https://patchwiki.biligame.com/images/borderlands3/a/ab/g3j5ky83isj6im6z0bj2zd07gk3wjaa.png?",
           "https://patchwiki.biligame.com/images/borderlands3/1/1c/qapfg96sqpgn1owhgrt7eveaovkaib9.png?",
           "https://patchwiki.biligame.com/images/borderlands3/f/f3/c7hynzmu8vbcrqef30ji1drawnit10v.png?",
           "https://patchwiki.biligame.com/images/borderlands3/f/f8/pu84jzzm5lk6xpwm5hhmt8iwtgvti6o.png?",
           "https://patchwiki.biligame.com/images/borderlands3/8/81/28f29tarhito4vjhp333df48vaimvna.png?",
           "https://patchwiki.biligame.com/images/borderlands3/e/e7/4iqzlqi9q6x1rpj41l270n9ct2as6u9.png?",
           "https://patchwiki.biligame.com/images/borderlands3/f/f7/st8fp82hpdfk5rd42g6htf1lho4lpry.png?",
           "https://patchwiki.biligame.com/images/borderlands3/b/b8/5sosf0yx9z09n7b1sj5itm3ioo0h85r.png?",
           "https://patchwiki.biligame.com/images/borderlands3/b/b4/db8l126yefq2ne12ry8898goisa2cti.png?",
           "https://patchwiki.biligame.com/images/borderlands3/4/47/mfahbm99d018u32qsx0qg6282a9iw86.png?",
           "https://patchwiki.biligame.com/images/borderlands3/d/d0/0ip962jlqyiks2tsj8a5pr2xkmpp7mk.png?",
           "https://patchwiki.biligame.com/images/borderlands3/d/d5/gv0qgn93xiyr9hmm76itljw2gm2zwah.png?"

] }, hitman: { title: "Hitman", body: [ [5, 5, 5], [5, 1, 5], [0, 1, 0], [5, 0, 5], [0, 3, 0], [0, 1, 0], ], icon: [ "https://patchwiki.biligame.com/images/borderlands3/d/d8/k9uwmdy5y1t70jpeyilknijd9b2mp6u.png?", "https://patchwiki.biligame.com/images/borderlands3/9/9e/2y15av7u7hyjhqtq07l7rg43xr32hbg.png?",

           "https://patchwiki.biligame.com/images/borderlands3/d/d9/tk9xrjgw0liwc4uvidugori767j3ld0.png?",
           "https://patchwiki.biligame.com/images/borderlands3/9/96/s96ploa6tjs8dgfxds476z9vahy4wn2.png?",
           "https://patchwiki.biligame.com/images/borderlands3/2/2c/943z1qvympl50a1xy8e3wpc22oeg9at.png?",
           "https://patchwiki.biligame.com/images/borderlands3/2/21/hktre1n8mfqhzm2oeuxjo3ud7hvxbdb.png?",
           "https://patchwiki.biligame.com/images/borderlands3/9/9d/izsdng9p0zjhaue56yx5n8j73ilz24x.png?",
           "https://patchwiki.biligame.com/images/borderlands3/1/12/dvhzj0uqtrcr1lbxi6gp8xs3kmapmav.png?",
           "https://patchwiki.biligame.com/images/borderlands3/9/90/epxfr3hyoaej02o0n44ge2k2ho3zl4k.png?",
           "https://patchwiki.biligame.com/images/borderlands3/a/af/fhpk3lmcu4ide340m9bz4lu5ztclqzj.png?",
           "https://patchwiki.biligame.com/images/borderlands3/7/79/ag1yp2uodmv37j3un4uo09seyorbb6b.png?"

] }, doubleAgent: { title: "Double Agent", body: [ [5, 3, 5], [5, 1, 5], [0, 1, 0], [3, 1, 3], [3, 1, 3], [0, 1, 0], ], icon: [ "https://patchwiki.biligame.com/images/borderlands3/2/2e/ch6fptpqv3iuicahx36w7e52c4oeoqk.png?", "https://patchwiki.biligame.com/images/borderlands3/2/24/fw4tibwingfstxa8zzpyz91cqz29e75.png?",

           "https://patchwiki.biligame.com/images/borderlands3/7/7d/f2cocu93fog8o45ata0niuaxquqij1b.png?",
           "https://patchwiki.biligame.com/images/borderlands3/2/27/1upw4nqokvtikpkz10wapf52dg7xm1q.png?",
           "https://patchwiki.biligame.com/images/borderlands3/d/df/3ytyirvx8xivm8wie3em4hdg302s0qb.png?",
           "https://patchwiki.biligame.com/images/borderlands3/d/d6/dowg0ll7f8js18l9xp9ts9lg83lk3j5.png?",
           "https://patchwiki.biligame.com/images/borderlands3/1/1b/e13d5f1st997z1gcdrwki3wnqw5ibz4.png?",
           "https://patchwiki.biligame.com/images/borderlands3/9/94/c3zfz4fmjwd14l8nyxywpa1lv3cm7ga.png?",
           "https://patchwiki.biligame.com/images/borderlands3/a/a9/3zqa9f7n924eez5h78zr8xqn1861bgb.png?",
           "https://patchwiki.biligame.com/images/borderlands3/7/7b/7ose1dv0zro3ffwxek6t4drt2vu3u4u.png?",
           "https://patchwiki.biligame.com/images/borderlands3/0/0a/793655k488fnzhpghs85vhrzlextyyw.png?",
           "https://patchwiki.biligame.com/images/borderlands3/6/65/q2niy9aec3m4cvfgj5igf688w79ksn2.png?",
           "https://patchwiki.biligame.com/images/borderlands3/8/84/mcg1mzmn9w4rrcnks1nv8bvdnm5nmo6.png?",
           "https://patchwiki.biligame.com/images/borderlands3/a/ad/86m20glqqs0zuaqt0kq6ws0ff2ojmhm.png?"

] }, theProfessional: { title: "The Professional", body: [ [5, 3, 5], [5, 1, 5], [0, 1, 0], [5, 0, 5], [3, 0, 3], [0, 1, 0], ], icon: [ "https://patchwiki.biligame.com/images/borderlands3/7/71/5k3aep94aer6wnv2ye08gumysmi5tig.png?", "https://patchwiki.biligame.com/images/borderlands3/f/f4/9mwgrcnh5m5hcmzd82ovjuwdxh3iup8.png?",

           "https://patchwiki.biligame.com/images/borderlands3/a/a1/73pl9awiw21hs4fik2d8iq75tfrlfzk.png?",
           "https://patchwiki.biligame.com/images/borderlands3/7/73/icvu0wd48ublvnd2su88zsoeigs2i4t.png?",
           "https://patchwiki.biligame.com/images/borderlands3/1/12/sn2xuuj9we8too3dgh50bfbc9vadxsm.png?",
           "https://patchwiki.biligame.com/images/borderlands3/5/52/f2txe5v1gz3qj67wqa58jbypcovyc05.png?",
           "https://patchwiki.biligame.com/images/borderlands3/4/47/5o8jhcxwo9cqr5hhvi5f1pn0mnh6426.png?",
           "https://patchwiki.biligame.com/images/borderlands3/9/9c/41lck89upqizx0xo2n33jngo45isvjz.png?",
           "https://patchwiki.biligame.com/images/borderlands3/9/9d/pq0old3hkvoxh1ufo33lgr23jjmyvn6.png?",
           "https://patchwiki.biligame.com/images/borderlands3/d/d7/2uvjdhe0bdrclumfqsfm4yresgj0ezs.png?",
           "https://patchwiki.biligame.com/images/borderlands3/a/a2/hxyxdh6yikq3du11rzexoki5o0fa9df.png?",
           "https://patchwiki.biligame.com/images/borderlands3/9/95/j67emx6sf7l1vddxxcjuwwkm5xjfcan.png?"

] } } window.addEventListener("load", () => { $(() => { new SkillTreeCalculator("#SkillTreeCalculator") }) $(document).on("click", "#SkillTreeCalculator .icon:not(.locked) .ctrl [data-func]", function () { $(this).closest("#SkillTreeCalculator").data("STC")[$(this).data("func")]($(this).closest(".icon")) }) }) </script>