View Single Post
12-26-22, 03:32 PM   #2
vx_odessa_xv
A Murloc Raider
Join Date: Jun 2020
Posts: 4
Might anyone be able to assist with this? I had at one time had a pinned together bit that was working properly to achieve this "invited to group triggers at 100% master volume" I am currently after, but I can't make heads or tails of this here in the lua I tried to alter with it below after the Dragonflight expansion drop to get it functional once again.

Lua Code:
  1. local entries={
  2.     [139828]=1 -- UIPartySyncReadyCheck
  3. }
  4.  
  5. local pool,f={},CreateFrame('frame') f.handles={} f.lastchan={} f.nodupeids={} f.nodupehandles={}
  6. function f.pool(t,i)
  7.     if i then pool[i]:SetScript('OnUpdate',nil) pool[i].t=nil return end
  8.     for i=1,#pool do
  9.         if pool[i] and not pool[i].t then pool[i].t={i=i,t=t} return i end
  10.     end
  11.     tinsert(pool,CreateFrame('frame')) i=#pool pool[i].t={i=i,t=t} return i
  12. end
  13. f:SetScript('OnEvent',function(_,_,handle)
  14.     if f.nodupehandles[handle] then
  15.         f.nodupeids[f.nodupehandles[handle]]=nil
  16.         f.nodupehandles[handle]=nil
  17.     end
  18.     if f.handles[handle] then
  19.         if f[f.handles[handle]] and f.lastchan[f.handles[handle]]==handle then
  20.             SetCVar(f.handles[handle],f[f.handles[handle]])
  21.             f[f.handles[handle]]=nil
  22.         end
  23.         f.handles[handle]=nil
  24.     end
  25. end)
  26. f:RegisterEvent('SOUNDKIT_FINISHED')
  27. hooksecurefunc('PlaySound',function(id,channel,nodupe,_,_,_,_,own)
  28.     if not own and not f.nodupeids[id] and entries[id] then
  29.         local _,handle=PlaySound(64,'Master',false)
  30.         if handle then
  31.             StopSound(handle) StopSound(handle-1)
  32.             channel=(not channel and 'Master') or (strlower(channel)=='sfx' and 'SFX') or strlower(channel):gsub('^%a',strupper)
  33.             local cvar='Sound_'..channel..'Volume'
  34.             pool[f.pool({id,channel,nodupe,cvar})]:SetScript('OnUpdate',function(self)
  35.                 local handle=nil
  36.                 if type(entries[self.t.t[1]])=="string" then
  37.                     _,handle=PlaySoundFile(entries[self.t.t[1]],self.t.t[2],self.t.t[3])
  38.                 else
  39.                     _,handle=PlaySound(self.t.t[1],self.t.t[2],self.t.t[3],true,nil,nil,nil,true)
  40.                 end
  41.                 if type(entries[self.t.t[1]])=="number" and handle then
  42.                     if self.t.t[3]~=false then
  43.                         f.nodupeids[self.t.t[1]]=handle
  44.                         f.nodupehandles[handle]=self.t.t[1]
  45.                     end
  46.                     f.lastchan[self.t.t[4]]=handle
  47.                     f.handles[handle]=self.t.t[4]
  48.                     if not f[self.t.t[4]] then
  49.                         f[self.t.t[4]]=GetCVar(self.t.t[4])
  50.                         if f[self.t.t[4]] then SetCVar(self.t.t[4],entries[self.t.t[1]]) end
  51.                     end
  52.                 end
  53.                 f.pool('',self.t.i)
  54.             end)
  55.         end
  56.     end
  57. end)
  Reply With Quote