瀏覽代碼

Refactoring select API functions based on game version (retail/classic)

tags/2.2
SabinDeus 3 年之前
父節點
當前提交
4ce1a4be30
共有 3 個文件被更改,包括 125 次插入29 次删除
  1. 115
    26
      TurnIn.lua
  2. 3
    3
      TurnIn.toc
  3. 7
    0
      TurnIn_Wrath.toc

+ 115
- 26
TurnIn.lua 查看文件

Thanks to Arcanemagus of Hyjal for extra bug fixes and coding input 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"; TI_VersionString = "2.0";
local TI_slashtable; local TI_slashtable;
TI_gossipclosed = false; TI_gossipclosed = false;
banker = "Bank" 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 = { local TI_DefaultStatus = {
state = false, state = false,
local ActiveQuests; local ActiveQuests;
local GossipOptions; local GossipOptions;
if(gorq == "g") then 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 elseif(gorq == "q") then
AvailableQuests = TI_GetQuests("Available"); AvailableQuests = TI_GetQuests("Available");
ActiveQuests = TI_GetQuests("Active"); ActiveQuests = TI_GetQuests("Active");
GossipOptions = {}; GossipOptions = {};
SAcQ=SelectActiveQuest;
SAvQ=SelectAvailableQuest;
SAcQ=TI_FunctionList.q.activequest;
SAvQ=TI_FunctionList.q.availquest;
end end

local ListEntry = {}; local ListEntry = {};
for i,v in ipairs(AvailableQuests) do for i,v in ipairs(AvailableQuests) do
local x={}; local x={};
for i2,v2 in ipairs(GossipOptions) do for i2,v2 in ipairs(GossipOptions) do
if (v2.name == current.name) then if (v2.name == current.name) then
TI_debug(i1.."-Gossip Match Found: "..current.name..", "..current.type); TI_debug(i1.."-Gossip Match Found: "..current.name..", "..current.type);
C_GossipInfo.SelectOption(i2);
TI_FunctionList.g.default(i2);
return; return;
end end
end end
for j,val in ipairs(GossipOptions) do for j,val in ipairs(GossipOptions) do
if(val.type == current.type) then if(val.type == current.type) then
TI_ResetPointers(); TI_ResetPointers();
C_GossipInfo.SelectOption(j);
TI_FunctionList.g.default(j);
return; return;
end end
end end
return x; return x;
end end


function TI_TabulateGossipOptions(...)
function TI_TabulateGossipOptions_Classic(...)
local x = {}; local x = {};
local arg = {...}; local arg = {...};
for i=1, #arg, 2 do for i=1, #arg, 2 do
return x; return x;
end end


function TI_TabulateGossipQuestUIInfo(gquis)
function TI_TabulateGossipQuestUIInfo_Retail(gquis)
local x = {}; local x = {};
for i,gqui in ipairs(gquis) do for i,gqui in ipairs(gquis) do
return x; return x;
end end


function TI_TabulateGossipUIInfo(guis)
function TI_TabulateGossipUIInfo_Retail(guis)
local x = {}; local x = {};
for i,gui in ipairs(guis) do for i,gui in ipairs(guis) do
return x; return x;
end 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. --[[this function stolen from WhisperCast by Sarris, whom I love dearly for his contribution to Paladins everywhere.
]] ]]

+ 3
- 3
TurnIn.toc 查看文件

## Interface: 90105
## X-Compatible-With: 90105
## Interface: 90207
## X-Compatible-With: 90207
## Title: Turn In ## Title: Turn In
## Notes: Automates the selection of quest and gossip options. ## Notes: Automates the selection of quest and gossip options.
## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex ## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex
## Version: 2.1
## Version: 2.2
TurnIn.xml TurnIn.xml

+ 7
- 0
TurnIn_Wrath.toc 查看文件

## 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…
取消
儲存