🌟 | 現在、 鉄壁ヘッドショットには対応済みです。 鉄壁HSは通常HSと同じダメージになります。LMG及びDMR、チャージライフル、ハンマーポイント弾を除き、すべてのダメージ値が一致していることを確認しています。 |
「モジュール:Utility/TableUtil/Apex」の版間の差分
ナビゲーションに移動
検索に移動
(ホップアップのリンクをなくすように設定) |
(関数renderの引数からdatainfoの削除) |
||
(同じ利用者による、間の2版が非表示) | |||
14行目: | 14行目: | ||
-- type: AmmoCell: Cell (UI) | -- type: AmmoCell: Cell (UI) | ||
-- ========================= | -- ========================= | ||
local __TableUtil__AmmoCell = tableutil.specifyUICell('ammo', function(that, row, dataset, i | local ammoValue = { | ||
light = 10, | |||
special_light = 19, | |||
heavy = 20, | |||
heavy_revved_up = 22, | |||
special_heavy = 29, | |||
energy = 30, | |||
special_energy = 39, | |||
shotgun = 40, | |||
special_shotgun = 49, | |||
sniper = 50, | |||
sniper_amped = 51, | |||
special_sniper = 59, | |||
arrows = 60, | |||
special_arrows = 69, | |||
minigun = 99, | |||
} | |||
local __TableUtil__AmmoCell = tableutil.specifyUICell('ammo', function(that, row, dataset, i) | |||
local value = dataset[that.dataIndex] | local value = dataset[that.dataIndex] | ||
local ammo = iu.ammo(value, { size = 20, link = '' }) | local ammo = iu.ammo(value, { size = 20, link = '' }) | ||
local cell = that:__cell__render(row, dataset, i, | local cell = that:__cell__render(row, dataset, i) | ||
:attr('data-sort-value', ammoValue[value]) | |||
:wikitext(ammo) | |||
return cell | return cell | ||
end) | end) | ||
26行目: | 45行目: | ||
-- =============================== | -- =============================== | ||
local getEmphasizableText = aw.getEmphasizableTextFunc('%s', '<span class="text-desktoponly">%s</span>', '<span class="text-desktoponly">%s</span>') | local getEmphasizableText = aw.getEmphasizableTextFunc('%s', '<span class="text-desktoponly">%s</span>', '<span class="text-desktoponly">%s</span>') | ||
local __TableUtil__WeaponNameCell = tableutil.specifyUICell('weaponname', function(that, row, dataset, i | local __TableUtil__WeaponNameCell = tableutil.specifyUICell('weaponname', function(that, row, dataset, i) | ||
local ammoclass = that.ammoIndex and dataset[that.ammoIndex] or 'light' | local ammoclass = that.ammoIndex and dataset[that.ammoIndex] or 'light' | ||
if aw.stringstarts(ammoclass, 'special_') then | if aw.stringstarts(ammoclass, 'special_') then | ||
48行目: | 67行目: | ||
end | end | ||
local cell = that:__cell__render(row, dataset, i | local cell = that:__cell__render(row, dataset, i):wikitext(text) | ||
return cell | return cell | ||
end, { 'ammoIndex', 'shortnameIndex', 'optionIndex' }) | end, { 'ammoIndex', 'shortnameIndex', 'optionIndex' }) | ||
56行目: | 75行目: | ||
-- type: MagazineCell: Cell (UI) | -- type: MagazineCell: Cell (UI) | ||
-- ============================= | -- ============================= | ||
local __TableUtil__MagazineCell = tableutil.specifyUICell('magazine', function(that, row, dataset, i | local __TableUtil__MagazineCell = tableutil.specifyUICell('magazine', function(that, row, dataset, i) | ||
local level = dataset[that.dataIndex] | local level = dataset[that.dataIndex] | ||
local ammo = that.ammoIndex and dataset[that.ammoIndex] or 'light' | local ammo = that.ammoIndex and dataset[that.ammoIndex] or 'light' | ||
local cell = that:__cell__render(row, dataset, i | local cell = that:__cell__render(row, dataset, i) | ||
if level >= 0 then | if level >= 0 then | ||
local text | local text | ||
98行目: | 117行目: | ||
-- type: HopupCell: Cell (UI) | -- type: HopupCell: Cell (UI) | ||
-- ========================== | -- ========================== | ||
local __TableUtil__HopupCell = tableutil.specifyUICell('hopup', function(that, row, dataset, i | local __TableUtil__HopupCell = tableutil.specifyUICell('hopup', function(that, row, dataset, i) | ||
local ids = dataset[that.dataIndex] | local ids = dataset[that.dataIndex] | ||
local cell = that:__cell__render(row, dataset, i | local cell = that:__cell__render(row, dataset, i) | ||
if type(ids) == 'table' then | if type(ids) == 'table' then | ||
local first = true | local first = true |
2021年8月30日 (月) 19:59時点における最新版
このモジュールについての説明文ページを モジュール: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') -- ===== -- Config -- ===== local desktopOnlyObj = { desktopOnly = true } local desktopOnlyAndNoLinkObj = { desktopOnly = true, link = '' } -- ========================= -- type: AmmoCell: Cell (UI) -- ========================= local ammoValue = { light = 10, special_light = 19, heavy = 20, heavy_revved_up = 22, special_heavy = 29, energy = 30, special_energy = 39, shotgun = 40, special_shotgun = 49, sniper = 50, sniper_amped = 51, special_sniper = 59, arrows = 60, special_arrows = 69, minigun = 99, } local __TableUtil__AmmoCell = tableutil.specifyUICell('ammo', function(that, row, dataset, i) local value = dataset[that.dataIndex] local ammo = iu.ammo(value, { size = 20, link = '' }) local cell = that:__cell__render(row, dataset, i) :attr('data-sort-value', ammoValue[value]) :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('weaponname', function(that, row, dataset, i) 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):wikitext(text) return cell end, { 'ammoIndex', 'shortnameIndex', 'optionIndex' }) tableutil.WeaponNameCell = __TableUtil__WeaponNameCell -- ============================= -- type: MagazineCell: Cell (UI) -- ============================= local __TableUtil__MagazineCell = tableutil.specifyUICell('magazine', function(that, row, dataset, i) local level = dataset[that.dataIndex] local ammo = that.ammoIndex and dataset[that.ammoIndex] or 'light' local cell = that:__cell__render(row, dataset, i) if level >= 0 then local text if ammo == 'arrows' then text = inu.gear('backpack', math.min(level, 5), desktopOnlyObj) elseif ammo == 'shotgun' then text = inu.bolt(math.min(level, 5), desktopOnlyObj) else text = inu.extmag(ammo, math.min(level, 5), desktopOnlyObj) end cell:attr('data-sort-value', level) :wikitext(text) end return cell end, { 'ammoIndex' }) tableutil.MagazineCell = __TableUtil__MagazineCell function tableutil.__TableUtil__MagazineCell__test() local metadata = { tableutil.MagazineCell.new('0', 'zero', { attributes = { align = 'left' }, ammoIndex = 'ammo' }), tableutil.MagazineCell.new('1', 1, { attributes = { align = 'left' }, ammoIndex = 'ammo' }), tableutil.MagazineCell.new('2', 2, { attributes = { align = 'left' }, ammoIndex = 'ammo' }), tableutil.MagazineCell.new('3', 3, { attributes = { align = 'left' }, ammoIndex = 'ammo' }), tableutil.MagazineCell.new('4', 4, { attributes = { align = 'left' }, ammoIndex = 'ammo' }), } local node = tableutil.createTable({ { zero = 0, 1, 2, 3, 4, ammo = 'light' }, { zero = 0, 1, 2, 3, 4, ammo = 'heavy' }, { zero = 0, 1, 2, 3, 4, ammo = 'energy' }, { zero = 0, 1, 2, 3, 4, ammo = 'sniper' }, { zero = 0, 1, 2, 3, 4, ammo = 'shotgun' }, { zero = 0, 1, 2, 3, 4, ammo = 'arrows' }, }, metadata) return tostring(node) end -- ========================== -- type: HopupCell: Cell (UI) -- ========================== local __TableUtil__HopupCell = tableutil.specifyUICell('hopup', function(that, row, dataset, i) local ids = dataset[that.dataIndex] local cell = that:__cell__render(row, dataset, i) 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 if id == 'modded_loader' then builder:append('[[File:Abilities_Passive_改造ローダー.png|16px|link=|alt=改造ローダー|class=image-rarity image-rarity-common image-rarity-size16]]<span class="text-rarity text-rarity-common text-desktoponly"> 改造ローダー</span>') else local hopup = inu.hopup(id, desktopOnlyAndNoLinkObj) builder:append(hopup) end first = false end cell:wikitext(tostring(builder)) end return cell end) tableutil.HopupCell = __TableUtil__HopupCell return tableutil