瀏覽代碼

fixes for 3.3.3 function return values change and additional features

tags/v2.1
SabinDeus 15 年之前
父節點
當前提交
cd7ba55c82
共有 4 個檔案被更改,包括 109 行新增65 行删除
  1. 5
    3
      README.txt
  2. 92
    58
      TurnIn.lua
  3. 2
    2
      TurnIn.toc
  4. 10
    2
      TurnInUI.lua

+ 5
- 3
README.txt 查看文件

Turn In Turn In
v2.0
v2.1
by Sabindeus of Smolderthorn/Andre of Argent Dawn (Alliance) by Sabindeus of Smolderthorn/Andre of Argent Dawn (Alliance)


DESCRIPTION DESCRIPTION
CHANGE LOG CHANGE LOG
------------- -------------
v2.1 - Quest selection logic rewrite thanks to Arcanemagus of Hyjal
v2.0 - Logic rewrite and added a real GUI for the new NPC DB. Updated for WoW 2.0. v2.0 - Logic rewrite and added a real GUI for the new NPC DB. Updated for WoW 2.0.
v1.3 - Greedy mode now actually works properly... I think. More to come! :/ v1.3 - Greedy mode now actually works properly... I think. More to come! :/
v1.2 - Added Saved Variables. Turn In status now persists. Turn In now selects active quests and gossip options as well as available quests. Greedy mode lets you select an option regardless of if the one you wanted is availble. v1.2 - Added Saved Variables. Turn In status now persists. Turn In now selects active quests and gossip options as well as available quests. Greedy mode lets you select an option regardless of if the one you wanted is availble.






Special Thanks to Florrail for beta testing like a pro!
Special Thanks to Florrail and Makhno for beta testing like a pro!

Extra Special Thanks to Arcanemagus for his code input!


Please send bug reports, questions or comments to Sabin1936@mac.com Please send bug reports, questions or comments to Sabin1936@mac.com
Thank you for downloading my add-on!

+ 92
- 58
TurnIn.lua 查看文件

--[[ --[[
Turn-In Mod Turn-In Mod
version 2.0
version 2.1
Authored by Ian Friedman Authored by Ian Friedman
Sabindeus of Smolderthorn/Andre of Argent Dawn (Alliance)
Sabindeus of Smolderthorn (Alliance)
The repeatable quest turn in automating machine. The repeatable quest turn in automating machine.
todo:
make selection work for multiple active quests

Thanks to Arcanemagus of Hyjal for extra bug fixes and coding input
]] ]]


TI_VersionString = "2.0"; TI_VersionString = "2.0";
else else
TI_message("Turn In Off"); TI_message("Turn In Off");
end end
TI_message(string.format("Option Number set to %d", TI_status.qnum));
end, end,
window = function () window = function ()
TI_OptionsFrame:Show(); TI_OptionsFrame:Show();
if(commands[cmdlist[1]]) then if(commands[cmdlist[1]]) then
commands[cmdlist[1]](cmdlist[2], cmdlist[3], cmdlist[4]); commands[cmdlist[1]](cmdlist[2], cmdlist[3], cmdlist[4]);
else else
TI_message("Turn In 2.0 Help", "--------------", "/ti on - turns Turn In on", "/ti off - turns Turn In off", "/ti toggle - toggles Turn In on or off", "/ti window - shows the options window", "/ti recent - shows the recently visited NPCs");
TI_message("Turn In 2.1 Help", "--------------", "/ti on - turns Turn In on", "/ti off - turns Turn In off", "/ti toggle - toggles Turn In on or off", "/ti window - shows the options window", "/ti recent - shows the recently visited NPCs");
end end
local ActiveQuests; local ActiveQuests;
local GossipOptions; local GossipOptions;
if(gorq == "g") then if(gorq == "g") then
AvailableQuests = TI_TabulateGossipQuests(GetGossipAvailableQuests());
ActiveQuests = TI_TabulateGossipQuests(GetGossipActiveQuests());
AvailableQuests = TI_TabulateGossipAvailableQuests(GetGossipAvailableQuests());
ActiveQuests = TI_TabulateGossipActiveQuests(GetGossipActiveQuests());
GossipOptions = TI_TabulateGossipOptions(GetGossipOptions()); GossipOptions = TI_TabulateGossipOptions(GetGossipOptions());
SAcQ = SelectGossipActiveQuest; SAcQ = SelectGossipActiveQuest;
SAvQ = SelectGossipAvailableQuest; SAvQ = SelectGossipAvailableQuest;
x.gorq = gorq; x.gorq = gorq;
x.args = i; x.args = i;
x.type = "availquest"; x.type = "availquest";
x.icon = v.icon;
x.state = false; x.state = false;
table.insert(ListEntry, x); table.insert(ListEntry, x);
end end
x.gorq = gorq; x.gorq = gorq;
x.args = i; x.args = i;
x.type = "activequest"; x.type = "activequest";
x.icon = v.icon;
x.state = false; x.state = false;
table.insert(ListEntry, x); table.insert(ListEntry, x);
end end
return; return;
end end
local name = UnitName("npc");
TI_AddNPCToTempList(name, ListEntry);
if(TI_status.autoadd and (not TI_NPCDB[name])) then
TI_debug("autoadd on, adding this NPC", TI_status.autoadd, TI_NPCDB[name]);
TI_AddNPCToList(ListEntry, name);
local npcname = UnitName("npc");
TI_AddNPCToTempList(npcname, ListEntry);
if(TI_status.autoadd and (not TI_NPCDB[npcname])) then
TI_debug("autoadd on, adding this NPC", TI_status.autoadd, TI_NPCDB[npcname]);
TI_AddNPCToList(ListEntry, npcname);
end end
-- If a NPC is in the Database but a new dialog option has appeared (new daily/completed quest) then add it to the DB
if (TI_NPCDB[npcname]) then
for k1, v1 in ipairs(ListEntry) do
local found = false;
for k2, v2 in ipairs(TI_NPCDB[npcname]) do
if (v2.type == v1.type and v2.name == v1.name) then
found = true;
end
end
if (not found) then
table.insert(TI_NPCDB[npcname], v1)
TI_PopulateOptions("npclist updated");
end
end
end
if(TI_availnumber > TotalOptions or TI_activenumber > TotalOptions) then if(TI_availnumber > TotalOptions or TI_activenumber > TotalOptions) then
TI_ResetPointers(); TI_ResetPointers();
return; return;
end end
--Legacy shit here
--[[
if(TI_status.qnum ~= 0 and TI_status.qnum<TotalOptions) then
if(TI_status.qnum <= #AvailableQuests) then
SAvQ(TI_status.qnum);
return;
elseif(TI_status.qnum <= #AvailableQuests+#ActiveQuests) then
SAcQ(TI_status.qnum-AvailableQuests.n);
return;
elseif(TI_status.qnum <= #AvailableQuests+#ActiveQuests+#GossipOptions) then
SelectGossipOption(TI_status.qnum-#AvailableQuests-#ActiveQuests);
return;
end
end
]]--
local npcname = UnitName("npc");
TI_debug(npcname); TI_debug(npcname);
if(TI_NPCDB[npcname]) then if(TI_NPCDB[npcname]) then
local thisnpc = TI_NPCDB[npcname]; local thisnpc = TI_NPCDB[npcname];
if(thisnpc.state) then if(thisnpc.state) then
TI_debug("npc is active, using his options"); TI_debug("npc is active, using his options");
for i,current in ipairs(thisnpc) do
TI_debug(i);
if(current.state) then
if (TI_specnum == 0 or i > TI_specnum) then
TI_specnum = i;
TI_debug("Setting specnum to "..TI_specnum.." nothing under that will be picked");
local flist = TI_FunctionList[current.gorq];
if(flist[current.type]) then
flist[current.type](current.args);
else
flist["default"](current.args);
for i1,current in ipairs(thisnpc) do
if (current.state == true) then
TI_debug("Current Quest: "..current.name);
if (TI_specnum == 0 or i1 > TI_specnum) then
TI_specnum = i1;
if (current.type == "availquest") then
for i2,v2 in ipairs(AvailableQuests) do
if (v2.name == current.name) then
TI_debug(i1.."-Available Match Found: "..current.name);
TI_FunctionList[current.gorq]["availquest"](i2);
return;
end
end
elseif (current.type == "activequest") then
for i2,v2 in ipairs(ActiveQuests) do
if (v2.name == current.name) then
TI_debug(i1.."-Active Match Found: "..current.name..", "..current.type);
TI_FunctionList[current.gorq]["activequest"](i2);
return;
end
end
elseif (current.type == "gossip") then
for i2,v2 in ipairs(GossipOptions) do
if (v2.name == current.name) then
SelectGossipOption(i2);
return;
end
end
end end
return;
end end
end end
end end
end end


function TI_AddNPCToList(OptList, npcname, confirminquestion) function TI_AddNPCToList(OptList, npcname, confirminquestion)
--~ NPClist = {
--~ "Joe" = {
--~ 0 = {
--~ name = "Option 1"
--~ accessor = SelectGossipOption
--~ args = 0
--~ }
--~ }
--~ }
if (npcname == nil) then if (npcname == nil) then
npcname = UnitName("npc"); npcname = UnitName("npc");
end end
return x; return x;
end end


function TI_TabulateGossipQuests(...)
function TI_TabulateGossipAvailableQuests(...)
local x = {}; local x = {};
local arg = {...};
for i=1, #arg, 3 do
for i=1, select("#", ...), 5 do
local temp = {}; local temp = {};
temp.name = arg[i];
temp.type = arg[i+1];
temp.isLowLevel = arg[i+2]
temp.name = select(i, ...);
isTrivial = select(i+2, ...);
isDaily = select(i+3, ...);
isRepeatable = select(i+4, ...);
if ( isDaily ) then
temp.icon = "Interface\\GossipFrame\\DailyQuestIcon";
elseif ( isRepeatable ) then
temp.icon = "Interface\\GossipFrame\\DailyActiveQuestIcon";
else
temp.icon = "Interface\\GossipFrame\\AvailableQuestIcon";
end
table.insert(x, temp); table.insert(x, temp);
end end
return x; return x;
end end

function TI_TabulateGossipActiveQuests(...)
local x = {};
for i=1, select("#", ...), 4 do
local temp = {};
temp.name = select(i, ...);
isComplete = select(i+3, ...);
if(isComplete) then
temp.icon = "Interface\\GossipFrame\\ActiveQuestIcon";
else
temp.icon = "Interface\\GossipFrame\\IncompleteQuestIcon";
end
table.insert(x, temp);
end
return x;
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.
]] ]]

+ 2
- 2
TurnIn.toc 查看文件

## Interface: 30300
## Interface: 40000
## Title: Turn In ## Title: Turn In
## Description: Automates the selection of quest and gossip options. ## Description: Automates the selection of quest and gossip options.
## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex ## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex
## Version: 2.0.12
## Version: 2.1
TurnIn.xml TurnIn.xml

+ 10
- 2
TurnInUI.lua 查看文件

if(v.name == nil) then TI_debug("oh noes") end; if(v.name == nil) then TI_debug("oh noes") end;
entrytext:SetText(v.name); entrytext:SetText(v.name);
if(v.type == "activequest") then if(v.type == "activequest") then
iconpath = "Interface\\GossipFrame\\ActiveQuestIcon";
if(v.icon) then
iconpath = v.icon;
else
iconpath = "Interface\\GossipFrame\\ActiveQuestIcon";
end
elseif(v.type == "availquest") then elseif(v.type == "availquest") then
iconpath = "Interface\\GossipFrame\\AvailableQuestIcon";
if(v.icon) then
iconpath = v.icon;
else
iconpath = "Interface\\GossipFrame\\AvailableQuestIcon";
end
else else
iconpath = "Interface\\GossipFrame\\" .. v.type .. "GossipIcon"; iconpath = "Interface\\GossipFrame\\" .. v.type .. "GossipIcon";
end end

Loading…
取消
儲存