Module:ModuleGenerator: Difference between revisions

From The First Descendant Wiki
No edit summary
No edit summary
Line 3: Line 3:
function p.socketFileName(socket)
function p.socketFileName(socket)
local sockets = {
local sockets = {
almandine = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_004.png",
unknown = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_000.png",
cerulean = "",
cerulean = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_001.png",
malachite = "",
almandine = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_002.png",
rutile = "",
malachite = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_003.png",
xantic = "",
xantic = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_004.png",
rutile = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_005.png",
}
}
if contains(sockets, socket) == true then
if contains(sockets, socket) == true then
return sockets[socket]
return sockets[socket]
end
end
return "filler" --add unknown file?
return sockets[unknown]
end
end


Line 25: Line 26:
return rarities[rarity]
return rarities[rarity]
end
end
return "fff" --add unknown file?
return "fff" --default color
end
end


function p.weaponClassFileName(weaponClass)
function p.moduleClassFileName(moduleClass)
local weaponClasses = {
local moduleClasses = {
descendant ="https://tfd.wiki/File:Icon_RunesClass_Mini_0_Color.png",
general = "https://tfd.wiki/File:Icon_RunesClass_Mini_A_Color.png",
general = "https://tfd.wiki/File:Icon_RunesClass_Mini_A_Color.png",
special = "https://tfd.wiki/File:Icon_RunesClass_Mini_B_Color.png",
special = "https://tfd.wiki/File:Icon_RunesClass_Mini_B_Color.png",
Line 36: Line 38:
melee = "https://tfd.wiki/File:Icon_RunesClass_Mini_Melee_Color.png"
melee = "https://tfd.wiki/File:Icon_RunesClass_Mini_Melee_Color.png"
}
}
if contains(weaponClasses, weaponClass) == true then
if contains(moduleClasses, moduleClass) == true then
return weaponClasses[weaponClass]
return moduleClasses[moduleClass]
end
end
return weaponClasses[general] --add unknown file?
return moduleClasses[descendant]
end
end
function contains(table, key)
function contains(table, key)

Revision as of 09:39, 6 June 2024

Documentation for this module may be created at Module:ModuleGenerator/doc

local p = {}

function p.socketFileName(socket)
	local sockets = {
		unknown = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_000.png",
		cerulean = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_001.png",
		almandine = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_002.png",
		malachite = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_003.png",
		xantic = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_004.png",
		rutile = "https://tfd.wiki/File:Icon_RunesCapacity_Mini_005.png",
	}
	if contains(sockets, socket) == true then
		return sockets[socket]
	end
	return sockets[unknown]
end

function p.rarityColor(rarity)
	local rarities = {
		standard = "#319dff",
		rare = "#955bff",
		ultimate = "#ffbb4d",
		transcendent = "#ff7c70",
	}
	if contains(rarities, rarity) == true then
		return rarities[rarity]
	end
	return "fff" --default color
end

function p.moduleClassFileName(moduleClass)
	local moduleClasses = {
		descendant ="https://tfd.wiki/File:Icon_RunesClass_Mini_0_Color.png",
		general = "https://tfd.wiki/File:Icon_RunesClass_Mini_A_Color.png",
		special = "https://tfd.wiki/File:Icon_RunesClass_Mini_B_Color.png",
		impact = "https://tfd.wiki/File:Icon_RunesClass_Mini_C_Color.png",
		highpower = "https://tfd.wiki/File:Icon_RunesClass_Mini_D_Color.png",
		melee = "https://tfd.wiki/File:Icon_RunesClass_Mini_Melee_Color.png"
	}
	if contains(moduleClasses, moduleClass) == true then
		return moduleClasses[moduleClass]
	end
	return moduleClasses[descendant]
end
function contains(table, key)
	for _, value in pairs(table) do
		if value == key then
			return true
		end
	end
	return false
end

return p