From 7dad1215527e0ac1df1aa28f4c56fe37e383893b Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Mar 2021 19:51:34 -0500 Subject: [PATCH 1/6] Extract goliath auto activation --- .../ATAutoReactivateGoliath.lua | 35 +++++++++++++++++++ .../ATAutoReactivateGoliath.toc | 6 ++++ ATMe/ATMe.lua | 34 ------------------ Makefile | 2 ++ 4 files changed, 43 insertions(+), 34 deletions(-) create mode 100644 ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua create mode 100644 ATAutoReactivateGoliath/ATAutoReactivateGoliath.toc diff --git a/ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua b/ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua new file mode 100644 index 0000000..8f2450a --- /dev/null +++ b/ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua @@ -0,0 +1,35 @@ +local f, ATAutoReactivateGoliath, events = CreateFrame("Frame"), {}, {} + +StaticPopupDialogs["GOLIATH_MISSING"] = { + text = "Option to repair goliath not found; move closer", + button1 = "Ok", + OnAccept = function() + C_GossipInfo.CloseGossip() + end, + timeout = 5, + whileDead = false, + hideOnEscape = true, + preferredIndex = 3 +} + +f:RegisterEvent("GOSSIP_SHOW") + +f:SetScript("OnEvent", function(self, event, ...) + local isNecroticWake = GetZoneText() == "The Necrotic Wake" + local isSteward = GetUnitName("npc") == "Steward" + + if isNecroticWake and isSteward then + options = C_GossipInfo.GetOptions() + + found = false + for k, v in pairs(options) do + if v['name'] == 'Can you reactivate this goliath?' then + found = true + C_GossipInfo.SelectOption(k) + break + end + end + + if not found then StaticPopup_Show("GOLIATH_MISSING") end + end +end) diff --git a/ATAutoReactivateGoliath/ATAutoReactivateGoliath.toc b/ATAutoReactivateGoliath/ATAutoReactivateGoliath.toc new file mode 100644 index 0000000..68221c9 --- /dev/null +++ b/ATAutoReactivateGoliath/ATAutoReactivateGoliath.toc @@ -0,0 +1,6 @@ +## Interface: 90005 +## Title: ATReactivateGoliath +## Author: Andrew Tomaka +## Version: 1.0 + +ATAutoReactivateGoliath.lua diff --git a/ATMe/ATMe.lua b/ATMe/ATMe.lua index 8156357..aa50302 100755 --- a/ATMe/ATMe.lua +++ b/ATMe/ATMe.lua @@ -9,18 +9,6 @@ StaticPopupDialogs["REPAIR_ALERT"] = { preferredIndex = 3 } -StaticPopupDialogs["GOLIATH_MISSING"] = { - text = "Option to repair goliath not found; move closer", - button1 = "Ok", - OnAccept = function() - C_GossipInfo.CloseGossip() - end, - timeout = 5, - whileDead = false, - hideOnEscape = true, - preferredIndex = 3 -} - SLASH_ATME1 = "/ta" ATMe.keyItemID = 180653 @@ -84,13 +72,6 @@ function events:INSPECT_READY(guid) end end -function events:GOSSIP_SHOW() - local isNecroticWake = GetZoneText() == 'The Necrotic Wake' - local isSteward = GetUnitName('npc') == 'Steward' - - if isNecroticWake and isSteward then ATMe.activateGoliath() end -end - function events:CHAT_MSG_PARTY_LEADER(message, ...) if message == '!keys' then ATMe.announceKey() @@ -213,21 +194,6 @@ function ATMe.announceTaunts(...) print(message) end -function ATMe.activateGoliath() - options = C_GossipInfo.GetOptions() - - found = false - for k, v in pairs(options) do - if v['name'] == 'Can you reactivate this goliath?' then - found = true - C_GossipInfo.SelectOption(k) - break - end - end - - if not found then StaticPopup_Show("GOLIATH_MISSING") end -end - function ATMe.needsRepair() for slot = 1, #ATMe.slots do local id = GetInventorySlotInfo(ATMe.slots[slot]) diff --git a/Makefile b/Makefile index 6122b30..c5f3fe8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ install: cp -r ATMe/ $$WOW_ADDON_DIR + cp -r ATAutoReactivateGoliath/ $$WOW_ADDON_DIR update: cp -r $$WOW_ADDON_DIR/ATMe . + cp -r $$WOW_ADDON_DIR/ATAutoReactivateGoliath . -- 2.45.2 From 78d8f5568c5bfaa2943f951725649bdec66ec30a Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Mar 2021 19:59:22 -0500 Subject: [PATCH 2/6] Minor simplification --- ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua b/ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua index 8f2450a..c2d6d60 100644 --- a/ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua +++ b/ATAutoReactivateGoliath/ATAutoReactivateGoliath.lua @@ -1,4 +1,4 @@ -local f, ATAutoReactivateGoliath, events = CreateFrame("Frame"), {}, {} +local f = CreateFrame("Frame") StaticPopupDialogs["GOLIATH_MISSING"] = { text = "Option to repair goliath not found; move closer", -- 2.45.2 From 9742103723f61a3f37acd13b6e954a5cbd30593f Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Mar 2021 20:26:10 -0500 Subject: [PATCH 3/6] Prep for API token --- .envrc.sample | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc.sample b/.envrc.sample index 2043b1f..8e9edfb 100644 --- a/.envrc.sample +++ b/.envrc.sample @@ -1 +1,2 @@ export WOW_ADDON_DIR= +export CURSEFORGE_TOKEN= -- 2.45.2 From ac9a030ec559a27a7d03562dc3986d6aa7070185 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Mar 2021 21:47:04 -0500 Subject: [PATCH 4/6] Hack up quick upload script --- .gitignore | 1 + Makefile | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4c4ffc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.zip diff --git a/Makefile b/Makefile index c5f3fe8..059955c 100644 --- a/Makefile +++ b/Makefile @@ -5,3 +5,21 @@ install: update: cp -r $$WOW_ADDON_DIR/ATMe . cp -r $$WOW_ADDON_DIR/ATAutoReactivateGoliath . + +clean: + rm -f ATAutoReactivateGoliath.zip + +archive: clean + zip -r ATAutoReactivateGoliath ATAutoReactivateGoliath + +upload: archive + test $$WOW_GAME_VERSION + curl -H "X-Api-Token: $$CURSEFORGE_TOKEN" \ + -F metadata='{changelog: "Initial upload", gameVersions: [$$WOW_GAME_VERSION], releaseType: "release"}' \ + -F file=@ATAutoReactivateGoliath.zip \ + https://wow.curseforge.com/api/projects/$$CURSEFORGE_PROJECT_ID/upload-file + +version: + curl -H "X-Api-Token: $$CURSEFORGE_TOKEN" \ + https://wow.curseforge.com/api/game/versions | \ + jq ".[-1] | .id" -- 2.45.2 From da7fda41d0a91f1437206ec27fc91f854f4f5126 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Mar 2021 22:53:27 -0500 Subject: [PATCH 5/6] Add new env var --- .envrc.sample | 1 + 1 file changed, 1 insertion(+) diff --git a/.envrc.sample b/.envrc.sample index 8e9edfb..92d7a21 100644 --- a/.envrc.sample +++ b/.envrc.sample @@ -1,2 +1,3 @@ export WOW_ADDON_DIR= export CURSEFORGE_TOKEN= +export CURSEFORGE_PROJECT_ID= -- 2.45.2 From 48799d35b790d3d48063db7f83bf0c3d9db24496 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Tue, 9 Mar 2021 22:57:08 -0500 Subject: [PATCH 6/6] Tack on simple instructions so I don't forget what's going on --- Makefile | 2 +- README.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 README.md diff --git a/Makefile b/Makefile index 059955c..77111e3 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,6 @@ upload: archive https://wow.curseforge.com/api/projects/$$CURSEFORGE_PROJECT_ID/upload-file version: - curl -H "X-Api-Token: $$CURSEFORGE_TOKEN" \ + @curl -s -H "X-Api-Token: $$CURSEFORGE_TOKEN" \ https://wow.curseforge.com/api/game/versions | \ jq ".[-1] | .id" diff --git a/README.md b/README.md new file mode 100644 index 0000000..eb9a1b1 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# ATAddons + +Miscellaneous World of Warcraft addons. + +## ATAutoReactivateGoliath + +To distribute new file via Makefile + +1. `WOW_GAME_VERSION=$(make version)` to grab the current game version +2. `make upload` to upload addon for recently grabbed game version -- 2.45.2