Skip to content

Commit 1e36f59

Browse files
authored
Merge pull request #648 from AdiAddons/unified-build
Unified Codebase for Retail, Classic, and TBC
2 parents 33d1bb1 + 3b14617 commit 1e36f59

File tree

15 files changed

+328
-167
lines changed

15 files changed

+328
-167
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,44 @@
11
name: Package and release
2+
3+
# we need to let GitHub know _when_ we want to release, typically only when we create a new tag.
4+
# this will target only tags, and not all pushes to the master branch.
5+
# this part can be heavily customized to your liking, like targeting only tags that match a certain word,
6+
# other branches or even pullrequests.
27
on:
38
push:
49
tags:
510
- '**'
11+
12+
# a workflow is built up as jobs, and within these jobs are steps
613
jobs:
14+
15+
# "release" is a job, you can name it anything you want
716
release:
17+
18+
# we can run our steps on pretty much anything, but the "ubuntu-latest" image is a safe bet
819
runs-on: ubuntu-latest
20+
921
env:
10-
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
22+
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }} # "GITHUB_TOKEN" is a secret always provided to the workflow
23+
# for your own token, the name cannot start with "GITHUB_"
24+
25+
# "steps" holds a list of all the steps needed to package and release our AddOn
1126
steps:
27+
28+
# we first have to clone the AddOn project, this is a required step
1229
- name: Clone project
1330
uses: actions/checkout@v3
1431
with:
1532
fetch-depth: 0 # gets git history for changelogs
33+
34+
# once cloned, we just run the GitHub Action for the packager project
1635
- name: Package and release
17-
uses: BigWigsMods/[email protected]
36+
uses: BigWigsMods/[email protected]
37+
- name: Package and release Classic
38+
uses: BigWigsMods/[email protected]
39+
with:
40+
args: -g classic
41+
- name: Package and release TBC
42+
uses: BigWigsMods/[email protected]
43+
with:
44+
args: -g bcc

AdiBags.toc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
# along with AdiBags. If not, see <http://www.gnu.org/licenses/>.
1919

2020
## Interface: 90207
21+
## Interface-Retail: 90207
22+
## Interface-Classic: 11403
23+
## Interface-BCC: 20504
2124

2225
## Title: AdiBags
2326
## Notes: Adirelle's bag addon.

AdiBags_Config/AdiBags_Config.toc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
## Interface: 90207
2+
## Interface-Retail: 90207
3+
## Interface-Classic: 11403
4+
## Interface-BCC: 20504
25

36
## Title: AdiBags Configuration
47
## Notes: Adirelle's bag addon.

config/Options.lua

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,6 @@ local function GetOptions()
320320
type = 'toggle',
321321
order = 95,
322322
},
323-
autoDeposit = {
324-
name = L["Deposit reagents"],
325-
desc = L["Automtically deposit all reagents into the reagent bank when you talk to the banker."],
326-
type = 'toggle',
327-
order = 110,
328-
disabled = function() return not IsReagentBankUnlocked() end,
329-
},
330323
}
331324
},
332325
position = {
@@ -651,6 +644,15 @@ local function GetOptions()
651644
},
652645
plugins = {}
653646
}
647+
if addon.isRetail then
648+
options["args"]["bags"]["args"]["automatically"]["args"]["autoDeposit"] = {
649+
name = L["Deposit reagents"],
650+
desc = L["Automtically deposit all reagents into the reagent bank when you talk to the banker."],
651+
type = 'toggle',
652+
order = 110,
653+
disabled = function() return not IsReagentBankUnlocked() end,
654+
}
655+
end
654656
hooksecurefunc(addon, "OnModuleCreated", OnModuleCreated)
655657
for name, module in addon:IterateModules() do
656658
OnModuleCreated(addon, module)

core/Constants.lua

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ along with AdiBags. If not, see <http://www.gnu.org/licenses/>.
2222
local addonName, addon = ...
2323
local L = addon.L
2424

25+
-- Constants for detecting WoW version.
26+
addon.isRetail = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
27+
addon.isClassic = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
28+
addon.isBCC = WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC and LE_EXPANSION_LEVEL_CURRENT == LE_EXPANSION_BURNING_CRUSADE
29+
addon.isWOTLK = WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC and LE_EXPANSION_LEVEL_CURRENT == LE_EXPANSION_NORTHREND
30+
2531
--<GLOBALS
2632
local _G = _G
2733
local BACKPACK_CONTAINER = _G.BACKPACK_CONTAINER
@@ -36,17 +42,25 @@ local pairs = _G.pairs
3642
local BAGS = { [BACKPACK_CONTAINER] = BACKPACK_CONTAINER }
3743
for i = 1, NUM_BAG_SLOTS do BAGS[i] = i end
3844

39-
-- Base nank bags
40-
local BANK_ONLY = { [BANK_CONTAINER] = BANK_CONTAINER }
41-
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK_ONLY[i] = i end
42-
43-
--- Reagent bank bags
44-
local REAGENTBANK_ONLY = { [REAGENTBANK_CONTAINER] = REAGENTBANK_CONTAINER }
45-
46-
-- All bank bags
4745
local BANK = {}
48-
for _, bags in ipairs { BANK_ONLY, REAGENTBANK_ONLY } do
49-
for id in pairs(bags) do BANK[id] = id end
46+
local BANK_ONLY = {}
47+
local REAGENTBANK_ONLY = {}
48+
49+
if addon.isRetail then
50+
-- Base nank bags
51+
BANK_ONLY = { [BANK_CONTAINER] = BANK_CONTAINER }
52+
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK_ONLY[i] = i end
53+
54+
--- Reagent bank bags
55+
REAGENTBANK_ONLY = { [REAGENTBANK_CONTAINER] = REAGENTBANK_CONTAINER }
56+
57+
-- All bank bags
58+
for _, bags in ipairs { BANK_ONLY, REAGENTBANK_ONLY } do
59+
for id in pairs(bags) do BANK[id] = id end
60+
end
61+
else
62+
BANK = { [BANK_CONTAINER] = BANK_CONTAINER }
63+
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK[i] = i end
5064
end
5165

5266
-- All bags

core/Core.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,9 @@ function addon:OnEnable()
126126
self:RegisterEvent('BAG_UPDATE')
127127
self:RegisterEvent('BAG_UPDATE_DELAYED')
128128
self:RegisterBucketEvent('PLAYERBANKSLOTS_CHANGED', 0.01, 'BankUpdated')
129-
self:RegisterBucketEvent('PLAYERREAGENTBANKSLOTS_CHANGED', 0.01, 'ReagentBankUpdated')
129+
if addon.isRetail then
130+
self:RegisterBucketEvent('PLAYERREAGENTBANKSLOTS_CHANGED', 0.01, 'ReagentBankUpdated')
131+
end
130132

131133
self:RegisterEvent('PLAYER_LEAVING_WORLD', 'Disable')
132134

@@ -325,7 +327,10 @@ addon:SetDefaultModulePrototype(moduleProto)
325327

326328
local updatedBags = {}
327329
local updatedBank = { [BANK_CONTAINER] = true }
328-
local updatedReagentBank = { [REAGENTBANK_CONTAINER] = true }
330+
local updatedReagentBank = {}
331+
if addon.isRetail then
332+
updatedReagentBank = { [REAGENTBANK_CONTAINER] = true }
333+
end
329334

330335
function addon:BAG_UPDATE(event, bag)
331336
updatedBags[bag] = true

0 commit comments

Comments
 (0)