Module:ModuleGenerator: Difference between revisions

From The First Descendant Wiki
No edit summary
No edit summary
Line 11: Line 11:
rutile = "https://tfd.wiki/images/2/24/Icon_RunesCapacity_Mini_005.png",
rutile = "https://tfd.wiki/images/2/24/Icon_RunesCapacity_Mini_005.png",
}
}
if p.contains(sockets, socket) == true then
--if contains(sockets, socket) == true then
return sockets[socket]
-- return sockets[socket]
end
--end
return sockets[unknown]
return sockets[unknown]
end
end
Line 25: Line 25:
transcendent = "#ff7c70",
transcendent = "#ff7c70",
}
}
if p.contains(rarities, rarity) == true then
if contains(rarities, rarity) == true then
return rarities[rarity]
return rarities[rarity]
end
end
Line 41: Line 41:
melee = "Icon_RunesClass_Mini_Melee_Color.png"
melee = "Icon_RunesClass_Mini_Melee_Color.png"
}
}
if p.contains(moduleClasses, moduleClass) == true then
if contains(moduleClasses, moduleClass) == true then
return moduleClasses[moduleClass]
return moduleClasses[moduleClass]
end
end
Line 54: Line 54:
}
}
if p.contains(specialSlots, specialSlot) == true then
if contains(specialSlots, specialSlot) == true then
return specialSlots[specialSlot]
return specialSlots[specialSlot]
end
end
Line 60: Line 60:
end
end


function p.contains(table, key)
function contains(table, key)
for _, value in pairs(table) do
for _, value in pairs(table) do
if value == key then
if value == key then

Revision as of 07:49, 7 June 2024

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

local p = {}

function p.socketFileName(frame)
	local socket = frame.args[1]
	local sockets = {
		unknown = "https://tfd.wiki/images/7/77/Icon_RunesCapacity_Mini_000.png",
		cerulean = "https://tfd.wiki/images/2/2e/Icon_RunesCapacity_Mini_001.png",
		almandine = "https://tfd.wiki/images/8/88/Icon_RunesCapacity_Mini_002.png",
		malachite = "https://tfd.wiki/images/6/69/Icon_RunesCapacity_Mini_003.png",
		xantic = "https://tfd.wiki/images/6/6d/Icon_RunesCapacity_Mini_004.png",
		rutile = "https://tfd.wiki/images/2/24/Icon_RunesCapacity_Mini_005.png",
	}
	--if contains(sockets, socket) == true then
	--	return sockets[socket]
	--end
	return sockets[unknown]
end

function p.rarityColor(frame)
	local rarity = frame.args[1]
	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(frame)
	local moduleClass = frame.args[1]
	local moduleClasses = {
		descendant ="Icon_RunesClass_Mini_0_Color.png",
		general = "Icon_RunesClass_Mini_A_Color.png",
		special = "Icon_RunesClass_Mini_B_Color.png",
		impact = "Icon_RunesClass_Mini_C_Color.png",
		highpower = "Icon_RunesClass_Mini_D_Color.png",
		melee = "Icon_RunesClass_Mini_Melee_Color.png"
	}
	if contains(moduleClasses, moduleClass) == true then
		return moduleClasses[moduleClass]
	end
	return moduleClasses[descendant]
end

function p.specialSlotFileName(frame)
	local specialSlot = frame.args[1]
	local specialSlots = {
		skill="UI_RuneSlot_ChaBG02_Mini.png",
		tab="UI_RuneSlot_ChaBG01_Mini.png"
	}
	
	if contains(specialSlots, specialSlot) == true then
		return specialSlots[specialSlot]
	end
	return ""
end

function contains(table, key)
	for _, value in pairs(table) do
		if value == key then
			return true
		end
	end
	return false
end

return p