Merge pull request #733 from argonui/colored-broadcasts
Added coloring to player names in broadcasts
This commit is contained in:
commit
15db35dc98
@ -282,8 +282,7 @@ function removeOneUse(playerColor, hoveredObject)
|
||||
end
|
||||
end
|
||||
|
||||
local playerName = Player[playerColor].steam_name
|
||||
broadcastToAll(playerName .. " removed a token: " .. tokenName, playerColor)
|
||||
broadcastToAll(getColoredName(playerColor) .. " removed a token: " .. tokenName, playerColor)
|
||||
|
||||
local discardForMatColor = getColorToDiscardFor(hoveredObject, playerColor)
|
||||
playermatApi.discardListOfObjects(discardForMatColor, { targetObject })
|
||||
@ -404,12 +403,10 @@ function takeClueFromLocation(playerColor, hoveredObject)
|
||||
local clickableClues = optionPanelApi.getOptions()["useClueClickers"]
|
||||
|
||||
-- handling for calling this for a specific mat via hotkey
|
||||
local playerName, matColor, pos
|
||||
local matColor, pos
|
||||
if Player[playerColor] and Player[playerColor].seated then
|
||||
playerName = Player[playerColor].steam_name
|
||||
matColor = playermatApi.getMatColor(playerColor)
|
||||
else
|
||||
playerName = playerColor
|
||||
matColor = playerColor
|
||||
end
|
||||
|
||||
@ -431,9 +428,9 @@ function takeClueFromLocation(playerColor, hoveredObject)
|
||||
end
|
||||
|
||||
if cardName then
|
||||
broadcastToAll(playerName .. " took one clue from " .. cardName .. ".", "White")
|
||||
broadcastToAll(getColoredName(playerColor) .. " took one clue from " .. cardName .. ".", "White")
|
||||
else
|
||||
broadcastToAll(playerName .. " took one clue.", "White")
|
||||
broadcastToAll(getColoredName(playerColor) .. " took one clue.", "White")
|
||||
end
|
||||
|
||||
victoryDisplayApi.update()
|
||||
@ -472,3 +469,14 @@ function getFirstSeatedPlayer()
|
||||
return color
|
||||
end
|
||||
end
|
||||
|
||||
-- returns the colored steam name or color
|
||||
function getColoredName(playerColor)
|
||||
local displayName = playerColor
|
||||
if Player[playerColor].steam_name then
|
||||
displayName = Player[playerColor].steam_name
|
||||
end
|
||||
|
||||
-- add bb-code
|
||||
return "[" .. Color.fromString(playerColor):toHex() .. "]" .. displayName .. "[-]"
|
||||
end
|
||||
|
@ -577,9 +577,7 @@ function doDiscardOne()
|
||||
-- get a random non-hidden card (from the "choices" table)
|
||||
local num = math.random(1, #choices)
|
||||
deckLib.placeOrMergeIntoDeck(hand[choices[num]], returnGlobalDiscardPosition(), self.getRotation())
|
||||
|
||||
local playerName = Player[playerColor].steam_name or playerColor
|
||||
broadcastToAll(playerName .. " randomly discarded card " .. choices[num] .. "/" .. #hand .. ".", "White")
|
||||
broadcastToAll(getColoredName(playerColor) .. " randomly discarded card " .. choices[num] .. "/" .. #hand .. ".", "White")
|
||||
end
|
||||
end
|
||||
|
||||
@ -1246,3 +1244,14 @@ function updatePlayerCards(args)
|
||||
local playerCardData = customDataHelper.getTable("PLAYER_CARD_DATA")
|
||||
tokenManager.addPlayerCardData(playerCardData)
|
||||
end
|
||||
|
||||
-- returns the colored steam name or color
|
||||
function getColoredName(playerColor)
|
||||
local displayName = playerColor
|
||||
if Player[playerColor].steam_name then
|
||||
displayName = Player[playerColor].steam_name
|
||||
end
|
||||
|
||||
-- add bb-code
|
||||
return "[" .. Color.fromString(playerColor):toHex() .. "]" .. displayName .. "[-]"
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user