Skip to content

Commit

Permalink
add option to auto-convert to raid for group send invite
Browse files Browse the repository at this point in the history
change .toc filenames to conform with current standard for multi-toc
initial support for Wrath beta
  • Loading branch information
Road-block committed Jul 16, 2022
1 parent 9dcdf82 commit ba62a91
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Adherent.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Adherent-BCC.toc → Adherent_TBC.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 18 additions & 0 deletions Adherent_Wrath.toc
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions Locales/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
35 changes: 33 additions & 2 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand Down Expand Up @@ -82,6 +87,7 @@ local defaults = {
groupsend = {
friend = true,
guild = true,
autoraid = false,
blacklist = {},
whitelist = {},
keywords = {},
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ba62a91

Please sign in to comment.