Module:Sandbox: Difference between revisions

MDFW - The Mystery Dungeon Tree of Information.
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
 
(70 intermediate revisions by 4 users not shown)
Line 1: Line 1:
----------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
--
--                                       Module:Sandbox
-- Module:Explorers TD Dungeon Traps table
--
--
-- Here you can set anything you want in this sandbox, as long as it uses the language Lua.
--------------------------------------------------------------------------------
-- Do not forget to add {{#invoke:Sandbox|<function name>}} in your template.
-- [[Category:Sandbox]]
----------------------------------------------------------------------------------------------------


p = {}
local p = {}
local mw = require('mw')


function p.pokemonDataCell(f)
function p.main(frame)
local args = f.args
local data = require("Module:Explorers TD Trap Data Cell")
local types = {
local metatable = {__index = function () return "" end}
"Normal", "Fighting", "Flying", "Poison", "Ground", "Rock", "Bug", "Ghost", "Steel", "Fire", "Water", "Grass", "Electric", "Psychic", "Ice", "Dragon", "Dark"
setmetatable(data, metatable)
}
local args = frame.args
if args.gen == 6 then
 
table.insert(types, 18, "Fairy")
local output = mw.html.create()
local header = mw.html.create()
 
-- Header row
header
:tag('tr')
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext("Sprite"):done()
:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "ExplorersTD", args = {"Trap"}}):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext("Floors"):done()
:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext(frame:expandTemplate{title = "Tt", args = {'Found in', 'Which version it is found.'}}):done()
:tag('tr')
:tag('th'):cssText("width: 20%"):wikitext("English"):done()
:tag('th'):cssText("width: 20%"):wikitext("Japanese"):done()
 
-- Data rows
local rows = mw.html.create()
local i = 1
 
while true do
local row = mw.html.create()
local trapArg = args["trap_" .. i]
local floorsArg = args["floors_" .. i]
local versionArg = args["version_" .. i]
 
if not trapArg and not floorsArg and not versionArg then
break -- exit loop when no more rows are found
end
 
local verColor = ""
 
if string.lower(versionArg) == "darkness" then
verColor = 'background-color: #ef1d26'
elseif string.lower(versionArg) == "time" then
verColor = 'background-color: #1496d4'
end
 
row
:tag("tr"):done()
:tag("th"):wikitext(frame:expandTemplate{title = "ExplorersTDSprite", args = {(trapArg or ""), size = "50x50px"}}):done()
:tag("td"):wikitext(frame:expandTemplate{title = "ExplorersTD", args = {(trapArg or "")}}):done()
:tag("td"):wikitext(data[trapArg]["ja"]):done()
:tag("td"):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done()
 
if versionArg == nil or versionArg == '' or string.lower(versionArg) == "false" or string.lower(versionArg) == "no" then
row
:tag('td'):wikitext("Both"):done()
else
row
:tag('td'):cssText(verColor):wikitext(versionArg):done()
end
 
rows
:node(row)
:allDone()
 
i = i + 1
end
end
local list = {
 
["Bulbasaur"] = { ["ja"] = "フシギダネ", ["type1"] = types[12], ["type2"] = types[4] },
output
["Ivysaur"] = { ["ja"] = "フシギソウ", ["type1"] = types[12], ["type2"] = types[4] },
:tag('table'):addClass("wikitable"):cssText("text-align: center; margin: auto; width: 50%;")
["Venusaur"] = { ["ja"] = "フシギバナ", ["type1"] = types[12], ["type2"] = types[4] },
:node(header)
["Charmander"] = { ["ja"] = "ヒトカゲ" },
:node(rows)
["Charmeleon"] = { ["ja"] = "リザード" },
return tostring(output)
["Charizard"] = { ["ja"] = "リザードン" },
 
["Squirtle"] = { ["ja"] = "ゼニガメ" },
["Wartortle"] = { ["ja"] = "カメール" },
["Blastoise"] = { ["ja"] = "カメックス" },
["Caterpie"] = { ["ja"] = "キャタピー" },
["Metapod"] = { ["ja"] = "トランセル" },
["Butterfree"] = { ["ja"] = "バタフリー" },
["Weedle"] = { ["ja"] = "ビードル" },
["Kakuna"] = { ["ja"] = "コクーン" },
["Beedrill"] = { ["ja"] = "スピアー" },
["Pidgey"] = { ["ja"] = "ポッポ" },
["Pidgeotto"] = { ["ja"] = "ピジョン" },
["Pidgeot"] = { ["ja"] = "ピジョット" },
["Rattata"] = { ["ja"] = "コラッタ" },
["Raticate"] = { ["ja"] = "ラッタ" },
["Spearow"] = { ["ja"] = "オニスズメ" },
["Fearow"] = { ["ja"] = "オニドリル" },
["Ekans"] = { ["ja"] = "アーボ" },
["Arbok"] = { ["ja"] = "アーボック" },
["Pikachu"] = { ["ja"] = "ピカチュウ" },
["Raichu"] = { ["ja"] = "ライチュウ" },
["Sandshrew"] = { ["ja"] = "サンド" },
["Sandslash"] = { ["ja"] = "サンドパン" },
["Nidoran F"] = { ["ja"] = "ニドラン" },
["Nidorina"] = { ["ja"] = "ニドリーナ" },
["Nidoqueen"] = { ["ja"] = "ニドクイン" },
["Nidoran M"] = { ["ja"] = "ニドラン" },
["Nidorino"] = { ["ja"] = "ニドリーノ" },
["Nidoking"] = { ["ja"] = "ニドキング" },
["Clefairy"] = { ["ja"] = "ピッピ" },
["Clefable"] = { ["ja"] = "ピクシー" },
["Vulpix"] = { ["ja"] = "ロコン" },
["Ninetales"] = { ["ja"] = "キュウコン" },
["Jigglypuff"] = { ["ja"] = "プリン" },
["Wigglytuff"] = { ["ja"] = "プクリン" },
["Zubat"] = { ["ja"] = "ズバット" },
["Golbat"] = { ["ja"] = "ゴルバット" },
["Oddish"] = { ["ja"] = "ナゾノクサ" },
["Gloom"] = { ["ja"] = "クサイハナ" },
["Vileplume"] = { ["ja"] = "ラフレシア" },
["Paras"] = { ["ja"] = "パラス" },
["Parasect"] = { ["ja"] = "パラセクト" },
["Venonat"] = { ["ja"] = "コンパン" },
["Venomoth"] = { ["ja"] = "モルフォン" },
["Diglett"] = { ["ja"] = "ディグダ" },
["Dugtrio"] = { ["ja"] = "ダグトリオ" },
["Meowth"] = { ["ja"] = "ニャース" },
["Persian"] = { ["ja"] = "ペルシアン" },
["Psyduck"] = { ["ja"] = "コダック" },
["Golduck"] = { ["ja"] = "ゴルダック" },
["Mankey"] = { ["ja"] = "マンキー" },
["Primeape"] = { ["ja"] = "オコリザル" },
["Growlithe"] = { ["ja"] = "ガーディ" },
["Arcanine"] = { ["ja"] = "ウインディ" },
["Poliwag"] = { ["ja"] = "ニョロモ" },
["Poliwhirl"] = { ["ja"] = "ニョロゾ" },
["Poliwrath"] = { ["ja"] = "ニョロボン" },
["Abra"] = { ["ja"] = "ケーシィ" },
["Kadabra"] = { ["ja"] = "ユンゲラー" },
["Alakazam"] = { ["ja"] = "フーディン" },
["Machop"] = { ["ja"] = "ワンリキー" },
["Machoke"] = { ["ja"] = "ゴーリキー" },
["Machamp"] = { ["ja"] = "カイリキー" },
["Bellsprout"] = { ["ja"] = "マダツボミ" },
["Weepinbell"] = { ["ja"] = "ウツドン" },
["Victreebel"] = { ["ja"] = "ウツボット" },
["Tentacool"] = { ["ja"] = "メノクラゲ" },
["Tentacruel"] = { ["ja"] = "ドククラゲ" },
["Geodude"] = { ["ja"] = "イシツブテ" },
["Graveler"] = { ["ja"] = "ゴローン" },
["Golem"] = { ["ja"] = "ゴローニャ" },
["Ponyta"] = { ["ja"] = "ポニータ" },
["Rapidash"] = { ["ja"] = "ギャロップ" },
["Slowpoke"] = { ["ja"] = "ヤドン" },
["Slowbro"] = { ["ja"] = "ヤドラン" },
["Magnemite"] = { ["ja"] = "コイル" },
["Magneton"] = { ["ja"] = "レアコイル" },
["Farfetch'd"] = { ["ja"] = "カモネギ" },
["Doduo"] = { ["ja"] = "ドードー" },
["Dodrio"] = { ["ja"] = "ドードリオ" },
["Seel"] = { ["ja"] = "パウワウ" },
["Dewgong"] = { ["ja"] = "ジュゴン" },
["Grimer"] = { ["ja"] = "ベトベター" },
["Muk"] = { ["ja"] = "ベトベトン" },
["Shellder"] = { ["ja"] = "シェルダー" },
["Cloyster"] = { ["ja"] = "パルシェン" },
["Gastly"] = { ["ja"] = "ゴース" },
["Haunter"] = { ["ja"] = "ゴースト" },
["Gengar"] = { ["ja"] = "ゲンガー" },
["Onix"] = { ["ja"] = "イワーク" },
["Drowzee"] = { ["ja"] = "スリープ" },
["Hypno"] = { ["ja"] = "スリーパー" },
["Krabby"] = { ["ja"] = "クラブ" },
["Kingler"] = { ["ja"] = "キングラー" },
["Voltorb"] = { ["ja"] = "ビリリダマ" },
["Electrode"] = { ["ja"] = "マルマイン" },
["Exeggcute"] = { ["ja"] = "タマタマ" },
["Exeggutor"] = { ["ja"] = "ナッシー" },
["Cubone"] = { ["ja"] = "カラカラ" },
["Marowak"] = { ["ja"] = "ガラガラ" },
["Hitmonlee"] = { ["ja"] = "サワムラー" },
["Hitmonchan"] = { ["ja"] = "エビワラー" },
["Lickitung"] = { ["ja"] = "ベロリンガ" },
["Koffing"] = { ["ja"] = "ドガース" },
["Weezing"] = { ["ja"] = "マタドガス" },
["Rhyhorn"] = { ["ja"] = "サイホーン" },
["Rhydon"] = { ["ja"] = "サイドン" },
["Chansey"] = { ["ja"] = "ラッキー" },
["Tangela"] = { ["ja"] = "モンジャラ" },
["Kangaskhan"] = { ["ja"] = "ガルーラ" },
["Horsea"] = { ["ja"] = "タッツー" },
["Seadra"] = { ["ja"] = "シードラ" },
["Goldeen"] = { ["ja"] = "トサキント" },
["Seaking"] = { ["ja"] = "アズマオウ" },
["Staryu"] = { ["ja"] = "ヒトデマン" },
["Starmie"] = { ["ja"] = "スターミー" },
["Mr. Mime"] = { ["ja"] = "バリヤード" },
["Scyther"] = { ["ja"] = "ストライク" },
["Jynx"] = { ["ja"] = "ルージュラ" },
["Electabuzz"] = { ["ja"] = "エレブー" },
["Magmar"] = { ["ja"] = "ブーバー" },
["Pinsir"] = { ["ja"] = "カイロス" },
["Tauros"] = { ["ja"] = "ケンタロス" },
["Magikarp"] = { ["ja"] = "コイキング" },
["Gyarados"] = { ["ja"] = "ギャラドス" },
["Lapras"] = { ["ja"] = "ラプラス" },
["Ditto"] = { ["ja"] = "メタモン" },
["Eevee"] = { ["ja"] = "イーブイ" },
["Vaporeon"] = { ["ja"] = "シャワーズ" },
["Jolteon"] = { ["ja"] = "サンダース" },
["Flareon"] = { ["ja"] = "ブースター" },
["Porygon"] = { ["ja"] = "ポリゴン" },
["Omanyte"] = { ["ja"] = "オムナイト" },
["Omastar"] = { ["ja"] = "オムスター" },
["Kabuto"] = { ["ja"] = "カブト" },
["Kabutops"] = { ["ja"] = "カブトプス" },
["Aerodactyl"] = { ["ja"] = "プテラ" },
["Snorlax"] = { ["ja"] = "カビゴン" },
["Articuno"] = { ["ja"] = "フリーザー" },
["Zapdos"] = { ["ja"] = "サンダー" },
["Moltres"] = { ["ja"] = "ファイヤー" },
["Dratini"] = { ["ja"] = "ミニリュウ" },
["Dragonair"] = { ["ja"] = "ハクリュー" },
["Dragonite"] = { ["ja"] = "カイリュー" },
["Mewtwo"] = { ["ja"] = "ミュウツー" },
["Mew"] = { ["ja"] = "ミュウ" }
}
return list[args.name][args.getVar]
end
end


return p
return p

Latest revision as of 09:15, 26 January 2025



--------------------------------------------------------------------------------
--
--					Module:Explorers TD Dungeon Traps table
--
--------------------------------------------------------------------------------

local p = {}
local mw = require('mw')

function p.main(frame)
	local data = require("Module:Explorers TD Trap Data Cell")
	local metatable = {__index = function () return "" end}
	setmetatable(data, metatable)
	local args = frame.args

	local output = mw.html.create()
	local header = mw.html.create()

	-- Header row
	header
		:tag('tr')
			:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext("Sprite"):done()
			:tag('th'):attr("colspan", "2"):wikitext(frame:expandTemplate{title = "ExplorersTD", args = {"Trap"}}):done()
			:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext("Floors"):done()
			:tag('th'):attr("rowspan", "2"):cssText("width: 20%"):wikitext(frame:expandTemplate{title = "Tt", args = {'Found in', 'Which version it is found.'}}):done()
		:tag('tr')
			:tag('th'):cssText("width: 20%"):wikitext("English"):done()
			:tag('th'):cssText("width: 20%"):wikitext("Japanese"):done()

	-- Data rows
	local rows = mw.html.create()
	local i = 1

	while true do
		local row = mw.html.create()
		local trapArg = args["trap_" .. i]
		local floorsArg = args["floors_" .. i]
		local versionArg = args["version_" .. i]

		if not trapArg and not floorsArg and not versionArg then
			break -- exit loop when no more rows are found
		end

		local verColor = ""

		if string.lower(versionArg) == "darkness" then
			verColor = 'background-color: #ef1d26'
		elseif string.lower(versionArg) == "time" then
			verColor = 'background-color: #1496d4'
		end

		row
			:tag("tr"):done()
				:tag("th"):wikitext(frame:expandTemplate{title = "ExplorersTDSprite", args = {(trapArg or ""), size = "50x50px"}}):done()
				:tag("td"):wikitext(frame:expandTemplate{title = "ExplorersTD", args = {(trapArg or "")}}):done()
				:tag("td"):wikitext(data[trapArg]["ja"]):done()
				:tag("td"):wikitext(floorsArg or frame:expandTemplate{title = "Research"}):done()

		if versionArg == nil or versionArg == '' or string.lower(versionArg) == "false" or string.lower(versionArg) == "no" then
			row
				:tag('td'):wikitext("Both"):done()
		else
			row
				:tag('td'):cssText(verColor):wikitext(versionArg):done()
		end

		rows
			:node(row)
			:allDone()

		i = i + 1
	end

	output
		:tag('table'):addClass("wikitable"):cssText("text-align: center; margin: auto; width: 50%;")
			:node(header)
			:node(rows)
	return tostring(output)

end

return p