🌟 | 現在、 鉄壁ヘッドショットには対応済みです。 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:Utility/TableUtil/Apex」の版間の差分
ナビゲーションに移動
検索に移動
(ページの作成:「local aw = require('Module:Utility/Library') local iu = require('Module:Utility/Image') local tableutil = require('Module:Utility/TableUtil') -- ==========…」) |
(クラス HopupCell の追加) |
||
1行目: | 1行目: | ||
local aw | local aw = require('Module:Utility/Library') | ||
local iu | local iu = require('Module:Utility/Image') | ||
local tableutil = require('Module:Utility/TableUtil') | local inu = require('Module:Utility/ImageWithName') | ||
local StringBuilder = require('Module:Utility/StringBuilder') | |||
local tableutil = require('Module:Utility/TableUtil') | |||
-- ========================= | -- ========================= | ||
44行目: | 46行目: | ||
end, { 'ammoIndex', 'shortnameIndex', 'optionIndex' }) | end, { 'ammoIndex', 'shortnameIndex', 'optionIndex' }) | ||
tableutil.WeaponNameCell = __TableUtil__WeaponNameCell | tableutil.WeaponNameCell = __TableUtil__WeaponNameCell | ||
-- ========================== | |||
-- type: HopupCell: Cell (UI) | |||
-- ========================== | |||
local __TableUtil__HopupCell = tableutil.specifyUICell('hopup', function(that, row, dataset, i, datainfo) | |||
local ids = dataset[that.dataIndex] | |||
local cell = that:__cell__render(row, dataset, i, datainfo) | |||
if type(ids) == 'table' then | |||
local first = true | |||
local builder = StringBuilder.new() | |||
for _, id in ipairs(ids) do | |||
if not first then | |||
builder:append('<br>') | |||
end | |||
local hopup = inu.hopup(id, { desktopOnly = true }) | |||
builder:append(hopup) | |||
first = false | |||
end | |||
cell:wikitext(tostring(builder)) | |||
end | |||
return cell | |||
end) | |||
tableutil.HopupCell = __TableUtil__HopupCell | |||
return tableutil | return tableutil |
2021年8月17日 (火) 16:28時点における版
このモジュールについての説明文ページを モジュール:Utility/TableUtil/Apex/doc に作成できます
local aw = require('Module:Utility/Library') local iu = require('Module:Utility/Image') local inu = require('Module:Utility/ImageWithName') local StringBuilder = require('Module:Utility/StringBuilder') local tableutil = require('Module:Utility/TableUtil') -- ========================= -- type: AmmoCell: Cell (UI) -- ========================= local __TableUtil__AmmoCell = tableutil.specifyUICell('ammo', function(that, row, dataset, i, datainfo) local value = dataset[that.dataIndex] local ammo = iu.ammo(value, { size = 20, link = '' }) local cell = that:__cell__render(row, dataset, i, datainfo):wikitext(ammo) return cell end) tableutil.AmmoCell = __TableUtil__AmmoCell -- =============================== -- type: WeaponNameCell: Cell (UI) -- =============================== local getEmphasizableText = aw.getEmphasizableTextFunc('%s', '<span class="text-desktoponly">%s</span>', '<span class="text-desktoponly">%s</span>') local __TableUtil__WeaponNameCell = tableutil.specifyUICell('ammo', function(that, row, dataset, i, datainfo) local ammoclass = that.ammoIndex and dataset[that.ammoIndex] or 'light' if aw.stringstarts(ammoclass, 'special_') then ammoclass = 'special' end local fullname = dataset[that.dataIndex] local text if that.shortnameIndex then local shortname = dataset[that.shortnameIndex] local suitableName = getEmphasizableText(fullname, shortname) if that.optionIndex and dataset[that.optionIndex] then text = string.format('[[%s|<span class="text-ammo-%s">%s</span>]] (%s)', fullname, ammoclass, suitableName, dataset[that.optionIndex]) else text = string.format('[[%s|<span class="text-ammo-%s">%s</span>]]', fullname, ammoclass, suitableName) end elseif that.optionIndex and dataset[that.optionIndex] then text = string.format('[[%s|<span class="text-ammo-%s">%s</span>]] (%s)', fullname, ammoclass, fullname, dataset[that.optionIndex]) else text = string.format('[[%s|<span class="text-ammo-%s">%s</span>]]', fullname, ammoclass, fullname) end local cell = that:__cell__render(row, dataset, i, datainfo):wikitext(text) return cell end, { 'ammoIndex', 'shortnameIndex', 'optionIndex' }) tableutil.WeaponNameCell = __TableUtil__WeaponNameCell -- ========================== -- type: HopupCell: Cell (UI) -- ========================== local __TableUtil__HopupCell = tableutil.specifyUICell('hopup', function(that, row, dataset, i, datainfo) local ids = dataset[that.dataIndex] local cell = that:__cell__render(row, dataset, i, datainfo) if type(ids) == 'table' then local first = true local builder = StringBuilder.new() for _, id in ipairs(ids) do if not first then builder:append('<br>') end local hopup = inu.hopup(id, { desktopOnly = true }) builder:append(hopup) first = false end cell:wikitext(tostring(builder)) end return cell end) tableutil.HopupCell = __TableUtil__HopupCell return tableutil