Skip to content

Commit

Permalink
Merge pull request #648 from AdiAddons/unified-build
Browse files Browse the repository at this point in the history
Unified Codebase for Retail, Classic, and TBC
  • Loading branch information
Cidan authored Aug 22, 2022
2 parents 33d1bb1 + 3b14617 commit 1e36f59
Show file tree
Hide file tree
Showing 15 changed files with 328 additions and 167 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,44 @@
name: Package and release

# we need to let GitHub know _when_ we want to release, typically only when we create a new tag.
# this will target only tags, and not all pushes to the master branch.
# this part can be heavily customized to your liking, like targeting only tags that match a certain word,
# other branches or even pullrequests.
on:
push:
tags:
- '**'

# a workflow is built up as jobs, and within these jobs are steps
jobs:

# "release" is a job, you can name it anything you want
release:

# we can run our steps on pretty much anything, but the "ubuntu-latest" image is a safe bet
runs-on: ubuntu-latest

env:
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }}
GITHUB_OAUTH: ${{ secrets.GITHUB_TOKEN }} # "GITHUB_TOKEN" is a secret always provided to the workflow
# for your own token, the name cannot start with "GITHUB_"

# "steps" holds a list of all the steps needed to package and release our AddOn
steps:

# we first have to clone the AddOn project, this is a required step
- name: Clone project
uses: actions/checkout@v3
with:
fetch-depth: 0 # gets git history for changelogs

# once cloned, we just run the GitHub Action for the packager project
- name: Package and release
uses: BigWigsMods/[email protected]
uses: BigWigsMods/[email protected]
- name: Package and release Classic
uses: BigWigsMods/[email protected]
with:
args: -g classic
- name: Package and release TBC
uses: BigWigsMods/[email protected]
with:
args: -g bcc
3 changes: 3 additions & 0 deletions AdiBags.toc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
# along with AdiBags. If not, see <http://www.gnu.org/licenses/>.

## Interface: 90207
## Interface-Retail: 90207
## Interface-Classic: 11403
## Interface-BCC: 20504

## Title: AdiBags
## Notes: Adirelle's bag addon.
Expand Down
3 changes: 3 additions & 0 deletions AdiBags_Config/AdiBags_Config.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Interface: 90207
## Interface-Retail: 90207
## Interface-Classic: 11403
## Interface-BCC: 20504

## Title: AdiBags Configuration
## Notes: Adirelle's bag addon.
Expand Down
16 changes: 9 additions & 7 deletions config/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,6 @@ local function GetOptions()
type = 'toggle',
order = 95,
},
autoDeposit = {
name = L["Deposit reagents"],
desc = L["Automtically deposit all reagents into the reagent bank when you talk to the banker."],
type = 'toggle',
order = 110,
disabled = function() return not IsReagentBankUnlocked() end,
},
}
},
position = {
Expand Down Expand Up @@ -651,6 +644,15 @@ local function GetOptions()
},
plugins = {}
}
if addon.isRetail then
options["args"]["bags"]["args"]["automatically"]["args"]["autoDeposit"] = {
name = L["Deposit reagents"],
desc = L["Automtically deposit all reagents into the reagent bank when you talk to the banker."],
type = 'toggle',
order = 110,
disabled = function() return not IsReagentBankUnlocked() end,
}
end
hooksecurefunc(addon, "OnModuleCreated", OnModuleCreated)
for name, module in addon:IterateModules() do
OnModuleCreated(addon, module)
Expand Down
34 changes: 24 additions & 10 deletions core/Constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ along with AdiBags. If not, see <http://www.gnu.org/licenses/>.
local addonName, addon = ...
local L = addon.L

-- Constants for detecting WoW version.
addon.isRetail = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE
addon.isClassic = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC
addon.isBCC = WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC and LE_EXPANSION_LEVEL_CURRENT == LE_EXPANSION_BURNING_CRUSADE
addon.isWOTLK = WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC and LE_EXPANSION_LEVEL_CURRENT == LE_EXPANSION_NORTHREND

--<GLOBALS
local _G = _G
local BACKPACK_CONTAINER = _G.BACKPACK_CONTAINER
Expand All @@ -36,17 +42,25 @@ local pairs = _G.pairs
local BAGS = { [BACKPACK_CONTAINER] = BACKPACK_CONTAINER }
for i = 1, NUM_BAG_SLOTS do BAGS[i] = i end

-- Base nank bags
local BANK_ONLY = { [BANK_CONTAINER] = BANK_CONTAINER }
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK_ONLY[i] = i end

--- Reagent bank bags
local REAGENTBANK_ONLY = { [REAGENTBANK_CONTAINER] = REAGENTBANK_CONTAINER }

-- All bank bags
local BANK = {}
for _, bags in ipairs { BANK_ONLY, REAGENTBANK_ONLY } do
for id in pairs(bags) do BANK[id] = id end
local BANK_ONLY = {}
local REAGENTBANK_ONLY = {}

if addon.isRetail then
-- Base nank bags
BANK_ONLY = { [BANK_CONTAINER] = BANK_CONTAINER }
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK_ONLY[i] = i end

--- Reagent bank bags
REAGENTBANK_ONLY = { [REAGENTBANK_CONTAINER] = REAGENTBANK_CONTAINER }

-- All bank bags
for _, bags in ipairs { BANK_ONLY, REAGENTBANK_ONLY } do
for id in pairs(bags) do BANK[id] = id end
end
else
BANK = { [BANK_CONTAINER] = BANK_CONTAINER }
for i = NUM_BAG_SLOTS + 1, NUM_BAG_SLOTS + NUM_BANKBAGSLOTS do BANK[i] = i end
end

-- All bags
Expand Down
9 changes: 7 additions & 2 deletions core/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ function addon:OnEnable()
self:RegisterEvent('BAG_UPDATE')
self:RegisterEvent('BAG_UPDATE_DELAYED')
self:RegisterBucketEvent('PLAYERBANKSLOTS_CHANGED', 0.01, 'BankUpdated')
self:RegisterBucketEvent('PLAYERREAGENTBANKSLOTS_CHANGED', 0.01, 'ReagentBankUpdated')
if addon.isRetail then
self:RegisterBucketEvent('PLAYERREAGENTBANKSLOTS_CHANGED', 0.01, 'ReagentBankUpdated')
end

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

Expand Down Expand Up @@ -325,7 +327,10 @@ addon:SetDefaultModulePrototype(moduleProto)

local updatedBags = {}
local updatedBank = { [BANK_CONTAINER] = true }
local updatedReagentBank = { [REAGENTBANK_CONTAINER] = true }
local updatedReagentBank = {}
if addon.isRetail then
updatedReagentBank = { [REAGENTBANK_CONTAINER] = true }
end

function addon:BAG_UPDATE(event, bag)
updatedBags[bag] = true
Expand Down
Loading

0 comments on commit 1e36f59

Please sign in to comment.