Wetxius

Untitled

Feb 2nd, 2016
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. local T, C, L, _ = unpack(select(2, ...))
  2.  
  3. ----------------------------------------------------------------------------------------
  4. -- Accept invites from guild members or friend list(by ALZA)
  5. ----------------------------------------------------------------------------------------
  6. if C.automation.accept_invite == true then
  7. local CheckFriend = function(name)
  8. for i = 1, GetNumFriends() do
  9. if GetFriendInfo(i) == name then
  10. return true
  11. end
  12. end
  13. for i = 1, select(2, BNGetNumFriends()) do
  14. local presenceID, _, _, _, _, _, client, isOnline = BNGetFriendInfo(i)
  15. if client == "WoW" and isOnline then
  16. local _, toonName, _, realmName = BNGetToonInfo(presenceID)
  17. if name == toonName or name == toonName.."-"..realmName then
  18. return true
  19. end
  20. end
  21. end
  22. if IsInGuild() then
  23. for i = 1, GetNumGuildMembers() do
  24. if Ambiguate(GetGuildRosterInfo(i), "guild") == name then
  25. return true
  26. end
  27. end
  28. end
  29. end
  30.  
  31. local ai = CreateFrame("Frame")
  32. ai:RegisterEvent("PARTY_INVITE_REQUEST")
  33. ai:SetScript("OnEvent", function(self, event, name)
  34. if QueueStatusMinimapButton:IsShown() or GetNumGroupMembers() > 0 then return end
  35. print(name)
  36. if CheckFriend(name) then
  37. RaidNotice_AddMessage(RaidWarningFrame, L_INFO_INVITE..name, {r = 0.41, g = 0.8, b = 0.94}, 3)
  38. print(format("|cffffff00"..L_INFO_INVITE..name.."."))
  39. AcceptGroup()
  40. for i = 1, STATICPOPUP_NUMDIALOGS do
  41. local frame = _G["StaticPopup"..i]
  42. if frame:IsVisible() and frame.which == "PARTY_INVITE" then
  43. frame.inviteAccepted = 1
  44. StaticPopup_Hide("PARTY_INVITE")
  45. return
  46. elseif frame:IsVisible() and frame.which == "PARTY_INVITE_XREALM" then
  47. frame.inviteAccepted = 1
  48. StaticPopup_Hide("PARTY_INVITE_XREALM")
  49. return
  50. end
  51. end
  52. else
  53. SendWho(name)
  54. end
  55. end)
  56. end
  57.  
  58. ----------------------------------------------------------------------------------------
  59. -- Auto invite by whisper(by Tukz)
  60. ----------------------------------------------------------------------------------------
  61. local autoinvite = CreateFrame("Frame")
  62. autoinvite:RegisterEvent("CHAT_MSG_WHISPER")
  63. autoinvite:RegisterEvent("CHAT_MSG_BN_WHISPER")
  64. autoinvite:SetScript("OnEvent", function(self, event, arg1, arg2, ...)
  65. if ((not UnitExists("party1") or UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) and arg1:lower():match(C.misc.invite_keyword)) and SavedOptionsPerChar.AutoInvite == true then
  66. if event == "CHAT_MSG_WHISPER" then
  67. InviteUnit(arg2)
  68. elseif event == "CHAT_MSG_BN_WHISPER" then
  69. local _, toonName, _, realmName = BNGetToonInfo(select(11, ...))
  70. InviteUnit(toonName.."-"..realmName)
  71. end
  72. end
  73. end)
  74.  
  75. SlashCmdList.AUTOINVITE = function(msg)
  76. if msg == "off" then
  77. SavedOptionsPerChar.AutoInvite = false
  78. print("|cffffff00"..L_INVITE_DISABLE..".")
  79. elseif msg == "" then
  80. SavedOptionsPerChar.AutoInvite = true
  81. print("|cffffff00"..L_INVITE_ENABLE..C.misc.invite_keyword..".")
  82. C.misc.invite_keyword = C.misc.invite_keyword
  83. else
  84. SavedOptionsPerChar.AutoInvite = true
  85. print("|cffffff00"..L_INVITE_ENABLE..msg..".")
  86. C.misc.invite_keyword = msg
  87. end
  88. end
  89. SLASH_AUTOINVITE1 = "/ainv"
  90. SLASH_AUTOINVITE2 = "/Ρ„ΡˆΡ‚ΠΌ"
Add Comment
Please, Sign In to add comment