Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9c0705f2d3 | ||
|
|
4b1a1af6b3 | ||
|
|
5e84b90850 | ||
|
|
a6f5433efc | ||
|
|
cc1e393bfc | ||
|
|
14d9f35361 |
1
.gitignore
vendored
Normal file → Executable file
1
.gitignore
vendored
Normal file → Executable file
@ -1 +0,0 @@
|
||||
.sync/
|
||||
27
README.txt
27
README.txt
@ -1,6 +1,6 @@
|
||||
Turn In
|
||||
v2.1
|
||||
by Sabindeus of Smolderthorn/Andre of Argent Dawn (Alliance)
|
||||
v2.3
|
||||
by Sabindeus of Terenas
|
||||
|
||||
DESCRIPTION
|
||||
-------------
|
||||
@ -30,25 +30,4 @@ COMMAND SUMMARY
|
||||
|
||||
|
||||
|
||||
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.
|
||||
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.1 - Fixed "bug" regarding Duke Nicholas Zverenhoff (and possibly other NPCs). Was more of a sloppy omission than a bug really.
|
||||
v1.0a - Added toggle function
|
||||
v1.0 - Initial Release
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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 sabin@sabindeus.com
|
||||
|
||||
247
TurnIn.lua
247
TurnIn.lua
@ -1,22 +1,14 @@
|
||||
--[[
|
||||
Turn-In Mod
|
||||
version 2.1
|
||||
version 2.3
|
||||
Authored by Ian Friedman
|
||||
Sabindeus of Smolderthorn (Alliance)
|
||||
Sabindeus of Terenas (Alliance)
|
||||
The repeatable quest turn in automating machine.
|
||||
|
||||
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;
|
||||
@ -45,7 +37,6 @@ local TI_GossipDefaults = {
|
||||
banker = "Bank"
|
||||
};
|
||||
|
||||
TI_FunctionList = {};
|
||||
|
||||
local TI_DefaultStatus = {
|
||||
state = false,
|
||||
@ -120,7 +111,7 @@ end
|
||||
|
||||
function TI_debug(...)
|
||||
if(TI_status.debugstate) then
|
||||
LoadAddOn("Blizzard_DebugTools")
|
||||
C_AddOns.LoadAddOn("Blizzard_DebugTools")
|
||||
local x = {...};
|
||||
for k,v in pairs(x) do
|
||||
if type(v) == "table" and DevTools_Dump then
|
||||
@ -202,6 +193,7 @@ function TI_LoadEvents()
|
||||
end
|
||||
|
||||
function TI_ResetPointers()
|
||||
TI_debug("resetting pointers")
|
||||
TI_activenumber = 1;
|
||||
TI_availnumber = 1;
|
||||
TI_specnum = 0;
|
||||
@ -420,6 +412,7 @@ function TI_CompleteQuest()
|
||||
TI_ResetPointers();
|
||||
else
|
||||
TI_debug("quest is not completable, declining");
|
||||
TI_availnumber = TI_availnumber + 1;
|
||||
QuestDetailDeclineButton_OnClick();
|
||||
end
|
||||
end
|
||||
@ -502,79 +495,87 @@ function TI_HandleGossipWindow(gorq)
|
||||
|
||||
|
||||
local npcname = UnitName("npc");
|
||||
TI_AddNPCToTempList(npcname, ListEntry);
|
||||
if not issecretvalue(npcname) then
|
||||
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
|
||||
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;
|
||||
-- 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
|
||||
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
|
||||
TI_ResetPointers();
|
||||
return;
|
||||
end
|
||||
if(TI_availnumber > TotalOptions or TI_activenumber > TotalOptions) then
|
||||
TI_debug("Out of available/active quests, giving up ");
|
||||
TI_ResetPointers();
|
||||
return;
|
||||
end
|
||||
|
||||
TI_debug(npcname);
|
||||
if(TI_NPCDB[npcname]) then
|
||||
local thisnpc = TI_NPCDB[npcname];
|
||||
if(thisnpc.state) then
|
||||
TI_debug("npc is active, using his options");
|
||||
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);
|
||||
SAvQ(v2.questID);
|
||||
return;
|
||||
TI_debug(npcname);
|
||||
if(TI_NPCDB[npcname]) then
|
||||
local thisnpc = TI_NPCDB[npcname];
|
||||
if(thisnpc.state) then
|
||||
TI_debug("npc is active, using his options");
|
||||
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);
|
||||
SAvQ(v2.questID);
|
||||
return;
|
||||
end
|
||||
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);
|
||||
SAcQ(v2.questID);
|
||||
return;
|
||||
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);
|
||||
SAcQ(v2.questID);
|
||||
return;
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
for i2,v2 in ipairs(GossipOptions) do
|
||||
if (v2.name == current.name) then
|
||||
TI_debug(i1.."-Gossip Match Found: "..current.name..", "..current.type);
|
||||
TI_FunctionList.g.gossip(i2);
|
||||
return;
|
||||
else
|
||||
for i2,v2 in ipairs(GossipOptions) do
|
||||
if (v2.name == current.name) then
|
||||
TI_debug(i1.."-Gossip Match Found: "..current.name..", "..current.type);
|
||||
if(v2.args) then
|
||||
TI_FunctionList.g.gossip(v2.args);
|
||||
else
|
||||
TI_FunctionList.g.gossip(i2);
|
||||
end
|
||||
return;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return;
|
||||
else
|
||||
TI_debug("npc in list, but not active");
|
||||
end
|
||||
return;
|
||||
else
|
||||
TI_debug("npc in list, but not active");
|
||||
TI_debug("npc not in list");
|
||||
end
|
||||
else
|
||||
TI_debug("npc not in list");
|
||||
end
|
||||
|
||||
if(TI_status.usedefault == false) then
|
||||
TI_debug("npc not in list, default set to off, returning.");
|
||||
return;
|
||||
@ -585,7 +586,6 @@ function TI_HandleGossipWindow(gorq)
|
||||
if(current.type == "availquest" and #AvailableQuests > 0 and TI_availnumber <= #AvailableQuests) then
|
||||
SAvQ(AvailableQuests[TI_availnumber].questID);
|
||||
TI_debug("Selecting Available Quest ".. TI_availnumber);
|
||||
TI_ResetPointers();
|
||||
return;
|
||||
elseif(current.type == "activequest" and #ActiveQuests > 0 and TI_activenumber <= #ActiveQuests) then
|
||||
while TI_activenumber <= #ActiveQuests do
|
||||
@ -603,7 +603,8 @@ function TI_HandleGossipWindow(gorq)
|
||||
for j,val in ipairs(GossipOptions) do
|
||||
if(val.type == current.type) then
|
||||
TI_ResetPointers();
|
||||
TI_FunctionList.g.gossip(j);
|
||||
TI_debug("Selecting Gossip Option "..j)
|
||||
TI_FunctionList.g.gossip(val.args);
|
||||
return;
|
||||
end
|
||||
end
|
||||
@ -676,19 +677,7 @@ function TI_StripDescriptors(...)
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipOptions_Classic(...)
|
||||
local x = {};
|
||||
local arg = {...};
|
||||
for i=1, #arg, 2 do
|
||||
local temp = {};
|
||||
temp.name = arg[i];
|
||||
temp.type = arg[i+1];
|
||||
table.insert(x, temp);
|
||||
end
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipQuestUIInfo_Retail(gquis)
|
||||
function TI_TabulateGossipQuestUIInfo(gquis)
|
||||
local x = {};
|
||||
|
||||
for i,gqui in ipairs(gquis) do
|
||||
@ -710,7 +699,7 @@ function TI_TabulateGossipQuestUIInfo_Retail(gquis)
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipUIInfo_Retail(guis)
|
||||
function TI_TabulateGossipUIInfo(guis)
|
||||
local x = {};
|
||||
table.sort(guis, GossipOptionSort);
|
||||
for i,gui in ipairs(guis) do
|
||||
@ -724,109 +713,85 @@ function TI_TabulateGossipUIInfo_Retail(guis)
|
||||
temp.icon = gui.icon;
|
||||
temp.gossipOptionID = gui.gossipOptionID
|
||||
temp.orderIndex = gui.orderIndex
|
||||
temp.args = gui.orderIndex
|
||||
table.insert(x, temp);
|
||||
end
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipAvailableQuests_Classic(...)
|
||||
|
||||
function TI_TabulateGossipAvailableQuests_Classic(gquis)
|
||||
local x = {};
|
||||
local idx = 1;
|
||||
|
||||
for i=1, select("#", ...), 7 do
|
||||
for i,gqui in ipairs(gquis) do
|
||||
local temp = {};
|
||||
temp.name = select(i, ...);
|
||||
temp.name = gqui.title;
|
||||
|
||||
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
|
||||
if ( gqui.repeatable ) then
|
||||
temp.icon = "Interface\\GossipFrame\\DailyQuestIcon";
|
||||
elseif ( isRepeatable ) then
|
||||
temp.icon = "Interface\\GossipFrame\\DailyActiveQuestIcon";
|
||||
elseif ( isLegendary ) then
|
||||
elseif ( gqui.isLegendary ) then
|
||||
temp.icon = "Interface\\GossipFrame\\AvailableLegendaryQuestIcon";
|
||||
else
|
||||
temp.icon = "Interface\\GossipFrame\\AvailableQuestIcon";
|
||||
end
|
||||
temp.questID = idx;
|
||||
temp.questID = gqui.questID;
|
||||
temp.isComplete = gqui.isComplete;
|
||||
|
||||
table.insert(x, temp);
|
||||
idx = idx + 1;
|
||||
end
|
||||
return x;
|
||||
end
|
||||
|
||||
function TI_TabulateGossipActiveQuests_Classic(...)
|
||||
function TI_TabulateGossipActiveQuests_Classic(gquis)
|
||||
local x = {};
|
||||
local idx = 1;
|
||||
|
||||
for i=1, select("#", ...), 6 do
|
||||
for i,gqui in ipairs(gquis) do
|
||||
local temp = {};
|
||||
temp.name = select(i, ...);
|
||||
temp.name = gqui.title;
|
||||
|
||||
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
|
||||
if ( gqui.repeatable ) then
|
||||
temp.icon = "Interface\\GossipFrame\\DailyQuestIcon";
|
||||
elseif ( gqui.isLegendary ) then
|
||||
temp.icon = "Interface\\GossipFrame\\AvailableLegendaryQuestIcon";
|
||||
else
|
||||
temp.icon = "Interface\\GossipFrame\\IncompleteQuestIcon";
|
||||
temp.icon = "Interface\\GossipFrame\\AvailableQuestIcon";
|
||||
end
|
||||
temp.questID = idx;
|
||||
temp.questID = gqui.questID;
|
||||
temp.isComplete = gqui.isComplete;
|
||||
|
||||
table.insert(x, temp);
|
||||
idx = idx + 1;
|
||||
end
|
||||
return x;
|
||||
end
|
||||
|
||||
-- set up functions by release type
|
||||
if (TI_IsRetail()) then
|
||||
TI_FunctionList = {}
|
||||
function TI_SetupFunctions()
|
||||
TI_FunctionList = {
|
||||
g = {
|
||||
availquest = C_GossipInfo.SelectAvailableQuest,
|
||||
activequest = C_GossipInfo.SelectActiveQuest,
|
||||
gossip = SelectGossipOption,
|
||||
gossip = C_GossipInfo.SelectOptionByIndex,
|
||||
getavailquests = C_GossipInfo.GetAvailableQuests,
|
||||
getactivequests = C_GossipInfo.GetActiveQuests,
|
||||
getoptions = C_GossipInfo.GetOptions,
|
||||
tabulateAvailable = TI_TabulateGossipQuestUIInfo_Retail,
|
||||
tabulateActive = TI_TabulateGossipQuestUIInfo_Retail,
|
||||
tabulateOptions = TI_TabulateGossipUIInfo_Retail,
|
||||
tabulateOptions = TI_TabulateGossipUIInfo,
|
||||
},
|
||||
q = {
|
||||
activequest = SelectActiveQuest,
|
||||
availquest = SelectAvailableQuest,
|
||||
}
|
||||
};
|
||||
else
|
||||
TI_FunctionList = {
|
||||
g = {
|
||||
availquest = C_GossipInfo.SelectAvailableQuest,
|
||||
activequest = C_GossipInfo.SelectActiveQuest,
|
||||
gossip = SelectGossipOption,
|
||||
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 = SelectActiveQuest,
|
||||
availquest = SelectAvailableQuest,
|
||||
}
|
||||
};
|
||||
}
|
||||
if QuestUtil.GetQuestIconOffer then
|
||||
TI_FunctionList.g.tabulateAvailable = TI_TabulateGossipQuestUIInfo
|
||||
TI_FunctionList.g.tabulateActive = TI_TabulateGossipQuestUIInfo
|
||||
else
|
||||
TI_FunctionList.g.tabulateAvailable = TI_TabulateGossipAvailableQuests_Classic
|
||||
TI_FunctionList.g.tabulateActive = TI_TabulateGossipActiveQuests_Classic
|
||||
end
|
||||
end
|
||||
TI_SetupFunctions()
|
||||
|
||||
|
||||
--[[this function stolen from WhisperCast by Sarris, whom I love dearly for his contribution to Paladins everywhere.
|
||||
]]
|
||||
function TI_copyTable( src )
|
||||
local copy = {}
|
||||
for k1,v1 in pairs(src) do
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
## Interface: 100005
|
||||
## X-Compatible-With: 100005
|
||||
## Interface: 120100, 120000, 120001, 50503, 40402, 30405, 20505, 11508
|
||||
## X-Compatible-With: 120100, 120000, 120001, 50503, 40402, 30405, 20505, 11508
|
||||
## Title: Turn In
|
||||
## Notes: Automates the selection of quest and gossip options.
|
||||
## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
## Interface: 30401
|
||||
## X-Compatible-With: 30401
|
||||
## 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