From acae5a203766a1af590820c27d68845f4ca604fb Mon Sep 17 00:00:00 2001 From: James Smith Date: Sat, 7 Sep 2024 20:33:58 -0500 Subject: [PATCH 1/2] Add a "Muted" status icon for players listed in a lobby. This patch allows Chobby to understand BarManager updates which include a "mutes" section, and to display a status icon next to players who are referenced in that section (when they are in the lobby). A corresponding patch to BarManager is required, so that it actually includes a "mutes" section in its updates. If BarManager has not been updated, then this patch will have no visible effect. --- LuaMenu/widgets/api_user_handler.lua | 13 ++++++++++++- .../widgets/chobby/components/configuration.lua | 1 + libs/liblobby/lobby/lobby.lua | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/LuaMenu/widgets/api_user_handler.lua b/LuaMenu/widgets/api_user_handler.lua index 0e0bf3d4a..c56255c66 100644 --- a/LuaMenu/widgets/api_user_handler.lua +++ b/LuaMenu/widgets/api_user_handler.lua @@ -89,6 +89,8 @@ local IMAGE_ONLINE = IMAGE_DIR .. "online.png" local IMAGE_OFFLINE = IMAGE_DIR .. "offline.png" local IMAGE_BOSS = IMAGE_DIR .. "boss-icon.png" local IMAGE_RUNNING_BATTLE = IMAGE_DIR .. "runningBattle.png" +local IMAGE_MUTED = IMAGE_DIR .. "ignored.png" + local IMAGE_CLAN_PATH = "LuaUI/Configs/Clans/" local RANK_DIR = LUA_DIRNAME .. "configs/gameConfig/zk/rankImages/" @@ -290,12 +292,17 @@ end local function GetUserStatusImages(userName, isInBattle, userControl) local userInfo = userControl.replayUserInfo or userControl.lobby:GetUser(userName) or {} + local battleStatus = userControl.lobby:GetUserBattleStatus(userName) or {} local images = {} if userInfo.pendingPartyInvite and not userControl.hideStatusInvite then images[#images + 1] = IMAGE_PARTY_INVITE end + if isInBattle and battleStatus.isMuted then + images[#images + 1] = IMAGE_MUTED + end + if isInBattle and userControl.isBoss then images[#images + 1] = IMAGE_BOSS end @@ -614,7 +621,10 @@ local function UpdateUserBattleStatus(listener, userName, battleStatusDiff) local bs = userControls.lobby:GetUserBattleStatus(userName) or {} userControls.isPlaying = bs.isSpectator == false userControls.isBoss = bs.isBoss or false - + userControls.isMuted = bs.isMuted or false + + UpdateUserActivity(_, userName, {}) + local offset = 0 if userControls.tbQueuePos then userControls.isInQueue = bs.queuePos and bs.queuePos > 0 or false @@ -889,6 +899,7 @@ local function GetUserControls(userName, opts) userControls.isPlaying = bs.isSpectator == false userControls.isInQueue = bs.queuePos and bs.queuePos > 0 or false userControls.isBoss = bs.isBoss or false + userControls.isMuted = bs.isMuted or false if reinitialize then userControls.mainControl:ClearChildren() diff --git a/LuaMenu/widgets/chobby/components/configuration.lua b/LuaMenu/widgets/chobby/components/configuration.lua index 651202be1..b17740876 100644 --- a/LuaMenu/widgets/chobby/components/configuration.lua +++ b/LuaMenu/widgets/chobby/components/configuration.lua @@ -385,6 +385,7 @@ function Configuration:init() balanceMode = true, preset = true, boss = true, + mutes = true, } -- SAIDBATTLEEX Prefixes self.BTLEX_JOINQUEUE = "You are now in the join-queue at position" diff --git a/libs/liblobby/lobby/lobby.lua b/libs/liblobby/lobby/lobby.lua index 32122f091..6784e2f29 100644 --- a/libs/liblobby/lobby/lobby.lua +++ b/libs/liblobby/lobby/lobby.lua @@ -1558,6 +1558,21 @@ function Lobby:_OnSaidBattleEx(userName, message, sayTime) end end + if battleInfo.mutes ~= nil then + local battleMutes = {} + for mutedUserName in string.gmatch(battleInfo.mutes, "([^,]+)") do + battleMutes[mutedUserName] = true + end + + local battleUsers = self.battles[battleID].users + for _, battleUserName in pairs(battleUsers) do + local battleUserIsMuted = battleMutes[battleUserName] or false + if self.userBattleStatus[battleUserName] and self.userBattleStatus[battleUserName].isMuted ~= battleUserIsMuted then + self:_OnUpdateUserBattleStatus(battleUserName, {isMuted = battleUserIsMuted}) + end + end + end + end -- 2023-07-04 FB: For now: proceed with CallListeners of SaidBattleEx, because gui_battle_room has its own parsing of barmanager message -- return From 61069d53595d583c4ff67980fe8a147ae1a0b942 Mon Sep 17 00:00:00 2001 From: James Smith Date: Sun, 8 Sep 2024 21:34:34 -0500 Subject: [PATCH 2/2] Add a unique status icon for muted users. --- LuaMenu/images/mute.png | Bin 0 -> 878 bytes LuaMenu/widgets/api_user_handler.lua | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 LuaMenu/images/mute.png diff --git a/LuaMenu/images/mute.png b/LuaMenu/images/mute.png new file mode 100644 index 0000000000000000000000000000000000000000..755b7bc16c01dbe4afc3d847ec2946ba09f67c34 GIT binary patch literal 878 zcmV-!1CjiRP)EX>4Tx04R}tkv&MmKp2MKrb<;R4t5Z6$WWc^q9TGzX~iN~C~bvS9ZW9$gC-40 zii@M*T5#}ZvFhOBtgC~oAPD||I6F8gx=4xNC509--f`T+d*AzV_Z=WKt4uX}qJXMd zMmiA_bNN*<@QQw#z&s!^Q%`0Vv+x{W_we!kF2b|C>;4>rO2K4+Pb7{q-LQx^h-Wt~ zo%23%h?OOU_?&pspbHW|a$R=$jdRIifoFz{Y&uRHA{I+sEO#+08!GV(aad6`$`^7j zE1b7DtJOMd-;=*ESkP87T&FdL1eTCQ3L<3GQ9%_JBD8Cym`Kxk%)>wG_*3MP$yEU( z#{z0lAvu2VKlt5Svp7BFCIw?a?~84Jj01sPpw+PL?_=9;odEu4;7aTGYfWJ8lk`SM z3m*YP+rY(jN0aw}%N=0kNtX=Ck^HoTVi9;hqi@Os!?(b|n%lSbIZhvdEcI&n1~@nb zCQ6jO?(y!v?!Nt7)9&97eo1nxU8|h100006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNliru=m`k|7A$KY6Yc;20c%M_K~#9!?VC#u!!QU$jg=#D z{}XU0y04TbHGiAgRf<&JV1udCFlY1&b(v=u-0=1@O9c?bmmotAzBPl z3!W5=nN>4Sfi++ocvk~5!iN^Yh=P~KfGqGK24sSFHy|6li2-B?PZbQnBAHh)03G2e z`|kk}@ETgZRA6b)8t@u-h$da2Lgu9_;C2;w!E4?70KWn@9Bg11ye)PKg5lu@o^l$5=-@Nd z0H_SFbrdcE>N*X!0c}7Xh5cV(hc?(-pw()%TCLjp0F+fyc(gGz9{>OV07*qoM6N<$ Ef)1m1U;qFB literal 0 HcmV?d00001 diff --git a/LuaMenu/widgets/api_user_handler.lua b/LuaMenu/widgets/api_user_handler.lua index c56255c66..c15528e7a 100644 --- a/LuaMenu/widgets/api_user_handler.lua +++ b/LuaMenu/widgets/api_user_handler.lua @@ -89,7 +89,7 @@ local IMAGE_ONLINE = IMAGE_DIR .. "online.png" local IMAGE_OFFLINE = IMAGE_DIR .. "offline.png" local IMAGE_BOSS = IMAGE_DIR .. "boss-icon.png" local IMAGE_RUNNING_BATTLE = IMAGE_DIR .. "runningBattle.png" -local IMAGE_MUTED = IMAGE_DIR .. "ignored.png" +local IMAGE_MUTED = IMAGE_DIR .. "mute.png" local IMAGE_CLAN_PATH = "LuaUI/Configs/Clans/"