Skip to content

Commit

Permalink
Update Alterac Valley module for classic
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Aug 27, 2023
1 parent d909c44 commit e2a20c0
Show file tree
Hide file tree
Showing 4 changed files with 201 additions and 86 deletions.
6 changes: 0 additions & 6 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ globals = {
"GetLocale",
"GetNumBattlegroundTypes",
"GetNumQuestRewards",
"GetPOITextureCoords",
"GetQuestReward",
"GetRealmName",
"GetSpellInfo",
Expand Down Expand Up @@ -77,9 +76,4 @@ globals = {

-- Classic WoW
"GetBattlefieldScore",
"GetGossipOptions",
"GetNumGossipActiveQuests",
"SelectGossipActiveQuest",
"SelectGossipAvailableQuest",
"SelectGossipOption",
}
131 changes: 96 additions & 35 deletions Modules/AlteracValley_TBC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ do
mod, L, cap = core:NewMod()
end

local hasPrinted = false
do
local UnitGUID, strsplit, GetNumGossipActiveQuests, SelectGossipActiveQuest = UnitGUID, strsplit, GetNumGossipActiveQuests, SelectGossipActiveQuest
local tonumber, SelectGossipOption, GetGossipOptions, GetItemCount, SelectGossipAvailableQuest = tonumber, SelectGossipOption, GetGossipOptions, GetItemCount, SelectGossipAvailableQuest
local UnitGUID, strsplit, GetNumGossipActiveQuests, SelectGossipActiveQuest = UnitGUID, strsplit, C_GossipInfo.GetNumActiveQuests, C_GossipInfo.SelectActiveQuest
local tonumber, GetGossipOptions, GetItemCount = tonumber, C_GossipInfo.GetOptions, GetItemCount
local blockedIds = {
[30907] = true, -- alliance
[30908] = true, -- alliance
[30909] = true, -- alliance
[35739] = true, -- horde
[35740] = true, -- horde
[35741] = true, -- horde
}
function mod:GOSSIP_SHOW()
if not cap.db.profile.autoTurnIn then return end

Expand All @@ -18,55 +25,109 @@ do
local mobId = tonumber(id)
if mobId == 13176 or mobId == 13257 then -- Smith Regzar, Murgot Deepforge
-- Open Quest to Smith or Murgot
if GetGossipOptions() and strmatch(GetGossipOptions(), L.upgradeToTrigger) then
SelectGossipOption(1)
elseif GetItemCount(17422) >= 20 then -- Armor Scraps 17422
SelectGossipAvailableQuest(1)
if self:GetGossipID(30904) then -- Alliance
self:SelectGossipID(30904) -- Upgrade to seasoned units!
elseif self:GetGossipID(30905) then -- Alliance
self:SelectGossipID(30905) -- Upgrade to veteran units!
elseif self:GetGossipID(30906) then -- Alliance
self:SelectGossipID(30906) -- Upgrade to champion units!
elseif self:GetGossipID(35736) then -- Horde
self:SelectGossipID(35736) -- Upgrade to seasoned units!
elseif self:GetGossipID(35737) then -- Horde
self:SelectGossipID(35737) -- Upgrade to veteran units!
elseif self:GetGossipID(35738) then -- Horde
self:SelectGossipID(35738) -- Upgrade to champion units!
else
local gossipOptions = GetGossipOptions()
if gossipOptions[1] then
for i = 1, #gossipOptions do
local gossipTable = gossipOptions[i]
if not blockedIds[gossipTable.gossipOptionID] then
print("|cFF33FF99Capping|r: NEW ID FOUND, TELL THE DEVS!", gossipTable.gossipOptionID, mobId, gossipTable.name)
geterrorhandler()("|cFF33FF99Capping|r: NEW ID FOUND, TELL THE DEVS! ".. tostring(gossipTable.gossipOptionID) ..", ".. mobId ..", ".. tostring(gossipTable.name))
return
end
end
end
end

if GetItemCount(17422) >= 20 then -- Armor Scraps 17422
if self:GetGossipAvailableQuestID(6781) then -- Alliance, More Armor Scraps
self:SelectGossipAvailableQuestID(6781)
elseif self:GetGossipAvailableQuestID(6741) then -- Horde, More Booty!
self:SelectGossipAvailableQuestID(6741)
elseif self:GetGossipAvailableQuestID(57318) then -- Horde, More Booty! [Specific to Korrak's Revenge]
self:SelectGossipAvailableQuestID(57318)
elseif self:GetGossipAvailableQuestID(57306) then -- Alliance, More Armor Scraps [Specific to Korrak's Revenge]
self:SelectGossipAvailableQuestID(57306)
end
end
elseif mobId == 13236 then -- Primalist Thurloga
elseif mobId == 13236 then -- Horde, Primalist Thurloga
local num = GetItemCount(17306) -- Stormpike Soldier's Blood 17306
if num > 0 then
if GetNumGossipActiveQuests() == 1 then
if GetNumGossipActiveQuests() > 0 then
local tbl = C_GossipInfo.GetActiveQuests()
for i = 1, #tbl do
local questTable = tbl[i]
print("|cFF33FF99Capping|r: NEW ACTIVE QUEST, TELL THE DEVS!", questTable.questID, mobId, questTable.title)
geterrorhandler()("|cFF33FF99Capping|r: NEW ACTIVE QUEST, TELL THE DEVS! ".. tostring(questTable.questID) ..", ".. mobId ..", ".. tostring(questTable.title))
end
return
SelectGossipActiveQuest(1)
elseif num >= 5 then
SelectGossipAvailableQuest(2)
else
SelectGossipAvailableQuest(1)
elseif self:GetGossipAvailableQuestID(7385) and num >= 5 then -- A Gallon of Blood
self:SelectGossipAvailableQuestID(7385)
elseif self:GetGossipAvailableQuestID(6801) then -- Lokholar the Ice Lord
self:SelectGossipAvailableQuestID(6801)
end
end
elseif mobId == 13442 then -- Archdruid Renferal
elseif mobId == 13442 then -- Alliance, Archdruid Renferal
local num = GetItemCount(17423) -- Storm Crystal 17423
if num > 0 then
if GetNumGossipActiveQuests() == 1 then
if GetNumGossipActiveQuests() > 0 then
local tbl = C_GossipInfo.GetActiveQuests()
for i = 1, #tbl do
local questTable = tbl[i]
print("|cFF33FF99Capping|r: NEW ACTIVE QUEST, TELL THE DEVS!", questTable.questID, mobId, questTable.title)
geterrorhandler()("|cFF33FF99Capping|r: NEW ACTIVE QUEST, TELL THE DEVS! ".. tostring(questTable.questID) ..", ".. mobId ..", ".. tostring(questTable.title))
end
return
SelectGossipActiveQuest(1)
elseif num >= 5 then
SelectGossipAvailableQuest(2)
else
SelectGossipAvailableQuest(1)
elseif self:GetGossipAvailableQuestID(7386) and num >= 5 then -- Crystal Cluster
self:SelectGossipAvailableQuestID(7386)
elseif self:GetGossipAvailableQuestID(6881) then -- Ivus the Forest Lord
self:SelectGossipAvailableQuestID(6881)
end
end
elseif mobId == 13577 then -- Stormpike Ram Rider Commander
elseif mobId == 13577 then -- Alliance, Stormpike Ram Rider Commander
print("|cFF33FF99Capping|r: RAM RIDER, TELL THE DEVS!", self:GetGossipAvailableQuestID(7026)) -- Don't think this is needed anymore, adding a print to see, v10.0.0
geterrorhandler()("|cFF33FF99Capping|r: RAM RIDER, TELL THE DEVS! ".. tostring(self:GetGossipAvailableQuestID(7026)))
if GetItemCount(17643) > 0 then -- Frost Wolf Hide 17643
SelectGossipAvailableQuest(1)
self:SelectGossipAvailableQuestID(7026)
end
elseif mobId == 13441 then -- Frostwolf Wolf Rider Commander
elseif mobId == 13441 then -- Horde, Frostwolf Wolf Rider Commander
print("|cFF33FF99Capping|r: WOLF RIDER, TELL THE DEVS!", self:GetGossipAvailableQuestID(7002)) -- Don't think this is needed anymore, adding a print to see, v10.0.0
geterrorhandler()("|cFF33FF99Capping|r: WOLF RIDER, TELL THE DEVS! ".. tostring(self:GetGossipAvailableQuestID(7002)))
if GetItemCount(17642) > 0 then -- Alterac Ram Hide 17642
SelectGossipAvailableQuest(1)
self:SelectGossipAvailableQuestID(7002) -- Ram Hide Harnesses
end
end
end
end
end

do
local hasPrinted = false
local function allowPrints()
hasPrinted = false
end
local IsQuestCompletable, CompleteQuest = IsQuestCompletable, CompleteQuest
function mod:QUEST_PROGRESS()
if not cap.db.profile.autoTurnIn then return end
self:GOSSIP_SHOW()
if IsQuestCompletable() then
CompleteQuest()
if not hasPrinted then
hasPrinted = true
C_Timer.After(10, allowPrints)
print(L.handIn)
end
end
Expand Down Expand Up @@ -107,6 +168,7 @@ local function AVSyncRequest()
hasData = true
end

local currentWorldMapId = 1459
do
local timer = nil
local function SendAVTimers()
Expand Down Expand Up @@ -141,7 +203,7 @@ do
end

if next(inProgressDataTbl) then
self:RestoreFlagCaptures(91, inProgressDataTbl, 242)
self:RestoreFlagCaptures(currentWorldMapId, inProgressDataTbl, 242)
end
end

Expand All @@ -168,15 +230,14 @@ end

do
local RequestBattlefieldScoreData = RequestBattlefieldScoreData
function mod:EnterZone()
hasPrinted = false
--local _, _, _, _, _, _, _, id = GetInstanceInfo()
--if id == 1537 then
-- self:StartFlagCaptures(242, 1537) -- Korrak's Revenge (WoW 15th)
--else
-- self:StartFlagCaptures(242, 91)
--end
self:StartFlagCaptures(245, 1459)
function mod:EnterZone(id)
if id == 2197 then
currentWorldMapId = 1537
self:StartFlagCaptures(241, currentWorldMapId) -- Korrak's Revenge (WoW 15th)
else
currentWorldMapId = 1459
self:StartFlagCaptures(245, currentWorldMapId)
end
self:SetupHealthCheck("11946", L.hordeBoss, "Horde Boss", 134170, "colorAlliance") -- Interface/Icons/Inv_misc_head_orc_01
self:SetupHealthCheck("11948", L.allianceBoss, "Alliance Boss", 134159, "colorHorde") -- Interface/Icons/inv_misc_head_dwarf_01
self:SetupHealthCheck("11947", L.galvangar, "Galvangar", 134170, "colorAlliance") -- Interface/Icons/Inv_misc_head_orc_01
Expand All @@ -203,4 +264,4 @@ function mod:ExitZone()
end

mod:RegisterZone(30)
--mod:RegisterZone(2197) -- Korrak's Revenge (WoW 15th)
mod:RegisterZone(2197) -- Korrak's Revenge (WoW 15th)
Loading

0 comments on commit e2a20c0

Please sign in to comment.