custom color support for chaos stat tracker

This commit is contained in:
Chr1Z93 2023-03-05 03:39:35 +01:00
parent e8d77d35b0
commit 1971cbb681
2 changed files with 9 additions and 6 deletions

View File

@ -33,7 +33,7 @@ local chaosTokensLastMat = nil
local IS_RESHUFFLING = false local IS_RESHUFFLING = false
local bagSearchers = {} local bagSearchers = {}
local hideTitleSplashWaitFunctionId = nil local hideTitleSplashWaitFunctionId = nil
local playmatAPI = require("playermat/PlaymatApi") local playmatApi = require("playermat/playmatApi")
local tokenManager = require("core/token/TokenManager") local tokenManager = require("core/token/TokenManager")
local playAreaAPI = require("core/PlayAreaApi") local playAreaAPI = require("core/PlayAreaApi")
local tokenArrangerApi = require("accessories/TokenArrangerApi") local tokenArrangerApi = require("accessories/TokenArrangerApi")
@ -52,6 +52,7 @@ TOKEN_DATA = {
} }
ID_URL_MAP = { ID_URL_MAP = {
['blue'] = {name = "Elder Sign", url = 'https://i.imgur.com/nEmqjmj.png'},
['p1'] = {name = "+1", url = 'https://i.imgur.com/uIx8jbY.png'}, ['p1'] = {name = "+1", url = 'https://i.imgur.com/uIx8jbY.png'},
['0'] = {name = "0", url = 'https://i.imgur.com/btEtVfd.png'}, ['0'] = {name = "0", url = 'https://i.imgur.com/btEtVfd.png'},
['m1'] = {name = "-1", url = 'https://i.imgur.com/w3XbrCC.png'}, ['m1'] = {name = "-1", url = 'https://i.imgur.com/w3XbrCC.png'},
@ -67,7 +68,6 @@ ID_URL_MAP = {
['tablet'] = {name = "Tablet", url = 'https://i.imgur.com/1plY463.png'}, ['tablet'] = {name = "Tablet", url = 'https://i.imgur.com/1plY463.png'},
['elder'] = {name = "Elder Thing", url = 'https://i.imgur.com/ttnspKt.png'}, ['elder'] = {name = "Elder Thing", url = 'https://i.imgur.com/ttnspKt.png'},
['red'] = {name = "Auto-fail", url = 'https://i.imgur.com/lns4fhz.png'}, ['red'] = {name = "Auto-fail", url = 'https://i.imgur.com/lns4fhz.png'},
['blue'] = {name = "Elder Sign", url = 'https://i.imgur.com/nEmqjmj.png'},
['bless'] = {name = "Bless", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/'}, ['bless'] = {name = "Bless", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778627699/339FB716CB25CA6025C338F13AFDFD9AC6FA8356/'},
['curse'] = {name = "Curse", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/'}, ['curse'] = {name = "Curse", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/'},
['frost'] = {name = "Frost", url = 'http://cloud-3.steamusercontent.com/ugc/1858293462583104677/195F93C063A8881B805CE2FD4767A9718B27B6AE/'} ['frost'] = {name = "Frost", url = 'http://cloud-3.steamusercontent.com/ugc/1858293462583104677/195F93C063A8881B805CE2FD4767A9718B27B6AE/'}
@ -348,7 +348,7 @@ function handleStatTrackerClick(_, _, isRightClick)
playerColor = "White" playerColor = "White"
playerName = "Overall" playerName = "Overall"
else else
playerColor = MAT_GUID_TO_COLOR[key] playerColor = playmatApi.getHandColor(MAT_GUID_TO_COLOR[key])
playerName = Player[playerColor].steam_name or playerColor playerName = Player[playerColor].steam_name or playerColor
local playerSquidCount = personalStats["Auto-fail"] or 0 local playerSquidCount = personalStats["Auto-fail"] or 0
@ -811,17 +811,17 @@ end
function applyOptionPanelChange(id, state) function applyOptionPanelChange(id, state)
-- option: Snap tags -- option: Snap tags
if id == "useSnapTags" then if id == "useSnapTags" then
playmatAPI.setLimitSnapsByType(state, "All") playmatApi.setLimitSnapsByType(state, "All")
optionPanel[id] = state optionPanel[id] = state
-- option: Draw 1 button -- option: Draw 1 button
elseif id == "showDrawButton" then elseif id == "showDrawButton" then
playmatAPI.showDrawButton(state, "All") playmatApi.showDrawButton(state, "All")
optionPanel[id] = state optionPanel[id] = state
-- option: Clickable clue counters -- option: Clickable clue counters
elseif id == "useClueClickers" then elseif id == "useClueClickers" then
playmatAPI.clickableClues(state, "All") playmatApi.clickableClues(state, "All")
optionPanel[id] = state optionPanel[id] = state
-- update master clue counter -- update master clue counter

View File

@ -90,6 +90,7 @@ end
-- seals the named token on this card -- seals the named token on this card
function sealToken(name, playerColor) function sealToken(name, playerColor)
if not Global.call("canTouchChaosTokens") then return end
local chaosbag = Global.call("findChaosBag") local chaosbag = Global.call("findChaosBag")
for i, obj in ipairs(chaosbag.getObjects()) do for i, obj in ipairs(chaosbag.getObjects()) do
if obj.name == name then if obj.name == name then
@ -115,6 +116,7 @@ end
-- release the last sealed token -- release the last sealed token
function releaseOneToken(playerColor) function releaseOneToken(playerColor)
if not Global.call("canTouchChaosTokens") then return end
if sealedTokens == {} or #sealedTokens == 0 then if sealedTokens == {} or #sealedTokens == 0 then
printToColor("No sealed token(s) found", playerColor) printToColor("No sealed token(s) found", playerColor)
else else
@ -125,6 +127,7 @@ end
-- releases all sealed tokens -- releases all sealed tokens
function releaseTokens(playerColor) function releaseTokens(playerColor)
if not Global.call("canTouchChaosTokens") then return end
if #sealedTokens == 0 then if #sealedTokens == 0 then
printToColor("No sealed token(s) found", playerColor) printToColor("No sealed token(s) found", playerColor)
else else