ARK: Survival Evolved Wiki
探索
メインページ
全ページ
インタラクティブな地図
navigation
メインページ
コミュニティ・ポータル
最近の更新
おまかせ表示
Admin noticeboard
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
FANDOM
ゲーム
映画
テレビ
Wiki
Wikiを探索
コミュニティセントラル
Wikiを はじめよう
アカウントをお持ちでない場合
登録
ログイン
FANDOM
Explore
Current Wiki
Wikiを はじめよう
アカウントをお持ちでない場合
登録
ログイン
ログイン
登録
ARK: Survival Evolved Wiki
2,858
ページ
探索
メインページ
全ページ
インタラクティブな地図
navigation
メインページ
コミュニティ・ポータル
最近の更新
おまかせ表示
Admin noticeboard
Gamepedia
Gamepedia support
Report a bad ad
Help Wiki
Contact us
「
モジュール:ResourceBreakdown
」を編集中
ページに戻る
ソースを編集
履歴表示
トーク(0件)
ページの編集
モジュール:ResourceBreakdown
警告:
ログインしていません。編集を行うと、あなたの IP アドレスが公開されます。
ログイン
または
アカウントを作成
すれば、あなたの編集はその利用者名とともに表示されるほか、その他の利点もあります。
スパム攻撃防止用のチェックです。 けっして、ここには、値の入力は
しない
でください!
local p = {} function p.breakdownList( f ) local dlclink = require('Module:DLCLink').link local args = f:getParent().args local resourceList = {} local baseResources = {} local showBaseIngredients, collapsibleIngredients, collapsibleBaseIngredients = true, false, false local printCategories, categories = false, {} local noDlcIcon = args.noDlcIcon or false if noDlcIcon and ( noDlcIcon == '' or noDlcIcon == 0) then -- lua evaluates anything to true except nil and false noDlcIcon = false end if args.showBaseIngredients ~= nil and args.showBaseIngredients == 'false' then showBaseIngredients = false end if args.collapsibleIngredients ~= nil and args.collapsibleIngredients == 'true' then collapsibleIngredients = true end if args.collapsibleBaseIngredients ~= nil and args.collapsibleBaseIngredients == 'true' then collapsibleBaseIngredients = true end if args.printCategories ~= nil and args.printCategories == 'true' then printCategories = true end local count, collapsibleId = 1, 1 for _,res in ipairs(args) do res = mw.text.trim(res) if string.len(res) > 0 then if tonumber(res) ~= nil then count = tonumber(res) else local returnTable = p.breakdown(res,count,0,collapsibleIngredients,collapsibleId,noDlcIcon) collapsibleId = returnTable[3] table.insert(resourceList,returnTable[1]) -- insert base resources for bres,bcnt in pairs(returnTable[2]) do if baseResources[bres] == nil then baseResources[bres] = 0 end -- add count to baseresource baseResources[bres] = baseResources[bres] + bcnt end -- set resource count default to 1 (if no number is given) count = 1 if printCategories then table.insert(categories,'[[Category:Crafted with '..res..']]') end end end end local baseResourcesList, baseResourcesDiv, roundedCnt = {}, '', '' if showBaseIngredients then for bres,bcnt in pairs(baseResources) do roundedCnt = math.ceil(bcnt) if roundedCnt ~= bcnt then roundedCnt = '<span class="hover-text" title="'..bcnt..' to be precise">'..roundedCnt..'</span>' end table.insert(baseResourcesList,roundedCnt..' × || [[File:'..string.gsub(string.gsub(bres, '[:/]', ' '), '+', '-')..'.png|30px|link='..bres..']] '..dlclink(bres,noDlcIcon)) end local collapsibleBaseClassH, collapsibleBaseClassC = '','' if collapsibleBaseIngredients then collapsibleBaseClassH,collapsibleBaseClassC = ' class="mw-collapsible mw-collapsed"', ' class="mw-collapsible-content"' end baseResourcesDiv = '<div style="display:inline-block;margin:0.2em 0.2em 0;vertical-align:top;text-align:left"'..collapsibleBaseClassH..'>\'\'\'ベースとなる成分の合計\'\'\'<div'..collapsibleBaseClassC..'>\n{|\n|-\n| align="right" | '..table.concat(baseResourcesList,'\n|-\n| align="right" | ')..'\n|}\n</div></div>' end local collapsibleButton = '' if collapsibleIngredients then if collapsibleId > 1 then local collapsibles = {} for i=1,(collapsibleId-1) do table.insert(collapsibles,'mw-customtoggle-res'..i) end collapsibleButton = ' <span class="'..table.concat(collapsibles,' ')..'">[<span style="cursor:pointer;" class="pseudo-link">Expand</span>]</span>' else -- base resources are the same as displayed resources, so don't show them additionally baseResourcesDiv = '' end end if collapsibleIngredients and collapsibleButton == '' then return '<div style="display:inline-block;margin:0.2em 1em 0.2em 0;vertical-align:top;text-align:left">'..table.concat(resourceList,'\n')..'</div>'..baseResourcesDiv..table.concat(categories) else return '<div style="display:inline-block;margin:0.2em 1em 0.2em 0;vertical-align:top;text-align:left">\'\'\'資源の内訳\'\'\''..collapsibleButton..'\n\n'..table.concat(resourceList,'\n')..'</div>'..baseResourcesDiv..table.concat(categories) end end function p.breakdown(resource,count,indent,collapsible,collapsibleId,noDlcIcon) local dlclink = require('Module:DLCLink').link local breakdowns = mw.loadData( 'Module:ResourceBreakdown/breakdowns' ) local baseResources = {} local recursiveReturned = {} local style, fontweight = '', '' local collapsibleClass = '' local iconsize = '20' if indent > 0 then style = 'border-left:1px solid grey;margin-left:1.6em;' if collapsible and indent == 1 then collapsibleClass = ' class="mw-collapsible mw-collapsed" id="mw-customcollapsible-res'..collapsibleId..'"' collapsibleId = collapsibleId+1 end else fontweight = '\'\'\'' iconsize = '25' end local roundedCnt = math.ceil(count) if roundedCnt ~= count then roundedCnt = '<span class="hover-text" title="'..count..' to be precise">'..roundedCnt..'</span>' end local resourceBreakdown = {'<div style="'..style..'padding-left:5px"'..collapsibleClass..'>'..fontweight..roundedCnt..' × [[File:'..string.gsub(string.gsub(string.gsub(string.gsub(resource, '[:/]', ' '), '+', '-'), 'Kibble %(Dodo Egg%)', 'Kibble %(Mobile%)'), 'Kibble %(Dilo Egg%)', 'Kibble %(Mobile%)')..'.png|'..iconsize..'px|link='..resource..']] '..dlclink(resource,noDlcIcon)..fontweight} -- if resource is combined, list components if breakdowns[resource] ~= nil then for res,cnt in pairs(breakdowns[resource]) do recursiveReturned = p.breakdown(res,cnt*count,indent+1,collapsible,collapsibleId,noDlcIcon) collapsibleId = recursiveReturned[3] table.insert(resourceBreakdown,recursiveReturned[1]) -- insert base resources for bres,bcnt in pairs(recursiveReturned[2]) do if baseResources[bres] == nil then baseResources[bres] = 0 end -- add count to baseresource baseResources[bres] = baseResources[bres] + bcnt end end else -- no breakdown-data found, assuming it's a base resource, add it to basecount if baseResources[resource] == nil then baseResources[resource] = 0 end -- add count to baseresource baseResources[resource] = baseResources[resource] + count end return {table.concat(resourceBreakdown,'\n')..'</div>',baseResources,collapsibleId} end return p
編集内容の要約:
ARK: Survival Evolved Wikiへの投稿はすべて、「CC BY-NC-SA」に従って公開されるものとしてみなされます
編集を中止
編集の仕方
(新しいウィンドウで開きます)
このページで使用されているテンプレート:
モジュール:ResourceBreakdown/doc
(
編集
)
Follow on IG
TikTok
Join Fan Lab