Thread Tools Display Modes
12-08-12, 11:23 AM   #1
MelokOnes
A Murloc Raider
Join Date: Dec 2012
Posts: 6
Must be overloaded in the Ui to be detected is in the team

Hi man were, this is DuffedUI in the treatment mode in the of team framework, I wanted to Party or Raid in the set into different of location, through UnitInRaid () and UnitInParty () to in the Party or Raid, but unless Ui again loading, otherwise cannot Bring into effect the Lua, I have one problem need to solve, is in WoW Event in the have triggered exit party or exit raid of Event?

Lua Code:
  1. local MaxGroup = CreateFrame("Frame")
  2. MaxGroup:RegisterEvent("PLAYER_ENTERING_WORLD")
  3. MaxGroup:RegisterEvent("ZONE_CHANGED_NEW_AREA")
  4. MaxGroup:SetScript("OnEvent", function(self)
  5.     local inInstance, instanceType = IsInInstance()
  6.     local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo()
  7.     if inInstance and instanceType == "raid" and maxPlayers ~= 40 then
  8.        
  9.         G.RaidHeal:Point("BOTTOMLEFT", DuffedUIBar2, "TOPLEFT", 2, 33)
  10.         DuffedUIGrid:SetAttribute("groupFilter", "1,2,3,4,5")
  11.     else
  12.         if UnitInRaid("player") then --判断是否在团队中
  13.             G.RaidHeal:Point("BOTTOMLEFT", DuffedUIBar2, "TOPLEFT", -100, 33)
  14.             G.PlayerFrame:Point("BOTTOMLEFT", DuffedUIBar1, "TOPLEFT", -150, 340)
  15.             G.TargetFrame:Point("BOTTOMRIGHT", DuffedUIBar1, "TOPRIGHT", 150, 340)
  16.             DuffedUIGrid:SetAttribute("groupFilter", "1,2,3,4,5,6,7,8")
  17.             SendChatMessage("in the raid", "SAY")
  18.         else
  19.             if UnitInParty("player") then --如果不是就判断是否在小队中
  20.                 SendChatMessage("in the Party", "SAY")
  21.                 G.PlayerFrame:Point("BOTTOMLEFT", DuffedUIBar1, "TOPLEFT", -50, 160)
  22.                 G.TargetFrame:Point("BOTTOMRIGHT", DuffedUIBar1, "TOPRIGHT", 50, 160)
  23.             else    --再不是就是加入队伍了,设置默认位置
  24.                 G.PlayerFrame:Point("BOTTOMLEFT", DuffedUIBar1, "TOPLEFT", 2, 140)
  25.                 G.TargetFrame:Point("BOTTOMRIGHT", DuffedUIBar1, "TOPRIGHT", -2, 140)
  26.                 G.RaidHeal:Point("BOTTOMLEFT", DuffedUIBar2, "TOPLEFT", 2, 33)
  27.                 SendChatMessage("is not in the raid", "SAY")
  28.             end
  29.         end
  30.        
  31.     end
  32. end)

Last edited by MelokOnes : 12-08-12 at 11:33 AM.
  Reply With Quote
12-08-12, 12:48 PM   #2
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
I believe GROUP_ROSTER_UPDATE fires when somebody joins or leaves the team.

Try MaxGroup:RegisterEvent("GROUP_ROSTER_UPDATE")
  Reply With Quote
12-08-12, 12:49 PM   #3
d87
A Chromatic Dragonspawn
 
d87's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 163
I guess you're asking about GROUP_ROSTER_UPDATE and RAID_ROSTER_UPDATE events.
Also you probably should wrap your event handler code into this construction to avoid taint:
Code:
if not InCombatLockdown() then
    -- <your code>
    self:UnregisterEvent("PLAYER_REGEN_ENABLED")
else
    self:RegisterEvent("PLAYER_REGEN_ENABLED")
end
  Reply With Quote
12-08-12, 09:57 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Also, this:

Code:
SendChatMessage("in the raid", "SAY")
will send your message to all players near you, so they can see it. You probably just want to only see the message for yourself, so you should change that to:

Code:
print("in the raid")
which will show the message only to you.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
12-08-12, 10:57 PM   #5
MelokOnes
A Murloc Raider
Join Date: Dec 2012
Posts: 6
Thanks guys , d87 His method can solve this problem.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Must be overloaded in the Ui to be detected is in the team


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off