fixes for 3.3.3 function return values change and additional features
This commit is contained in:
parent
b5332e43de
commit
cd7ba55c82
@ -1,5 +1,5 @@
|
|||||||
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
|
||||||
@ -32,6 +32,7 @@ COMMAND SUMMARY
|
|||||||
|
|
||||||
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.
|
||||||
@ -46,7 +47,8 @@ v1.0 - Initial Release
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
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!
|
|
||||||
150
TurnIn.lua
150
TurnIn.lua
@ -1,13 +1,11 @@
|
|||||||
--[[
|
--[[
|
||||||
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:
|
Thanks to Arcanemagus of Hyjal for extra bug fixes and coding input
|
||||||
make selection work for multiple active quests
|
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
TI_VersionString = "2.0";
|
TI_VersionString = "2.0";
|
||||||
@ -205,7 +203,6 @@ function TI_SlashCmdHandler(cmd)
|
|||||||
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();
|
||||||
@ -227,7 +224,7 @@ function TI_SlashCmdHandler(cmd)
|
|||||||
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
|
||||||
|
|
||||||
|
|
||||||
@ -387,8 +384,8 @@ function TI_HandleGossipWindow(gorq)
|
|||||||
local ActiveQuests;
|
local ActiveQuests;
|
||||||
local GossipOptions;
|
local GossipOptions;
|
||||||
if(gorq == "g") then
|
if(gorq == "g") then
|
||||||
AvailableQuests = TI_TabulateGossipQuests(GetGossipAvailableQuests());
|
AvailableQuests = TI_TabulateGossipAvailableQuests(GetGossipAvailableQuests());
|
||||||
ActiveQuests = TI_TabulateGossipQuests(GetGossipActiveQuests());
|
ActiveQuests = TI_TabulateGossipActiveQuests(GetGossipActiveQuests());
|
||||||
GossipOptions = TI_TabulateGossipOptions(GetGossipOptions());
|
GossipOptions = TI_TabulateGossipOptions(GetGossipOptions());
|
||||||
SAcQ = SelectGossipActiveQuest;
|
SAcQ = SelectGossipActiveQuest;
|
||||||
SAvQ = SelectGossipAvailableQuest;
|
SAvQ = SelectGossipAvailableQuest;
|
||||||
@ -409,6 +406,7 @@ function TI_HandleGossipWindow(gorq)
|
|||||||
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
|
||||||
@ -418,6 +416,7 @@ function TI_HandleGossipWindow(gorq)
|
|||||||
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
|
||||||
@ -439,12 +438,29 @@ function TI_HandleGossipWindow(gorq)
|
|||||||
return;
|
return;
|
||||||
end
|
end
|
||||||
|
|
||||||
local name = UnitName("npc");
|
|
||||||
TI_AddNPCToTempList(name, ListEntry);
|
|
||||||
|
|
||||||
if(TI_status.autoadd and (not TI_NPCDB[name])) then
|
local npcname = UnitName("npc");
|
||||||
TI_debug("autoadd on, adding this NPC", TI_status.autoadd, TI_NPCDB[name]);
|
TI_AddNPCToTempList(npcname, ListEntry);
|
||||||
TI_AddNPCToList(ListEntry, name);
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-- 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
|
end
|
||||||
|
|
||||||
if(TI_availnumber > TotalOptions or TI_activenumber > TotalOptions) then
|
if(TI_availnumber > TotalOptions or TI_activenumber > TotalOptions) then
|
||||||
@ -452,41 +468,41 @@ function TI_HandleGossipWindow(gorq)
|
|||||||
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
|
for i1,current in ipairs(thisnpc) do
|
||||||
TI_debug(i);
|
if (current.state == true) then
|
||||||
if(current.state) then
|
TI_debug("Current Quest: "..current.name);
|
||||||
if (TI_specnum == 0 or i > TI_specnum) then
|
if (TI_specnum == 0 or i1 > TI_specnum) then
|
||||||
TI_specnum = i;
|
TI_specnum = i1;
|
||||||
TI_debug("Setting specnum to "..TI_specnum.." nothing under that will be picked");
|
if (current.type == "availquest") then
|
||||||
local flist = TI_FunctionList[current.gorq];
|
for i2,v2 in ipairs(AvailableQuests) do
|
||||||
if(flist[current.type]) then
|
if (v2.name == current.name) then
|
||||||
flist[current.type](current.args);
|
TI_debug(i1.."-Available Match Found: "..current.name);
|
||||||
else
|
TI_FunctionList[current.gorq]["availquest"](i2);
|
||||||
flist["default"](current.args);
|
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
|
||||||
@ -529,16 +545,6 @@ function TI_HandleGossipWindow(gorq)
|
|||||||
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
|
||||||
@ -607,19 +613,47 @@ function TI_TabulateGossipOptions(...)
|
|||||||
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.name = select(i, ...);
|
||||||
temp.type = arg[i+1];
|
|
||||||
temp.isLowLevel = arg[i+2]
|
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.
|
||||||
]]
|
]]
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
## 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
|
||||||
12
TurnInUI.lua
12
TurnInUI.lua
@ -17,9 +17,17 @@ function TI_PopulateOptions(arg)
|
|||||||
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…
Reference in New Issue
Block a user