Advertisement
Wetxius

Untitled

Feb 2nd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 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. if CheckFriend(name) then
  36. RaidNotice_AddMessage(RaidWarningFrame, L_INFO_INVITE..name, {r = 0.41, g = 0.8, b = 0.94}, 3)
  37. print(format("|cffffff00"..L_INFO_INVITE..name.."."))
  38. AcceptGroup()
  39. for i = 1, STATICPOPUP_NUMDIALOGS do
  40. local frame = _G["StaticPopup"..i]
  41. if frame:IsVisible() and frame.which == "PARTY_INVITE" then
  42. frame.inviteAccepted = 1
  43. StaticPopup_Hide("PARTY_INVITE")
  44. return
  45. elseif frame:IsVisible() and frame.which == "PARTY_INVITE_XREALM" then
  46. frame.inviteAccepted = 1
  47. StaticPopup_Hide("PARTY_INVITE_XREALM")
  48. return
  49. end
  50. end
  51. else
  52. SendWho(name)
  53. end
  54. end)
  55. end
  56.  
  57. ----------------------------------------------------------------------------------------
  58. -- Auto invite by whisper(by Tukz)
  59. ----------------------------------------------------------------------------------------
  60. local autoinvite = CreateFrame("Frame")
  61. autoinvite:RegisterEvent("CHAT_MSG_WHISPER")
  62. autoinvite:RegisterEvent("CHAT_MSG_BN_WHISPER")
  63. autoinvite:SetScript("OnEvent", function(self, event, arg1, arg2, ...)
  64. if ((not UnitExists("party1") or UnitIsGroupLeader("player") or UnitIsGroupAssistant("player")) and arg1:lower():match(C.misc.invite_keyword)) and SavedOptionsPerChar.AutoInvite == true then
  65. if event == "CHAT_MSG_WHISPER" then
  66. InviteUnit(arg2)
  67. elseif event == "CHAT_MSG_BN_WHISPER" then
  68. local _, toonName, _, realmName = BNGetToonInfo(select(11, ...))
  69. InviteUnit(toonName.."-"..realmName)
  70. end
  71. end
  72. end)
  73.  
  74. SlashCmdList.AUTOINVITE = function(msg)
  75. if msg == "off" then
  76. SavedOptionsPerChar.AutoInvite = false
  77. print("|cffffff00"..L_INVITE_DISABLE..".")
  78. elseif msg == "" then
  79. SavedOptionsPerChar.AutoInvite = true
  80. print("|cffffff00"..L_INVITE_ENABLE..C.misc.invite_keyword..".")
  81. C.misc.invite_keyword = C.misc.invite_keyword
  82. else
  83. SavedOptionsPerChar.AutoInvite = true
  84. print("|cffffff00"..L_INVITE_ENABLE..msg..".")
  85. C.misc.invite_keyword = msg
  86. end
  87. end
  88. SLASH_AUTOINVITE1 = "/ainv"
  89. SLASH_AUTOINVITE2 = "/Ρ„ΡˆΡ‚ΠΌ"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement