update display name for classes

This commit is contained in:
Chr1Z93 2024-06-05 20:14:28 +02:00
parent 1e3f193144
commit e8154292b9

View File

@ -9,6 +9,15 @@ local listOfClasses = {
"Survivor"
}
local listOfClassDisplayNames = {
"Blue (Guardian)",
"Purple (Mystic)",
"Grey (Neutral)",
"Green (Rogue)",
"Orange (Seeker)",
"Red (Survivor)"
}
local listOfSymbols = {
"Activate",
"Engage",
@ -193,7 +202,11 @@ end
function addContextMenu()
self.addContextMenuItem("Change color", function(playerColor)
Player[playerColor].showOptionsDialog("Choose color", listOfClasses, class, updateClass)
local currentClassDisplayName = listOfClassDisplayNames[getIndexOfValue(listOfClasses, class)]
Player[playerColor].showOptionsDialog("Choose color", listOfClassDisplayNames, currentClassDisplayName,
function(_, selectedIndex)
updateClass(listOfClasses[selectedIndex])
end)
end)
self.addContextMenuItem("Change 1st symbol", function(playerColor)
@ -201,31 +214,30 @@ function addContextMenu()
Player[playerColor].showOptionsDialog("Choose symbol", listOfSymbols, symbolList[1], function(newSymbol)
if newSymbol == "None" then
if symbolList[2] then
symbol = symbolList[2]
updateSymbol(symbolList[2])
else
printToColor("Need to have at least one symbol.", playerColor)
end
else
if symbolList[2] then
symbol = newSymbol .. "/" .. symbolList[2]
updateSymbol(newSymbol .. "/" .. symbolList[2])
else
symbol = newSymbol
updateSymbol(newSymbol)
end
end
updateDisplay()
end)
end)
self.addContextMenuItem("Change 2nd symbol", function(playerColor)
local symbolList = getSymbolList()
Player[playerColor].showOptionsDialog("Choose 2nd symbol", listOfSymbols, symbolList[2] or symbolList[1], function(newSymbol)
if newSymbol == "None" then
symbol = symbolList[1]
else
symbol = symbolList[1] .. "/" .. newSymbol
end
updateDisplay()
end)
Player[playerColor].showOptionsDialog("Choose 2nd symbol", listOfSymbols, symbolList[2] or symbolList[1],
function(newSymbol)
if newSymbol == "None" then
updateSymbol(symbolList[1])
else
updateSymbol(symbolList[1] .. "/" .. newSymbol)
end
end)
end)
end
@ -281,6 +293,15 @@ function onRandomize()
end
end
function getIndexOfValue(t, value)
for i, v in ipairs(t) do
if v == value then
return i
end
end
return nil
end
function deepcopy(orig)
local copy
if type(orig) == 'table' then