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" "Survivor"
} }
local listOfClassDisplayNames = {
"Blue (Guardian)",
"Purple (Mystic)",
"Grey (Neutral)",
"Green (Rogue)",
"Orange (Seeker)",
"Red (Survivor)"
}
local listOfSymbols = { local listOfSymbols = {
"Activate", "Activate",
"Engage", "Engage",
@ -193,7 +202,11 @@ end
function addContextMenu() function addContextMenu()
self.addContextMenuItem("Change color", function(playerColor) 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) end)
self.addContextMenuItem("Change 1st symbol", function(playerColor) self.addContextMenuItem("Change 1st symbol", function(playerColor)
@ -201,31 +214,30 @@ function addContextMenu()
Player[playerColor].showOptionsDialog("Choose symbol", listOfSymbols, symbolList[1], function(newSymbol) Player[playerColor].showOptionsDialog("Choose symbol", listOfSymbols, symbolList[1], function(newSymbol)
if newSymbol == "None" then if newSymbol == "None" then
if symbolList[2] then if symbolList[2] then
symbol = symbolList[2] updateSymbol(symbolList[2])
else else
printToColor("Need to have at least one symbol.", playerColor) printToColor("Need to have at least one symbol.", playerColor)
end end
else else
if symbolList[2] then if symbolList[2] then
symbol = newSymbol .. "/" .. symbolList[2] updateSymbol(newSymbol .. "/" .. symbolList[2])
else else
symbol = newSymbol updateSymbol(newSymbol)
end end
end end
updateDisplay()
end) end)
end) end)
self.addContextMenuItem("Change 2nd symbol", function(playerColor) self.addContextMenuItem("Change 2nd symbol", function(playerColor)
local symbolList = getSymbolList() local symbolList = getSymbolList()
Player[playerColor].showOptionsDialog("Choose 2nd symbol", listOfSymbols, symbolList[2] or symbolList[1], function(newSymbol) Player[playerColor].showOptionsDialog("Choose 2nd symbol", listOfSymbols, symbolList[2] or symbolList[1],
if newSymbol == "None" then function(newSymbol)
symbol = symbolList[1] if newSymbol == "None" then
else updateSymbol(symbolList[1])
symbol = symbolList[1] .. "/" .. newSymbol else
end updateSymbol(symbolList[1] .. "/" .. newSymbol)
updateDisplay() end
end) end)
end) end)
end end
@ -281,6 +293,15 @@ function onRandomize()
end end
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) function deepcopy(orig)
local copy local copy
if type(orig) == 'table' then if type(orig) == 'table' then