Refactoring select API functions based on game version (retail/classic)
This commit is contained in:
parent
a78b31dba9
commit
4ce1a4be30
141
TurnIn.lua
Normal file → Executable file
141
TurnIn.lua
Normal file → Executable file
@ -8,6 +8,16 @@
|
||||
Thanks to Arcanemagus of Hyjal for extra bug fixes and coding input
|
||||
]]
|
||||
|
||||
-- WOW Version detection
|
||||
|
||||
local function TI_IsRetail()
|
||||
if WOW_PROJECT_ID == WOW_PROJECT_MAINLINE then
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
end
|
||||
end
|
||||
|
||||
TI_VersionString = "2.0";
|
||||
local TI_slashtable;
|
||||
TI_gossipclosed = false;
|
||||
@ -35,18 +45,7 @@ local TI_GossipDefaults = {
|
||||
banker = "Bank"
|
||||
};
|
||||
|
||||
local TI_FunctionList = {
|
||||
g = {
|
||||
availquest = C_GossipInfo.SelectActiveQuest,
|
||||
activequest = C_GossipInfo.SelectAvailableQuest,
|
||||
default = C_GossipInfo.SelectOption
|
||||
},
|
||||
q = {
|
||||
availquest = SelectAvailableQuest,
|
||||
activequest = SelectActiveQuest
|
||||
}
|
||||
};
|
||||
|
||||
TI_FunctionList = {};
|
||||
|
||||
local TI_DefaultStatus = {
|
||||
state = false,
|
||||
@ -394,20 +393,19 @@ function TI_HandleGossipWindow(gorq)
|
||||
local ActiveQuests;
|
||||
local GossipOptions;
|
||||
if(gorq == "g") then
|
||||
AvailableQuests = TI_TabulateGossipQuestUIInfo(C_GossipInfo.GetAvailableQuests());
|
||||
ActiveQuests = TI_TabulateGossipQuestUIInfo(C_GossipInfo.GetActiveQuests());
|
||||
GossipOptions = TI_TabulateGossipUIInfo(C_GossipInfo.GetOptions());
|
||||
SAcQ = C_GossipInfo.SelectActiveQuest;
|
||||
SAvQ = C_GossipInfo.SelectAvailableQuest;
|
||||
AvailableQuests = TI_FunctionList.g.tabulateAvailable(TI_FunctionList.g.getavailquests());
|
||||
ActiveQuests = TI_FunctionList.g.tabulateActive(TI_FunctionList.g.getactivequests());
|
||||
GossipOptions = TI_FunctionList.g.tabulateOptions(TI_FunctionList.g.getoptions());
|
||||
SAcQ = TI_FunctionList.g.activequest;
|
||||
SAvQ = TI_FunctionList.g.availquest;
|
||||
elseif(gorq == "q") then
|
||||
AvailableQuests = TI_GetQuests("Available");
|
||||
ActiveQuests = TI_GetQuests("Active");
|
||||
GossipOptions = {};
|
||||
SAcQ=SelectActiveQuest;
|
||||
SAvQ=SelectAvailableQuest;
|
||||
SAcQ=TI_FunctionList.q.activequest;
|
||||
SAvQ=TI_FunctionList.q.availquest;
|
||||
end
|
||||
|
||||
|
||||
|
||||
local ListEntry = {};
|
||||
for i,v in ipairs(AvailableQuests) do
|
||||
local x={};
|
||||
@ -507,7 +505,7 @@ function TI_HandleGossipWindow(gorq)
|
||||
for i2,v2 in ipairs(GossipOptions) do
|
||||
if (v2.name == current.name) then
|
||||
TI_debug(i1.."-Gossip Match Found: "..current.name..", "..current.type);
|
||||
C_GossipInfo.SelectOption(i2);
|
||||
TI_FunctionList.g.default(i2);
|
||||
return;
|
||||
end
|
||||
end
|
||||
@ -551,7 +549,7 @@ function TI_HandleGossipWindow(gorq)
|
||||
for j,val in ipairs(GossipOptions) do
|
||||
if(val.type == current.type) then
|
||||
TI_ResetPointers();
|
||||
C_GossipInfo.SelectOption(j);
|
||||
TI_FunctionList.g.default(j);
|
||||
return;
|
||||
end
|
||||
end
|
||||
@ -624,7 +622,7 @@ function TI_StripDescriptors(...)
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipOptions(...)
|
||||
function TI_TabulateGossipOptions_Classic(...)
|
||||
local x = {};
|
||||
local arg = {...};
|
||||
for i=1, #arg, 2 do
|
||||
@ -636,7 +634,7 @@ function TI_TabulateGossipOptions(...)
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipQuestUIInfo(gquis)
|
||||
function TI_TabulateGossipQuestUIInfo_Retail(gquis)
|
||||
local x = {};
|
||||
|
||||
for i,gqui in ipairs(gquis) do
|
||||
@ -653,7 +651,7 @@ function TI_TabulateGossipQuestUIInfo(gquis)
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipUIInfo(guis)
|
||||
function TI_TabulateGossipUIInfo_Retail(guis)
|
||||
local x = {};
|
||||
|
||||
for i,gui in ipairs(guis) do
|
||||
@ -668,6 +666,97 @@ function TI_TabulateGossipUIInfo(guis)
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipAvailableQuests_Classic(...)
|
||||
local x = {};
|
||||
|
||||
for i=1, select("#", ...), 7 do
|
||||
local temp = {};
|
||||
temp.name = select(i, ...);
|
||||
|
||||
local isTrivial = select(i+2, ...);
|
||||
local isDaily = select(i+3, ...);
|
||||
local isRepeatable = select(i+4, ...);
|
||||
local isLegendary = select(i+5, ...);
|
||||
local isIgnored = select(i+6, ...);
|
||||
if ( isDaily ) then
|
||||
temp.icon = "Interface\\GossipFrame\\DailyQuestIcon";
|
||||
elseif ( isRepeatable ) then
|
||||
temp.icon = "Interface\\GossipFrame\\DailyActiveQuestIcon";
|
||||
elseif ( isLegendary ) then
|
||||
temp.icon = "Interface\\GossipFrame\\AvailableLegendaryQuestIcon";
|
||||
else
|
||||
temp.icon = "Interface\\GossipFrame\\AvailableQuestIcon";
|
||||
end
|
||||
|
||||
table.insert(x, temp);
|
||||
end
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipActiveQuests_Classic(...)
|
||||
local x = {};
|
||||
|
||||
for i=1, select("#", ...), 6 do
|
||||
local temp = {};
|
||||
temp.name = select(i, ...);
|
||||
|
||||
local isComplete = select(i+3, ...);
|
||||
temp.isComplete = isComplete;
|
||||
local isLegendary = select(i+4, ...);
|
||||
if(isComplete) then
|
||||
if(isLegendary) then
|
||||
temp.icon = "Interface\\GossipFrame\\ActiveLegendaryQuestIcon";
|
||||
else
|
||||
temp.icon = "Interface\\GossipFrame\\ActiveQuestIcon";
|
||||
end
|
||||
else
|
||||
temp.icon = "Interface\\GossipFrame\\IncompleteQuestIcon";
|
||||
end
|
||||
|
||||
table.insert(x, temp);
|
||||
end
|
||||
return x;
|
||||
end
|
||||
|
||||
-- set up functions by release type
|
||||
if (TI_IsRetail()) then
|
||||
TI_FunctionList = {
|
||||
g = {
|
||||
availquest = C_GossipInfo.SelectAvailableQuest,
|
||||
activequest = C_GossipInfo.SelectActiveQuest,
|
||||
default = C_GossipInfo.SelectOption,
|
||||
getavailquests = C_GossipInfo.GetAvailableQuests,
|
||||
getactivequests = C_GossipInfo.GetActiveQuests,
|
||||
getoptions = C_GossipInfo.GetOptions,
|
||||
tabulateAvailable = TI_TabulateGossipQuestUIInfo_Retail,
|
||||
tabulateActive = TI_TabulateGossipQuestUIInfo_Retail,
|
||||
tabulateOptions = TI_TabulateGossipUIInfo_Retail,
|
||||
},
|
||||
q = {
|
||||
activequest = C_GossipInfo.SelectActiveQuest,
|
||||
availquest = C_GossipInfo.SelectAvailableQuest,
|
||||
}
|
||||
};
|
||||
else
|
||||
TI_FunctionList = {
|
||||
g = {
|
||||
availquest = SelectGossipAvailableQuest,
|
||||
activequest = SelectGossipActiveQuest,
|
||||
default = SelectGossipOption,
|
||||
getavailquests = GetGossipAvailableQuests,
|
||||
getactivequests = GetGossipActiveQuests,
|
||||
getoptions = GetGossipOptions,
|
||||
tabulateAvailable = TI_TabulateGossipAvailableQuests_Classic,
|
||||
tabulateActive = TI_TabulateGossipActiveQuests_Classic,
|
||||
tabulateOptions = TI_TabulateGossipOptions_Classic,
|
||||
},
|
||||
q = {
|
||||
activequest = SelectActiveQuest,
|
||||
availquest = SelectAvailableQuest,
|
||||
}
|
||||
};
|
||||
end
|
||||
|
||||
|
||||
--[[this function stolen from WhisperCast by Sarris, whom I love dearly for his contribution to Paladins everywhere.
|
||||
]]
|
||||
|
||||
6
TurnIn.toc
Normal file → Executable file
6
TurnIn.toc
Normal file → Executable file
@ -1,7 +1,7 @@
|
||||
## Interface: 90105
|
||||
## X-Compatible-With: 90105
|
||||
## Interface: 90207
|
||||
## X-Compatible-With: 90207
|
||||
## Title: Turn In
|
||||
## Notes: Automates the selection of quest and gossip options.
|
||||
## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex
|
||||
## Version: 2.1
|
||||
## Version: 2.2
|
||||
TurnIn.xml
|
||||
|
||||
7
TurnIn_Wrath.toc
Executable file
7
TurnIn_Wrath.toc
Executable file
@ -0,0 +1,7 @@
|
||||
## Interface: 30400
|
||||
## X-Compatible-With: 30400
|
||||
## Title: Turn In
|
||||
## Notes: Automates the selection of quest and gossip options.
|
||||
## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex
|
||||
## Version: 2.2
|
||||
TurnIn.xml
|
||||
Loading…
Reference in New Issue
Block a user