diff --git a/Adherent.toc b/Adherent.toc index 205e9a6..64305c2 100644 --- a/Adherent.toc +++ b/Adherent.toc @@ -1,8 +1,8 @@ -## Interface: 20503 +## Interface: 20504 ## Author: Roadblock ## Title: Adherent ## Notes: Adherent lets you define rules for auto accepting follow, group join and group invite requests. -## Version: 1.1.2 +## Version: 1.1.3 ## X-Alpha: ## X-Website: https://github.com/Road-block/Adherent/releases/latest ## OptionalDeps: Ace3 diff --git a/Adherent-BCC.toc b/Adherent_TBC.toc similarity index 91% rename from Adherent-BCC.toc rename to Adherent_TBC.toc index 205e9a6..64305c2 100644 --- a/Adherent-BCC.toc +++ b/Adherent_TBC.toc @@ -1,8 +1,8 @@ -## Interface: 20503 +## Interface: 20504 ## Author: Roadblock ## Title: Adherent ## Notes: Adherent lets you define rules for auto accepting follow, group join and group invite requests. -## Version: 1.1.2 +## Version: 1.1.3 ## X-Alpha: ## X-Website: https://github.com/Road-block/Adherent/releases/latest ## OptionalDeps: Ace3 diff --git a/Adherent_Wrath.toc b/Adherent_Wrath.toc new file mode 100644 index 0000000..566519a --- /dev/null +++ b/Adherent_Wrath.toc @@ -0,0 +1,18 @@ +## Interface: 30400 +## Author: Roadblock +## Title: Adherent +## Notes: Adherent lets you define rules for auto accepting follow, group join and group invite requests. +## Version: 1.1.3 +## X-Alpha: +## X-Website: https://github.com/Road-block/Adherent/releases/latest +## OptionalDeps: Ace3 +## SavedVariables: AdherentDB + +## X-Curse-Project-ID: 582180 +## X-WoWI-ID: 26239 +## X-Wago-ID: yQKyLv67 + +Libs\libs.xml +Locales\locales.xml + +core.lua diff --git a/Locales/enUS.lua b/Locales/enUS.lua index f17bab3..3e11ec8 100644 --- a/Locales/enUS.lua +++ b/Locales/enUS.lua @@ -95,6 +95,8 @@ if not L then return end L["Request to stop following by %s"] = true L["Accepting invite from %s. They are %s :)"] = true L["Sending invite to %s."] = true + L["Automatically convert to raid when party full."] = true + L["Raid Convert"] = true L["whitelist"] = "trusted" L["friend"] = "a friend" L["guild"] = "a guildie" diff --git a/core.lua b/core.lua index 9fd0b9d..2e637de 100644 --- a/core.lua +++ b/core.lua @@ -11,8 +11,12 @@ local DF = LibStub("LibDeformat-3.0") local T = LibStub("LibQTip-1.0") adherent._DEBUG = false +local _,_,_,tocNum = GetBuildInfo() +tocNum = tonumber(tocNum) +adherent._wrath = tocNum < 40000 and tocNum > 30000 -- temp until we get a wrath project id adherent._classic = _G.WOW_PROJECT_ID and (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_CLASSIC) or false adherent._bcc = _G.WOW_PROJECT_ID and (_G.WOW_PROJECT_ID == _G.WOW_PROJECT_BURNING_CRUSADE_CLASSIC) or false +adherent._bcc = adherent._bcc and not adherent._wrath -- temp until we get a wrath project id adherent._playerName = GetUnitName("player") adherent._playerFullName = adherent._playerName @@ -22,6 +26,7 @@ local special_frames = {} local alreadyPinged, alreadyPonged, pongReceived = {}, {}, {} local InviteToGroup = _G.InviteToGroup or C_PartyInfo.InviteUnit local CanGroupInvite = _G.CanGroupInvite or C_PartyInfo.CanInvite +local ConvertToRaid = _G.ConvertToRaid or C_PartyInfo.ConvertToRaid local GuildRoster = _G.GuildRoster or C_GuildInfo.GuildRoster local COMM_PREFIX = format("%s_PFX",addonName) @@ -82,6 +87,7 @@ local defaults = { groupsend = { friend = true, guild = true, + autoraid = false, blacklist = {}, whitelist = {}, keywords = {}, @@ -994,6 +1000,18 @@ function adherent:options() WHISPER = _G.WHISPER, }, } + sendgroup_args.where.args["autoraid"] = { + type = "toggle", + name = _G.CONVERT_TO_RAID, + desc = L["Automatically convert to raid when party full."], + order = 12, + get = function(info, val) + return adherent.db.char.groupsend.autoraid + end, + set = function(info, val) + adherent.db.char.groupsend.autoraid = val + end, + } end return self._options end @@ -1367,12 +1385,25 @@ local function takeAction(action, name) adherent:followstop(name) elseif action == "groupsend" then if CanGroupInvite() then - adherent:echo(L["Sending invite to %s."], name) - InviteToGroup(name) + adherent:groupinvite(name) end end end +function adherent:groupinvite(name) + local autoconvert = self.db.char.groupsend.autoraid + local numGroup = GetNumGroupMembers() + local shouldConvert = (numGroup > MAX_PARTY_MEMBERS) and (not IsInRaid()) and UnitIsGroupLeader("player") + if shouldConvert and autoconvert then + ConvertToRaid() + self:ScheduleTimer("groupinvite",1,name) + return + else + InviteToGroup(name) + adherent:echo(L["Sending invite to %s."], name) + end +end + function adherent:Dispatch(action, sender, chatType) self:remoteDiscovery(sender) local list = action