From 1971cbb681ea59719588d2dc44430ab37f6318e4 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Sun, 5 Mar 2023 03:39:35 +0100 Subject: [PATCH] custom color support for chaos stat tracker --- src/core/Global.ttslua | 12 ++++++------ src/playercards/CardsThatSealTokens.ttslua | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/core/Global.ttslua b/src/core/Global.ttslua index 1bb55cfa..8f557386 100644 --- a/src/core/Global.ttslua +++ b/src/core/Global.ttslua @@ -33,7 +33,7 @@ local chaosTokensLastMat = nil local IS_RESHUFFLING = false local bagSearchers = {} local hideTitleSplashWaitFunctionId = nil -local playmatAPI = require("playermat/PlaymatApi") +local playmatApi = require("playermat/playmatApi") local tokenManager = require("core/token/TokenManager") local playAreaAPI = require("core/PlayAreaApi") local tokenArrangerApi = require("accessories/TokenArrangerApi") @@ -52,6 +52,7 @@ TOKEN_DATA = { } ID_URL_MAP = { + ['blue'] = {name = "Elder Sign", url = 'https://i.imgur.com/nEmqjmj.png'}, ['p1'] = {name = "+1", url = 'https://i.imgur.com/uIx8jbY.png'}, ['0'] = {name = "0", url = 'https://i.imgur.com/btEtVfd.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'}, ['elder'] = {name = "Elder Thing", url = 'https://i.imgur.com/ttnspKt.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/'}, ['curse'] = {name = "Curse", url = 'http://cloud-3.steamusercontent.com/ugc/1655601092778636039/2A25BD38E8C44701D80DD96BF0121DA21843672E/'}, ['frost'] = {name = "Frost", url = 'http://cloud-3.steamusercontent.com/ugc/1858293462583104677/195F93C063A8881B805CE2FD4767A9718B27B6AE/'} @@ -348,7 +348,7 @@ function handleStatTrackerClick(_, _, isRightClick) playerColor = "White" playerName = "Overall" else - playerColor = MAT_GUID_TO_COLOR[key] + playerColor = playmatApi.getHandColor(MAT_GUID_TO_COLOR[key]) playerName = Player[playerColor].steam_name or playerColor local playerSquidCount = personalStats["Auto-fail"] or 0 @@ -811,17 +811,17 @@ end function applyOptionPanelChange(id, state) -- option: Snap tags if id == "useSnapTags" then - playmatAPI.setLimitSnapsByType(state, "All") + playmatApi.setLimitSnapsByType(state, "All") optionPanel[id] = state -- option: Draw 1 button elseif id == "showDrawButton" then - playmatAPI.showDrawButton(state, "All") + playmatApi.showDrawButton(state, "All") optionPanel[id] = state -- option: Clickable clue counters elseif id == "useClueClickers" then - playmatAPI.clickableClues(state, "All") + playmatApi.clickableClues(state, "All") optionPanel[id] = state -- update master clue counter diff --git a/src/playercards/CardsThatSealTokens.ttslua b/src/playercards/CardsThatSealTokens.ttslua index ab703653..b32598bc 100644 --- a/src/playercards/CardsThatSealTokens.ttslua +++ b/src/playercards/CardsThatSealTokens.ttslua @@ -90,6 +90,7 @@ end -- seals the named token on this card function sealToken(name, playerColor) + if not Global.call("canTouchChaosTokens") then return end local chaosbag = Global.call("findChaosBag") for i, obj in ipairs(chaosbag.getObjects()) do if obj.name == name then @@ -115,6 +116,7 @@ end -- release the last sealed token function releaseOneToken(playerColor) + if not Global.call("canTouchChaosTokens") then return end if sealedTokens == {} or #sealedTokens == 0 then printToColor("No sealed token(s) found", playerColor) else @@ -125,6 +127,7 @@ end -- releases all sealed tokens function releaseTokens(playerColor) + if not Global.call("canTouchChaosTokens") then return end if #sealedTokens == 0 then printToColor("No sealed token(s) found", playerColor) else