From 9abcfc46e1817eb3e9320d550f0d0cc3370fe2e3 Mon Sep 17 00:00:00 2001 From: Chr1Z93 Date: Mon, 10 Apr 2023 11:06:05 +0200 Subject: [PATCH] resolving comments --- SCED.wiki | 1 + src/accessories/TokenArranger.ttslua | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) create mode 160000 SCED.wiki diff --git a/SCED.wiki b/SCED.wiki new file mode 160000 index 00000000..01065bfc --- /dev/null +++ b/SCED.wiki @@ -0,0 +1 @@ +Subproject commit 01065bfc202457c2c2edc4e8fa9a2385a4e3ecd5 diff --git a/src/accessories/TokenArranger.ttslua b/src/accessories/TokenArranger.ttslua index 7db71581..e167d79c 100644 --- a/src/accessories/TokenArranger.ttslua +++ b/src/accessories/TokenArranger.ttslua @@ -74,6 +74,8 @@ function onLoad(saveState) percentage = false else percentage = "basic" + broadcastToAll("Percentages are unreliable when using tokens that draw other tokens (bless or curse for example).", + "Yellow") end layout() end) @@ -83,8 +85,9 @@ function onLoad(saveState) percentage = "basic" else percentage = "cumulative" - broadcastToAll("Cumulative percentages are unreliable when using tokens that draw other tokens (bless or curse for example).", Color.Yellow) - end + end + broadcastToAll("Percentages are unreliable when using tokens that draw other tokens (bless or curse for example).", + "Yellow") layout() end) @@ -209,16 +212,12 @@ end -- order function for data sorting function tokenValueComparator(left, right) - if left.value > right.value then - return true - elseif right.value > left.value then - return false - elseif left.order < right.order then - return true - elseif right.order < left.order then - return false + if (left.value ~= right.value) then + return left.value > right.value + elseif left.order ~= right.order then + return left.order < right.order else - return left.token.getGUID() > right.token.getGUID() + return false end end @@ -358,6 +357,7 @@ function layout(_, _, isRightClick) tokenName = item.token.getName() -- set tokenName to false if it does not contain letters + -- tokenName is used by `createPercentageButton()` to determine the textcolor for percentages if string.match(tokenName, "%a") == nil then tokenName = false end