| Turn In | |||||
| v2.0 | |||||
| by Sabindeus of Smolderthorn/Andre of Argent Dawn (Alliance) | |||||
| DESCRIPTION | |||||
| ------------- | |||||
| An add-on that automates the clicking of Quests and NPC Gossip dialogues. | |||||
| HOW TO USE | |||||
| ------------- | |||||
| To bring up the Options window, type /ti window. | |||||
| To bring up the Recently Visited NPCs window, type /ti templist. | |||||
| Turn In keeps an NPC database, to allow you to customize your interactions on a per-NPC basis. Whenever you talk to an NPC, it appears in your Recently Visited NPCs window. From there you can decide if you want to add it to the Database so you can customize his options. Simply click the '+' button to add the NPC to the DB. | |||||
| After Adding an NPC, you can check the checkbox next to its name in the NPC list and then rearrange or activate/deactive his options to your liking. If you uncheck the checkbox next to an NPC's name, it will use the default option set. If you want Turn In to specifically take no action for an NPC, simply deactivate all of his options, don't uncheck his checkbox in the NPC list! | |||||
| When an NPC does not appear in the Database, Turn In uses the default option set to resolve interactions with it. You can customize the default option set by not having an NPC selected in the options window. The Use Default Settings checkbox determines whether talking to NPC not in the Database will use the default options or do nothing at all. The Automatically Add NPCs checkbox will cause all of your new NPC visits to automatically add the NPC to your NPC DB. | |||||
| COMMAND SUMMARY | |||||
| ------------- | |||||
| /turnin or /ti - basic slash command, shows help message | |||||
| /turnin on - Turns on the mod, from now on all quests will be automatically chosen and completed. Additionally, any available quests will be accepted, and gossip options will be automatically chosen. | |||||
| /turnin off - Deactivates the mod | |||||
| /turnin toggle - Activates or deactivates the mod | |||||
| /turnin window - Shows the options window | |||||
| /turnin recent - Shows the recently visited NPCs window | |||||
| CHANGE LOG | |||||
| ------------- | |||||
| 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 for beta testing like a pro! | |||||
| Please send bug reports, questions or comments to Sabin1936@mac.com | |||||
| Thank you for downloading my add-on! |
| --[[ | |||||
| Turn-In Mod | |||||
| version 2.0 | |||||
| Authored by Ian Friedman | |||||
| Sabindeus of Smolderthorn/Andre of Argent Dawn (Alliance) | |||||
| The repeatable quest turn in automating machine. | |||||
| todo: | |||||
| make selection work for multiple active quests | |||||
| ]] | |||||
| TI_VersionString = "2.0"; | |||||
| local TI_slashtable; | |||||
| TI_gossipclosed = false; | |||||
| TI_LoadedNPCIndex = 0; | |||||
| TI_activenumber = 1; | |||||
| TI_availnumber = 1; | |||||
| TI_specnum = 0; | |||||
| TI_gossipopts = {}; | |||||
| TI_TempNPCList = {}; | |||||
| TI_TempNPCListMaxSize = 5; | |||||
| TI_NPCInQuestion = nil; | |||||
| local TI_GossipDefaults = { | |||||
| availquest ="Available Quests", | |||||
| activequest = "Active Quests", | |||||
| gossip = "Gossip", | |||||
| vendor = "Vendor", | |||||
| taxi = "Taxi", | |||||
| trainer = "Trainer", | |||||
| battlemaster = "Battlemaster", | |||||
| binder = "Hearthstone Binder", | |||||
| healer = "Spirit Healer", | |||||
| banker = "Bank" | |||||
| }; | |||||
| local TI_FunctionList = { | |||||
| g = { | |||||
| availquest = SelectGossipAvailableQuest, | |||||
| activequest = SelectGossipActiveQuest, | |||||
| default = SelectGossipOption | |||||
| }, | |||||
| q = { | |||||
| availquest = SelectAvailableQuest, | |||||
| activequest = SelectActiveQuest | |||||
| } | |||||
| }; | |||||
| local TI_DefaultStatus = { | |||||
| state = false, | |||||
| version = TI_VersionString, | |||||
| options = {}, | |||||
| debugstate = false, | |||||
| usedefault=true, | |||||
| autoadd=false | |||||
| }; | |||||
| local TI_events = { | |||||
| "GOSSIP_SHOW", | |||||
| "GOSSIP_CLOSED", | |||||
| "QUEST_DETAIL", | |||||
| "QUEST_COMPLETE", | |||||
| "QUEST_PROGRESS", | |||||
| "QUEST_GREETING", | |||||
| "QUEST_FINISHED" | |||||
| }; | |||||
| TI_TempNPCList = {}; | |||||
| function TI_message(...) | |||||
| local x = {...}; | |||||
| for k,v in pairs(x) do | |||||
| DEFAULT_CHAT_FRAME:AddMessage(tostring(v)); | |||||
| end | |||||
| end | |||||
| function TI_debug(...) | |||||
| if(TI_status.debugstate) then | |||||
| TI_message(...) | |||||
| end | |||||
| end | |||||
| function TI_OnLoad() | |||||
| SlashCmdList["TI"]=TI_SlashCmdHandler; | |||||
| SLASH_TI1="/turnin"; | |||||
| SLASH_TI2="/ti"; | |||||
| tinsert(UISpecialFrames,"TI_OptionsFrame"); | |||||
| TI_message("Turn In loaded"); | |||||
| TI_slashtable = {}; | |||||
| TI_gossipopts = {}; | |||||
| TI_gossipclosed = false; | |||||
| TurnIn:RegisterEvent("VARIABLES_LOADED"); | |||||
| TI_activenumber = 1; | |||||
| TI_availnumber = 1; | |||||
| TI_specnum = 0; | |||||
| StaticPopupDialogs["TI_NPCINQUESTION"] = { | |||||
| text = "The NPC %s is already in your NPC Database. Do you wish to replace his gossip options with the current ones? (Note: This will overwrite your settings for this NPC.)", | |||||
| button1 = "Yes", | |||||
| button2 = "No", | |||||
| OnAccept = function() | |||||
| TI_AddNPCToList(TI_NPCInQuestion.list, TI_NPCInQuestion.name, true); | |||||
| end, | |||||
| timeout=0, | |||||
| whileDead = 1, | |||||
| hideOnEscape = 1 | |||||
| }; | |||||
| end | |||||
| function TI_VarInit() | |||||
| if(not TI_status or TI_status.version ~= TI_VersionString) then | |||||
| TI_status = TI_copyTable(TI_DefaultStatus); | |||||
| TI_OptionsInit(); | |||||
| end | |||||
| if(not TI_status.options or #TI_status.options == 0) then | |||||
| TI_OptionsInit(); | |||||
| end | |||||
| if(not TI_NPCDB) then | |||||
| TI_NPCDB = {}; | |||||
| end | |||||
| if(not TI_NPCIndex) then | |||||
| TI_NPCIndexGenerate(); | |||||
| end | |||||
| TI_PopulateOptions("vars loaded"); | |||||
| end | |||||
| function TI_OptionsInit() | |||||
| TI_status.options = {}; | |||||
| for k,v in pairs(TI_GossipDefaults) do | |||||
| local temp = {}; | |||||
| temp.name = v; | |||||
| temp.type = k; | |||||
| temp.state = false; | |||||
| table.insert(TI_status.options, temp); | |||||
| end | |||||
| end | |||||
| function TI_NPCIndexGenerate() | |||||
| TI_NPCIndex = {}; | |||||
| for k,v in pairs(TI_NPCDB) do | |||||
| table.insert(TI_NPCIndex, k); | |||||
| end | |||||
| table.sort(TI_NPCIndex); | |||||
| end | |||||
| function TI_LoadEvents() | |||||
| for k,v in pairs(TI_events) do | |||||
| TurnIn:RegisterEvent(v); | |||||
| end | |||||
| end | |||||
| function TI_ResetPointers() | |||||
| TI_activenumber = 1; | |||||
| TI_availnumber = 1; | |||||
| TI_specnum = 0; | |||||
| end | |||||
| function TI_UnloadEvents() | |||||
| for k,v in pairs(TI_events) do | |||||
| TurnIn:UnregisterEvent(v); | |||||
| end | |||||
| end | |||||
| function TI_Switch(state) | |||||
| if(state=="on") then | |||||
| TI_status.state = true; | |||||
| TI_LoadEvents(); | |||||
| TI_message("Turn In On"); | |||||
| elseif(state=="off") then | |||||
| TI_ResetPointers(); | |||||
| TI_status.state = false; | |||||
| TI_UnloadEvents(); | |||||
| TI_message("Turn In Off"); | |||||
| elseif(state=="toggle") then | |||||
| if(TI_status.state) then | |||||
| TI_Switch("off"); | |||||
| else | |||||
| TI_Switch("on"); | |||||
| end | |||||
| end | |||||
| TI_StatusIndicatorUpdate(); | |||||
| end | |||||
| function TI_SlashCmdHandler(cmd) | |||||
| cmdlist = {strsplit(" ", cmd)}; | |||||
| local commands = { | |||||
| on = function () | |||||
| TI_Switch("on"); | |||||
| end, | |||||
| off = function () | |||||
| TI_Switch("off"); | |||||
| end, | |||||
| toggle = function () | |||||
| TI_Switch("toggle"); | |||||
| end, | |||||
| status = function () | |||||
| if(TI_status.state) then | |||||
| TI_message("Turn In On"); | |||||
| else | |||||
| TI_message("Turn In Off"); | |||||
| end | |||||
| TI_message(string.format("Option Number set to %d", TI_status.qnum)); | |||||
| end, | |||||
| window = function () | |||||
| TI_OptionsFrame:Show(); | |||||
| end, | |||||
| recent = function () | |||||
| TI_TempNPCListWindow:Show(); | |||||
| end, | |||||
| debug = function () | |||||
| if(TI_status.debugstate) then | |||||
| TI_status.debugstate = false; | |||||
| TI_message("debug mode off"); | |||||
| else | |||||
| TI_status.debugstate = true; | |||||
| TI_message("debug mode on"); | |||||
| end | |||||
| end | |||||
| }; | |||||
| if(commands[cmdlist[1]]) then | |||||
| commands[cmdlist[1]](cmdlist[2], cmdlist[3], cmdlist[4]); | |||||
| 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"); | |||||
| end | |||||
| end | |||||
| function TI_IsNPCOn(npcname, type) | |||||
| local opton = false; | |||||
| if(type ~= nil) then | |||||
| for k,v in pairs(TI_status.options) do | |||||
| if(v.type == type and v.state == true) then | |||||
| opton = true; | |||||
| end | |||||
| end | |||||
| else | |||||
| opton = true; | |||||
| end | |||||
| if(TI_NPCDB[npcname] == nil and TI_status.usedefault == true and opton == true) then | |||||
| TI_debug("case 1"); | |||||
| return true; | |||||
| elseif(TI_NPCDB[npcname] ~= nil and TI_NPCDB[npcname].state) then | |||||
| TI_debug("case 2"); | |||||
| return true; | |||||
| elseif(TI_NPCDB[npcname] ~= nil and TI_status.usedefault == true and not TI_NPCDB[npcname].state and opton == true) then | |||||
| TI_debug("case 4"); | |||||
| return true; | |||||
| else | |||||
| TI_debug("case 3"); | |||||
| return false; | |||||
| end | |||||
| end | |||||
| function TI_OnEvent(event) | |||||
| if(event == "VARIABLES_LOADED") then | |||||
| TI_VarInit(); | |||||
| if(TI_status.state) then | |||||
| TI_LoadEvents(); | |||||
| end | |||||
| end | |||||
| if(TI_status.state and not IsShiftKeyDown()) then | |||||
| if(event == "QUEST_GREETING") then | |||||
| TI_debug("Quest Greeting"); | |||||
| TI_lastquestframe = "greeting"; | |||||
| if(QuestFrame:IsVisible()) then | |||||
| if(TI_gossipclosed) then | |||||
| TI_debug("resetting pointers"); | |||||
| TI_gossipclosed = false; | |||||
| TI_ResetPointers(); | |||||
| end | |||||
| TI_HandleGossipWindow("q"); | |||||
| end | |||||
| end | |||||
| if(event == "GOSSIP_SHOW") then | |||||
| TI_debug("Gossip Show"); | |||||
| if(GossipFrame:IsVisible()) then | |||||
| if(TI_gossipclosed) then | |||||
| TI_debug("resetting pointers"); | |||||
| TI_gossipclosed = false; | |||||
| TI_ResetPointers(); | |||||
| end | |||||
| TI_HandleGossipWindow("g"); | |||||
| end | |||||
| end | |||||
| if(event == "GOSSIP_CLOSED") then | |||||
| TI_debug("Gossip Closed"); | |||||
| if(not GossipFrame:IsVisible()) then | |||||
| TI_gossipclosed = true; | |||||
| end; | |||||
| end | |||||
| if(event == "QUEST_COMPLETE") then | |||||
| TI_debug("Quest Complete"); | |||||
| if(TI_IsNPCOn(UnitName("npc"), "activequest")) then | |||||
| if(not (GetNumQuestChoices() > 1)) then | |||||
| GetQuestReward(1); | |||||
| end | |||||
| end | |||||
| TI_ResetPointers(); | |||||
| end | |||||
| if(event == "QUEST_PROGRESS") then | |||||
| TI_debug("Quest Progress"); | |||||
| TI_gossipclosed = false; | |||||
| TI_lastquestframe = "progress"; | |||||
| TI_HandleQuestProgress(); | |||||
| end | |||||
| if(event == "QUEST_DETAIL") then | |||||
| TI_debug("Quest Detail"); | |||||
| TI_gossipclosed = false; | |||||
| if(TI_IsNPCOn(UnitName("npc"), "availquest")) then | |||||
| AcceptQuest(); | |||||
| end | |||||
| TI_ResetPointers(); | |||||
| end | |||||
| if(event == "QUEST_FINISHED") then | |||||
| TI_debug("Quest Finished"); | |||||
| if(not QuestFrame:IsVisible() and TI_lastquestframe == "greeting") then | |||||
| TI_debug("looks like the quest frame closed, resetting pointers on next open"); | |||||
| TI_gossipclosed = true; | |||||
| end | |||||
| end | |||||
| end | |||||
| end | |||||
| function TI_HandleQuestProgress() | |||||
| local questname = GetTitleText(); | |||||
| local npcname = UnitName("npc"); | |||||
| if(QuestFrame:IsVisible()) then | |||||
| if(TI_NPCDB[npcname]) then | |||||
| local thisnpc = TI_NPCDB[npcname]; | |||||
| if(thisnpc.state) then | |||||
| for i,current in ipairs(thisnpc) do | |||||
| if(current.name == questname and current.state) then | |||||
| TI_CompleteQuest(); | |||||
| end | |||||
| end | |||||
| else | |||||
| if(TI_IsNPCOn(UnitName("npc"), "activequest")) then | |||||
| TI_CompleteQuest(); | |||||
| end | |||||
| end | |||||
| else | |||||
| if(TI_IsNPCOn(UnitName("npc"), "activequest")) then | |||||
| TI_CompleteQuest(); | |||||
| end | |||||
| end | |||||
| end | |||||
| end | |||||
| function TI_CompleteQuest() | |||||
| if(IsQuestCompletable()) then | |||||
| CompleteQuest(); | |||||
| TI_ResetPointers(); | |||||
| else | |||||
| DeclineQuest(); | |||||
| end | |||||
| end | |||||
| function TI_GetQuests(type) | |||||
| local numQuests = (getglobal("GetNum"..type.."Quests"))(); | |||||
| local qfn = getglobal("Get"..type.."Title"); | |||||
| local ret = {}; | |||||
| local qname; | |||||
| local i=1; | |||||
| for i=1,numQuests do | |||||
| qname = qfn(i); | |||||
| ret[i] = {name=qname}; | |||||
| end | |||||
| return ret; | |||||
| end | |||||
| function TI_HandleGossipWindow(gorq) | |||||
| local SAcQ; | |||||
| local SAvQ; | |||||
| local AvailableQuests; | |||||
| local ActiveQuests; | |||||
| local GossipOptions; | |||||
| if(gorq == "g") then | |||||
| AvailableQuests = TI_Tabulate(GetGossipAvailableQuests()); | |||||
| ActiveQuests = TI_Tabulate(GetGossipActiveQuests()); | |||||
| GossipOptions = TI_Tabulate(GetGossipOptions()); | |||||
| SAcQ = SelectGossipActiveQuest; | |||||
| SAvQ = SelectGossipAvailableQuest; | |||||
| elseif(gorq == "q") then | |||||
| AvailableQuests = TI_GetQuests("Available"); | |||||
| ActiveQuests = TI_GetQuests("Active"); | |||||
| GossipOptions = {}; | |||||
| SAcQ=SelectActiveQuest; | |||||
| SAvQ=SelectAvailableQuest; | |||||
| end | |||||
| local ListEntry = {}; | |||||
| for i,v in ipairs(AvailableQuests) do | |||||
| local x={}; | |||||
| x.name = v.name; | |||||
| x.gorq = gorq; | |||||
| x.args = i; | |||||
| x.type = "availquest"; | |||||
| x.state = false; | |||||
| table.insert(ListEntry, x); | |||||
| end | |||||
| for i,v in ipairs(ActiveQuests) do | |||||
| local x={}; | |||||
| x.name = v.name; | |||||
| x.gorq = gorq; | |||||
| x.args = i; | |||||
| x.type = "activequest"; | |||||
| x.state = false; | |||||
| table.insert(ListEntry, x); | |||||
| end | |||||
| for i,v in ipairs(GossipOptions) do | |||||
| local x={}; | |||||
| x.name = v.name; | |||||
| x.gorq = gorq; | |||||
| x.args = i; | |||||
| x.type = v.type; | |||||
| x.state = false; | |||||
| table.insert(ListEntry, x); | |||||
| end | |||||
| ListEntry.state = false; | |||||
| local TotalOptions = #AvailableQuests+#ActiveQuests+#GossipOptions; | |||||
| --if(TI_activenumber > ActiveQuests.getn()) TI_activenumber = 1; | |||||
| if(TotalOptions < 1) then | |||||
| return; | |||||
| 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); | |||||
| end | |||||
| if(TI_availnumber > TotalOptions or TI_activenumber > TotalOptions) then | |||||
| TI_ResetPointers(); | |||||
| return; | |||||
| 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); | |||||
| if(TI_NPCDB[npcname]) then | |||||
| local thisnpc = TI_NPCDB[npcname]; | |||||
| if(thisnpc.state) then | |||||
| 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); | |||||
| end | |||||
| return; | |||||
| end | |||||
| end | |||||
| end | |||||
| return; | |||||
| else | |||||
| TI_debug("npc in list, but not active"); | |||||
| 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; | |||||
| end; | |||||
| TI_debug("using default config"); | |||||
| for i,current in ipairs(TI_status.options) do | |||||
| if(current.state) then | |||||
| if(current.type == "availquest" and #AvailableQuests > 0 and TI_availnumber <= #AvailableQuests) then | |||||
| TI_availnumber = TI_availnumber + 1; | |||||
| SAvQ(TI_availnumber-1); | |||||
| TI_debug("Selecting Available Quest ".. TI_availnumber-1); | |||||
| return; | |||||
| elseif(current.type == "activequest" and #ActiveQuests > 0 and TI_activenumber <= #ActiveQuests) then | |||||
| TI_activenumber = TI_activenumber + 1; | |||||
| SAcQ(TI_activenumber-1); | |||||
| TI_debug("Selecting Active Quest ".. TI_activenumber-1); | |||||
| return; | |||||
| elseif(#GossipOptions > 0) then | |||||
| for j,val in ipairs(GossipOptions) do | |||||
| if(val.type == current.type) then | |||||
| TI_ResetPointers(); | |||||
| SelectGossipOption(j); | |||||
| return; | |||||
| end | |||||
| end | |||||
| end | |||||
| end | |||||
| end | |||||
| end | |||||
| function TI_AddNPCToList(OptList, npcname, confirminquestion) | |||||
| --~ NPClist = { | |||||
| --~ "Joe" = { | |||||
| --~ 0 = { | |||||
| --~ name = "Option 1" | |||||
| --~ accessor = SelectGossipOption | |||||
| --~ args = 0 | |||||
| --~ } | |||||
| --~ } | |||||
| --~ } | |||||
| if (npcname == nil) then | |||||
| npcname = UnitName("npc"); | |||||
| end | |||||
| if(#OptList > 0) then | |||||
| if(TI_NPCDB[npcname] == nil) then | |||||
| TI_NPCDB[npcname] = TI_copyTable(OptList); | |||||
| table.insert(TI_NPCIndex, npcname); | |||||
| table.sort(TI_NPCIndex); | |||||
| TI_PopulateOptions("npclist updated"); | |||||
| elseif(confirminquestion == true) then | |||||
| TI_NPCDB[npcname] = TI_copyTable(OptList); | |||||
| TI_PopulateOptions("npclist updated"); | |||||
| else | |||||
| TI_NPCInQuestion = {name=npcname, list=OptList}; | |||||
| StaticPopup_Show("TI_NPCINQUESTION", npcname); | |||||
| end | |||||
| end | |||||
| end | |||||
| function TI_AddNPCToTempList(name, list) | |||||
| local temp = {}; | |||||
| temp.name = name; | |||||
| temp.list = list; | |||||
| temp.location = GetSubZoneText() .. ", " .. GetRealZoneText(); | |||||
| table.insert(TI_TempNPCList, 1, temp); | |||||
| if(#TI_TempNPCList > TI_TempNPCListMaxSize) then | |||||
| table.remove(TI_TempNPCList, TI_TempNPCListMaxSize); | |||||
| end | |||||
| TI_TempNPCListUpdate(); | |||||
| end | |||||
| function TI_DeleteTempNPCIndex(index) | |||||
| table.remove(TI_TempNPCList, index); | |||||
| TI_TempNPCListUpdate(); | |||||
| end | |||||
| function TI_AddTempNPCIndex(index) | |||||
| TI_AddNPCToList(TI_TempNPCList[index].list, TI_TempNPCList[index].name); | |||||
| end | |||||
| function TI_DeleteNPC(index) | |||||
| local name = TI_NPCIndex[index]; | |||||
| table.remove(TI_NPCIndex, index); | |||||
| TI_NPCDB[name] = nil; | |||||
| end | |||||
| function TI_StripDescriptors(...) | |||||
| local x = {}; | |||||
| local arg = {...}; | |||||
| for i=1, #arg, 2 do | |||||
| table.insert(x,arg[i]); | |||||
| end | |||||
| return x; | |||||
| end | |||||
| function TI_Tabulate(...) | |||||
| 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 | |||||
| --[[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 | |||||
| if ( type(v1) == "table" ) then | |||||
| copy[k1]=TI_copyTable(v1) | |||||
| else | |||||
| copy[k1]=v1 | |||||
| end | |||||
| end | |||||
| return copy | |||||
| end | |||||
| function toggle(arg) | |||||
| if(arg) then | |||||
| return false; | |||||
| else | |||||
| return true; | |||||
| end | |||||
| end |
| ## Interface: 20003 | |||||
| ## Title: Turn In | |||||
| ## Description: Automates the selection of quest and gossip options. | |||||
| ## SavedVariables: TI_status, TI_NPCDB, TI_NPCIndex | |||||
| ## Version: 2.0rc7 | |||||
| TurnIn.xml |
| <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> | |||||
| <Script file="TurnIn.lua" /> | |||||
| <Script file="TurnInUI.lua" /> | |||||
| <Button name="TI_PriorityList" virtual="true" hidden="false"> | |||||
| <Size> | |||||
| <AbsDimension x="235" y="20" /> | |||||
| </Size> | |||||
| <Scripts><!-- | |||||
| <OnEnter> | |||||
| getglobal(this:GetName() .. "_Background"):SetVertexColor(1,1,1,0.4); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| getglobal(this:GetName() .. "_Background"):SetVertexColor(0,0,0,0.4); | |||||
| </OnLeave> | |||||
| --> | |||||
| </Scripts> | |||||
| <Frames> | |||||
| <CheckButton name="$parent_Check" hidden="false" inherits="OptionsCheckButtonTemplate"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"/> | |||||
| </Anchors> | |||||
| <HitRectInsets> | |||||
| <AbsInset left="0" right="0" top="0" bottom="0"/> | |||||
| </HitRectInsets> | |||||
| <Size> | |||||
| <AbsDimension x="20" y="22"/> | |||||
| </Size> | |||||
| <Scripts> | |||||
| <OnEnter> | |||||
| TI_OptionListCheckboxTooltip(); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| TI_TooltipHide(); | |||||
| </OnLeave> | |||||
| <OnClick> | |||||
| TI_OptionToggle(); | |||||
| </OnClick> | |||||
| </Scripts> | |||||
| </CheckButton> | |||||
| <Button name="$parent_MoveDown" hidden="false"> | |||||
| <Size> | |||||
| <AbsDimension x="24" y="24"/> | |||||
| </Size> | |||||
| <Anchors> | |||||
| <Anchor point="TOPRIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Scripts> | |||||
| <OnEnter> | |||||
| TI_TooltipMessage("Decrease this option's priority."); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| TI_TooltipHide(); | |||||
| </OnLeave> | |||||
| <OnClick> | |||||
| TI_OptionMove(1); | |||||
| </OnClick> | |||||
| </Scripts> | |||||
| <NormalTexture file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Up"/> | |||||
| <PushedTexture file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Down"/> | |||||
| <DisabledTexture file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Disabled"/> | |||||
| <HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/> | |||||
| </Button> | |||||
| <Button name="$parent_MoveUp" hidden="false"> | |||||
| <Size> | |||||
| <AbsDimension x="24" y="24"/> | |||||
| </Size> | |||||
| <Anchors> | |||||
| <Anchor point="RIGHT" relativePoint="LEFT" relativeTo="$parent_MoveDown"> | |||||
| <Offset> | |||||
| <AbsDimension x="3" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Scripts> | |||||
| <OnClick> | |||||
| TI_OptionMove(-1); | |||||
| </OnClick> | |||||
| <OnEnter> | |||||
| TI_TooltipMessage("Increase this option's priority."); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| TI_TooltipHide(); | |||||
| </OnLeave> | |||||
| </Scripts> | |||||
| <NormalTexture file="Interface\ChatFrame\UI-ChatIcon-ScrollUp-Up"/> | |||||
| <PushedTexture file="Interface\ChatFrame\UI-ChatIcon-ScrollUp-Down"/> | |||||
| <DisabledTexture file="Interface\ChatFrame\UI-ChatIcon-ScrollUp-Disabled"/> | |||||
| <HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/> | |||||
| </Button> | |||||
| </Frames> | |||||
| <Layers> | |||||
| <Layer level="ARTWORK"> | |||||
| <Texture name="$parent_Icon" file="Interface\QuestFrame\UI-Quest-BulletPoint"> | |||||
| <Size> | |||||
| <AbsDimension x="16" y="16"/> | |||||
| </Size> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="20" y="-3"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Texture> | |||||
| <FontString name="$parent_Text" inherits="GameFontNormal" justifyV="top" justifyH="left"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativeTo="$parent_Icon" relativePoint="TOPRIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="-1"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| <Anchor point="TOPRIGHT" relativeTo="$parent_MoveUp" relativePoint="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| </Layer> | |||||
| <Layer level="BACKGROUND"> | |||||
| <Texture name="$parent_Background" setAllPoints="true"> | |||||
| <Color r="0.2" g="0.2" b="1" a="0.0" /> | |||||
| </Texture> | |||||
| </Layer> | |||||
| </Layers> | |||||
| <!--<NormalText name="$parent_Text" justifyV="top" justifyH="left" inherits="GameFontNormal" nonspacewrap="true"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativeTo="$parent_Icon" relativePoint="TOPRIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="-1"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| <Anchor point="TOPRIGHT" relativeTo="$parent_MoveUp" relativePoint="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="156" y="0" /> | |||||
| </Size> | |||||
| </NormalText>--> | |||||
| </Button> | |||||
| <Button name="TI_NPCList" virtual="true" hidden="false"> | |||||
| <Size> | |||||
| <AbsDimension x="232" y="20" /> | |||||
| </Size> | |||||
| <Frames> | |||||
| <CheckButton name="$parent_Check" hidden="false" inherits="OptionsCheckButtonTemplate"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"/> | |||||
| </Anchors> | |||||
| <HitRectInsets> | |||||
| <AbsInset left="0" right="0" top="0" bottom="0"/> | |||||
| </HitRectInsets> | |||||
| <Size> | |||||
| <AbsDimension x="20" y="22"/> | |||||
| </Size> | |||||
| <Scripts> | |||||
| <OnClick> | |||||
| TI_NPCToggle(); | |||||
| TI_NPCListCheckboxTooltip(); | |||||
| </OnClick> | |||||
| <OnEnter> | |||||
| TI_NPCListCheckboxTooltip(); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| TI_TooltipHide(); | |||||
| </OnLeave> | |||||
| </Scripts> | |||||
| </CheckButton> | |||||
| <Button name="$parent_Delete" hidden="false" inherits="OptionsButtonTemplate" text="X"> | |||||
| <Anchors> | |||||
| <Anchor point="RIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="3" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="20" y="20" /> | |||||
| </Size> | |||||
| <Scripts> | |||||
| <OnEnter> | |||||
| TI_TooltipMessage("Delete this NPC."); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| TI_TooltipHide(); | |||||
| </OnLeave> | |||||
| <OnClick> | |||||
| TI_DeleteNPCIndex(); | |||||
| </OnClick> | |||||
| </Scripts> | |||||
| </Button> | |||||
| </Frames> | |||||
| <Layers> | |||||
| <Layer level="ARTWORK"> | |||||
| <FontString name="$parent_Text" justifyV="top" justifyH="left" inherits="GameFontNormal" text=""> | |||||
| <Anchors> | |||||
| <Anchor point="LEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="20" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| </Layer> | |||||
| </Layers> | |||||
| <Scripts> | |||||
| <OnClick> | |||||
| TI_SelectNPCIndex(); | |||||
| </OnClick> | |||||
| </Scripts> | |||||
| <HighlightTexture file="Interface\QuestFrame\UI-QuestTitleHighlight" alphaMode="ADD"/> | |||||
| </Button> | |||||
| <GameTooltip name="TI_Tooltip" hidden="true" inherits="GameTooltipTemplate" /> | |||||
| <Frame Name="TI_TempNPCListEntry" virtual="true" hidden="true"> | |||||
| <Scripts> | |||||
| <OnEnter> | |||||
| TI_TempNPCListTooltipShow(); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| TI_TooltipHide(); | |||||
| </OnLeave> | |||||
| </Scripts> | |||||
| <Size> | |||||
| <AbsDimension x="188" y="20" /> | |||||
| </Size> | |||||
| <Layers> | |||||
| <Layer level="ARTWORK"> | |||||
| <FontString name="$parent_Text" justifyV="top" justifyH="left" inherits="GameFontNormal" text=""> | |||||
| <Anchors> | |||||
| <Anchor point="LEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| </Layer> | |||||
| </Layers> | |||||
| <Frames> | |||||
| <Button name="$parent_Delete" hidden="false" inherits="OptionsButtonTemplate" text="X"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPRIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="2"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="20" y="20" /> | |||||
| </Size> | |||||
| <Scripts> | |||||
| <OnClick> | |||||
| TI_DeleteTempNPCIndex(this:GetParent():GetID()); | |||||
| </OnClick> | |||||
| <OnEnter> | |||||
| TI_TooltipMessage("Delete"); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| TI_TooltipHide(); | |||||
| </OnLeave> | |||||
| </Scripts> | |||||
| </Button> | |||||
| <Button name="$parent_Add" hidden="false" inherits="OptionsButtonTemplate" text="+"> | |||||
| <Anchors> | |||||
| <Anchor point="RIGHT" relativeTo="$parent_Delete" relativePoint="LEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="20" y="20" /> | |||||
| </Size> | |||||
| <Scripts> | |||||
| <OnClick> | |||||
| TI_AddTempNPCIndex(this:GetParent():GetID()); | |||||
| </OnClick> | |||||
| <OnEnter> | |||||
| TI_TooltipMessage("Add this NPC to the database"); | |||||
| </OnEnter> | |||||
| <OnLeave> | |||||
| TI_TooltipHide(); | |||||
| </OnLeave> | |||||
| </Scripts> | |||||
| </Button> | |||||
| </Frames> | |||||
| </Frame> | |||||
| <Frame Name="TI_TempNPCListWindow" parent="UIParent" frameStrata="DIALOG" toplevel="true" enableMouse="true" movable="true" hidden="true"> | |||||
| <Size> | |||||
| <AbsDimension x="200" y="130" /> | |||||
| </Size> | |||||
| <Anchors> | |||||
| <Anchor point="CENTER"/> | |||||
| </Anchors> | |||||
| <Layers> | |||||
| <Layer level="ARTWORK"> | |||||
| <FontString inherits="GameFontNormal" text="Recently Visited NPCs"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="TOPLEFT"> | |||||
| <Offset><AbsDimension x="6" y="-7" /></Offset> | |||||
| </Anchor> | |||||
| <Anchor point="TOPRIGHT"> | |||||
| <Offset><AbsDimension x="-6" y="-7" /></Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| </Layer> | |||||
| </Layers> | |||||
| <Frames> | |||||
| <Button name="$parent_Close" inherits="UIPanelCloseButton"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPRIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Frame name="$parent1" id="1" hidden="true" inherits="TI_TempNPCListEntry"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="TOPLEFT"> | |||||
| <Offset><AbsDimension x="6" y="-27" /></Offset> | |||||
| </Anchor> | |||||
| <!--<Anchor point="TOPRIGHT"> | |||||
| <Offset><AbsDimension x="-6" y="-27" /></Offset> | |||||
| </Anchor>--> | |||||
| </Anchors> | |||||
| </Frame> | |||||
| <Frame name="$parent2" id="2" hidden="true" inherits="TI_TempNPCListEntry"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent1"> | |||||
| <Offset><AbsDimension x="0" y="0" /></Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Frame> | |||||
| <Frame name="$parent3" id="3" hidden="true" inherits="TI_TempNPCListEntry"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent2"> | |||||
| <Offset><AbsDimension x="0" y="0" /></Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Frame> | |||||
| <Frame name="$parent4" id="4" hidden="true" inherits="TI_TempNPCListEntry"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent3"> | |||||
| <Offset><AbsDimension x="0" y="0" /></Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Frame> | |||||
| <Frame name="$parent5" id="5" hidden="true" inherits="TI_TempNPCListEntry"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent4"> | |||||
| <Offset><AbsDimension x="0" y="0" /></Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Frame> | |||||
| </Frames> | |||||
| <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\Tooltips\UI-Tooltip-Border" tile="true"> | |||||
| <EdgeSize> | |||||
| <AbsValue val="16"/> | |||||
| </EdgeSize> | |||||
| <TileSize> | |||||
| <AbsValue val="16"/> | |||||
| </TileSize> | |||||
| <BackgroundInsets> | |||||
| <AbsInset left="5" right="5" top="5" bottom="5"/> | |||||
| </BackgroundInsets> | |||||
| </Backdrop> | |||||
| <Scripts> | |||||
| <OnMouseUp> | |||||
| if ( this.isMoving ) then | |||||
| this:StopMovingOrSizing(); | |||||
| this.isMoving = false; | |||||
| end | |||||
| </OnMouseUp> | |||||
| <OnMouseDown> | |||||
| if ( arg1 == "LeftButton" ) then | |||||
| this:StartMoving(); | |||||
| this.isMoving = true; | |||||
| end | |||||
| </OnMouseDown> | |||||
| <OnHide> | |||||
| if ( this.isMoving ) then | |||||
| this:StopMovingOrSizing(); | |||||
| this.isMoving = false; | |||||
| end | |||||
| </OnHide> | |||||
| </Scripts> | |||||
| </Frame> | |||||
| <Frame Name="TI_OptionsFrame" frameStrata="DIALOG" toplevel="true" enableMouse="true" enableMouseWheel="true" movable="true" parent="UIParent"> | |||||
| <TitleRegion> | |||||
| <Size> | |||||
| <AbsDimension x="128" y="64"/> | |||||
| </Size> | |||||
| <Anchors> | |||||
| <Anchor point="TOP"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="12"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </TitleRegion> | |||||
| <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true"> | |||||
| <BackgroundInsets> | |||||
| <AbsInset left="11" right="12" top="12" bottom="11"/> | |||||
| </BackgroundInsets> | |||||
| <TileSize> | |||||
| <AbsValue val="32"/> | |||||
| </TileSize> | |||||
| <EdgeSize> | |||||
| <AbsValue val="32"/> | |||||
| </EdgeSize> | |||||
| </Backdrop> | |||||
| <Scripts> | |||||
| <OnShow> | |||||
| </OnShow> | |||||
| </Scripts> | |||||
| <Size> | |||||
| <AbsDimension x="300" y="500"/> | |||||
| </Size> | |||||
| <Anchors> | |||||
| <Anchor point="CENTER"/> | |||||
| </Anchors> | |||||
| <Layers> | |||||
| <Layer level="ARTWORK"> | |||||
| <Texture name="$parentOptionFrameHeader" file="Interface\DialogFrame\UI-DialogBox-Header"> | |||||
| <Size> | |||||
| <AbsDimension x="256" y="64"/> | |||||
| </Size> | |||||
| <Anchors> | |||||
| <Anchor point="TOP"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="12"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Texture> | |||||
| <FontString inherits="GameFontNormal" text="Turn In Options"> | |||||
| <Anchors> | |||||
| <Anchor point="TOP" relativeTo="$parentOptionFrameHeader"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="-14"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| </Layer> | |||||
| </Layers> | |||||
| <Frames> | |||||
| <Button name="$parent_Close" inherits="UIPanelCloseButton"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPRIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0"/> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Frame name="TI_StatusIndicator" hidden="false"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="16" y="-24" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="200" y="20" /> | |||||
| </Size> | |||||
| <Frames> | |||||
| <CheckButton name="$parent_Checkbox" hidden="false" inherits="OptionsCheckButtonTemplate"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <HitRectInsets> | |||||
| <AbsInset left="0" right="0" top="0" bottom="0"/> | |||||
| </HitRectInsets> | |||||
| <Size> | |||||
| <AbsDimension x="20" y="22"/> | |||||
| </Size> | |||||
| <Scripts> | |||||
| <OnClick> | |||||
| TI_StatusIndicator_CheckFn(); | |||||
| </OnClick> | |||||
| </Scripts> | |||||
| </CheckButton> | |||||
| </Frames> | |||||
| <Layers> | |||||
| <Layer level="OVERLAY"> | |||||
| <FontString name="$parent_Text" inherits="GameFontNormal" text="Turn In is "> | |||||
| <Anchors> | |||||
| <Anchor point="LEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="20" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| <FontString name="$parent_Status" inherits="GameFontNormal"> | |||||
| <Anchors> | |||||
| <Anchor point="LEFT" relativeTo="$parent_Text" relativePoint="RIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="1" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| </Layer> | |||||
| </Layers> | |||||
| <Scripts> | |||||
| <OnShow> | |||||
| TI_StatusIndicatorUpdate(); | |||||
| </OnShow> | |||||
| </Scripts> | |||||
| </Frame> | |||||
| <Frame name="TI_SettingCheckboxes" hidden="false"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativeTo="TI_StatusIndicator" relativePoint="BOTTOMLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="-10" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="200" y="40" /> | |||||
| </Size> | |||||
| <Frames> | |||||
| <CheckButton name="$parent_UseDefault" hidden="false" inherits="OptionsCheckButtonTemplate"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <HitRectInsets> | |||||
| <AbsInset left="0" right="0" top="0" bottom="0"/> | |||||
| </HitRectInsets> | |||||
| <Size> | |||||
| <AbsDimension x="20" y="22"/> | |||||
| </Size> | |||||
| <Scripts> | |||||
| <OnClick> | |||||
| TI_SettingCheckboxFn("usedefault"); | |||||
| </OnClick> | |||||
| </Scripts> | |||||
| </CheckButton> | |||||
| <CheckButton name="$parent_AddAutomatically" hidden="false" inherits="OptionsCheckButtonTemplate"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativeTo="$parent_UseDefault" relativePoint="BOTTOMLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <HitRectInsets> | |||||
| <AbsInset left="0" right="0" top="0" bottom="0"/> | |||||
| </HitRectInsets> | |||||
| <Size> | |||||
| <AbsDimension x="20" y="22"/> | |||||
| </Size> | |||||
| <Scripts> | |||||
| <OnClick> | |||||
| TI_SettingCheckboxFn("autoadd"); | |||||
| </OnClick> | |||||
| </Scripts> | |||||
| </CheckButton> | |||||
| </Frames> | |||||
| <Layers> | |||||
| <Layer level="OVERLAY"> | |||||
| <FontString name="$parent_UseDefault_Text" inherits="GameFontNormal" text="Use default options for unlisted NPCs"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="20" y="-4" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| <FontString name="$parent_AddAutomatically_Text" inherits="GameFontNormal" text="Automatically add new NPCs"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativeTo="$parent_UseDefault_Text" relativePoint="BOTTOMLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="-10" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| </Layer> | |||||
| </Layers> | |||||
| <Scripts> | |||||
| <OnShow> | |||||
| TI_SettingCheckboxUpdate(); | |||||
| </OnShow> | |||||
| </Scripts> | |||||
| </Frame> | |||||
| <Frame name="TI_OptionsPriorityContainer" inherits="OptionFrameBoxTemplate"> | |||||
| <Scripts> | |||||
| <OnLoad> | |||||
| this:SetBackdropBorderColor(0.4, 0.4, 0.4); | |||||
| this:SetBackdropColor(0.15, 0.15, 0.15); | |||||
| getglobal(this:GetName().."Title"):SetText("Gossip Options Priority List"); | |||||
| </OnLoad> | |||||
| </Scripts> | |||||
| <Anchors> | |||||
| <Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="16" y="16" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="264" y="176" /> | |||||
| </Size> | |||||
| <Frames> | |||||
| <ScrollFrame name="TI_OptionsPriorityScrollFrame" hidden="false" inherits="UIPanelScrollFrameTemplate"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="4" y="-8" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| <Anchor point="BOTTOMRIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="-28" y="8" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <ScrollChild> | |||||
| <Frame name="TI_OptionsPriority"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" /> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="200" y="30"/> | |||||
| </Size> | |||||
| <!--<Layers> | |||||
| <Layer level="OVERLAY"> | |||||
| <FontString name="$parentText" justifyV="top" justifyH="left" inherits="GameFontNormal" text="Gossip Options"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" /> | |||||
| </Anchors> | |||||
| </FontString> | |||||
| </Layer> | |||||
| <Layer level="BACKGROUND"> | |||||
| <Texture name="$parent_Background" setAllPoints="true"> | |||||
| <Color r="0" g="1" b="0" a="0.0"/> | |||||
| </Texture> | |||||
| </Layer> | |||||
| </Layers>--> | |||||
| <Frames> | |||||
| <Button name="$parent1" id="1" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent2" id="2" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent1"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent3" id="3" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent2"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent4" id="4" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent3"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent5" id="5" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent4"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent6" id="6" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent5"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent7" id="7" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent6"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent8" id="8" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent7"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent9" id="9" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent8"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent10" id="10" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent9"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent11" id="11" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent10"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent12" id="12" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent11"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent13" id="13" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent12"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent14" id="14" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent13"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent15" id="15" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent14"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent16" id="16" hidden="true" inherits="TI_PriorityList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent15"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| </Frames> | |||||
| </Frame> | |||||
| </ScrollChild> | |||||
| </ScrollFrame> | |||||
| </Frames> | |||||
| </Frame> | |||||
| <Frame name="TI_OptionsNPCContainer" inherits="OptionFrameBoxTemplate"> | |||||
| <Scripts> | |||||
| <OnLoad> | |||||
| this:SetBackdropBorderColor(0.4, 0.4, 0.4); | |||||
| this:SetBackdropColor(0.15, 0.15, 0.15); | |||||
| getglobal(this:GetName().."Title"):SetText("NPC Database"); | |||||
| </OnLoad> | |||||
| </Scripts> | |||||
| <Anchors> | |||||
| <Anchor point="BOTTOMLEFT" relativeTo="TI_OptionsPriorityContainer" relativePoint="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="16" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Size> | |||||
| <AbsDimension x="264" y="176" /> | |||||
| </Size> | |||||
| <Frames> | |||||
| <ScrollFrame name="TI_NPCListScrollFrame" inherits="FauxScrollFrameTemplate" hidden="false" enableMouseWheel="true"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="-28" y="-8" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| <Anchor point="BOTTOMRIGHT"> | |||||
| <Offset> | |||||
| <AbsDimension x="-28" y="8" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| <Scripts> | |||||
| <OnVerticalScroll> | |||||
| FauxScrollFrame_OnVerticalScroll(20, TI_NPCListScrollBarUpdate); | |||||
| </OnVerticalScroll> | |||||
| <OnShow> | |||||
| TI_NPCListScrollBarUpdate(); | |||||
| </OnShow> | |||||
| </Scripts> | |||||
| </ScrollFrame> | |||||
| <Button name="$parent1" hidden="true" inherits="TI_NPCList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT"> | |||||
| <Offset> | |||||
| <AbsDimension x="4" y="-8" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent2" hidden="true" inherits="TI_NPCList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent1"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent3" hidden="true" inherits="TI_NPCList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent2"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent4" hidden="true" inherits="TI_NPCList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent3"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent5" hidden="true" inherits="TI_NPCList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent4"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent6" hidden="true" inherits="TI_NPCList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent5"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent7" hidden="true" inherits="TI_NPCList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent6"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| <Button name="$parent8" hidden="true" inherits="TI_NPCList"> | |||||
| <Anchors> | |||||
| <Anchor point="TOPLEFT" relativePoint="BOTTOMLEFT" relativeTo="$parent7"> | |||||
| <Offset> | |||||
| <AbsDimension x="0" y="0" /> | |||||
| </Offset> | |||||
| </Anchor> | |||||
| </Anchors> | |||||
| </Button> | |||||
| </Frames> | |||||
| </Frame> | |||||
| </Frames> | |||||
| </Frame> | |||||
| <Frame name="TurnIn" hidden="true" frameStrata="LOW" enableMouse="false"> | |||||
| <Scripts> | |||||
| <OnLoad> | |||||
| TI_OnLoad(); | |||||
| </OnLoad> | |||||
| <OnEvent> | |||||
| TI_OnEvent(event); | |||||
| </OnEvent> | |||||
| </Scripts> | |||||
| </Frame> | |||||
| </Ui> |
| function TI_PopulateOptions(arg) | |||||
| TI_debug(arg); | |||||
| local CurrOpts; | |||||
| local last=1; | |||||
| if(TI_status and TI_status.options) then | |||||
| if(TI_LoadedNPCIndex > 0) then | |||||
| CurrOpts = TI_NPCDB[TI_NPCIndex[TI_LoadedNPCIndex]]; | |||||
| else | |||||
| CurrOpts = TI_status.options; | |||||
| end | |||||
| for i,v in ipairs(CurrOpts) do | |||||
| local entry = "TI_OptionsPriority" .. i; | |||||
| local entrybutton = getglobal(entry); | |||||
| local entrytext = getglobal("TI_OptionsPriority"..i.."_Text"); | |||||
| local iconpath; | |||||
| if(v.name == nil) then TI_debug("oh noes") end; | |||||
| entrytext:SetText(v.name); | |||||
| if(v.type == "activequest") then | |||||
| iconpath = "Interface\\GossipFrame\\ActiveQuestIcon"; | |||||
| elseif(v.type == "availquest") then | |||||
| iconpath = "Interface\\GossipFrame\\AvailableQuestIcon"; | |||||
| else | |||||
| iconpath = "Interface\\GossipFrame\\" .. v.type .. "GossipIcon"; | |||||
| end | |||||
| getglobal(entry .. "_Icon"):SetTexture(iconpath); | |||||
| getglobal(entry .. "_Check"):SetChecked(v.state); | |||||
| entrytext:SetWidth(156); --make sure to change this if you change the anchors in the XML | |||||
| entrybutton:SetHeight( entrytext:GetHeight() + 6); | |||||
| entrybutton:Show(); | |||||
| last = last+1; | |||||
| end | |||||
| for j=last, 16, 1 do | |||||
| getglobal("TI_OptionsPriority" .. j):Hide(); | |||||
| end | |||||
| TI_OptionsPriorityScrollFrame:SetVerticalScroll(0); | |||||
| TI_OptionsPriorityScrollFrame:UpdateScrollChildRect(); | |||||
| TI_StatusIndicatorUpdate(); | |||||
| end | |||||
| TI_NPCListScrollBarUpdate(); | |||||
| TI_SettingCheckboxUpdate(); | |||||
| end | |||||
| --[[ | |||||
| function TI_PopulateOptions(arg) | |||||
| TI_debug(arg); | |||||
| if(TI_status and TI_status.options) then | |||||
| for i,v in ipairs(TI_status.options) do | |||||
| local entry = "TI_OptionsPriority" .. i; | |||||
| local iconpath; | |||||
| if(v.name == nil) then TI_debug("oh noes") end; | |||||
| if(getglobal(entry .. "_Text") == nil) then TI_debug("wtf "..entry .. "_Text") end; | |||||
| getglobal(entry .. "_Text"):SetText(v.name); | |||||
| if(v.type == "activequest") then | |||||
| iconpath = "Interface\\GossipFrame\\ActiveQuestIcon"; | |||||
| elseif(v.type == "availquest") then | |||||
| iconpath = "Interface\\GossipFrame\\AvailableQuestIcon"; | |||||
| else | |||||
| iconpath = "Interface\\GossipFrame\\" .. v.type .. "GossipIcon"; | |||||
| end | |||||
| getglobal(entry .. "_Icon"):SetTexture(iconpath); | |||||
| getglobal(entry .. "_Check"):SetChecked(v.state); | |||||
| getglobal(entry):Show(); | |||||
| end | |||||
| end | |||||
| TI_NPCListScrollBarUpdate(); | |||||
| end | |||||
| ]]-- | |||||
| function TI_NPCListScrollBarUpdate() | |||||
| if(TI_NPCIndex) then | |||||
| FauxScrollFrame_Update(TI_NPCListScrollFrame,table.getn(TI_NPCIndex),8,20); | |||||
| -- arg2 is max entries, arg3 is number of lines, arg4 is pixel height of each line | |||||
| local line; -- 1 through 8 of our window to scroll | |||||
| local lineplusoffset; -- an index into our data calculated from the scroll offset | |||||
| local offset = FauxScrollFrame_GetOffset(TI_NPCListScrollFrame); | |||||
| local i=1; | |||||
| local j=1; | |||||
| --~ for k, v in pairs(TI_NPCDB) do | |||||
| --~ if(offset <= i and i < offset+8) then | |||||
| --~ if(i <= table.getn(TI_NPCDB)) then | |||||
| --~ getglobal("TI_OptionsNPCContainer"..j.."_Text"):SetText(k); | |||||
| --~ getglobal("TI_OptionsNPCContainer"..j.."_Check"):SetChecked(v.state); | |||||
| --~ getglobal("TI_OptionsNPCContainer"..j):Show(); | |||||
| --~ else | |||||
| --~ getglobal("TI_OptionsNPCContainer"..j):Hide(); | |||||
| --~ end | |||||
| --~ j = j + 1; | |||||
| --~ end | |||||
| --~ i = i + 1; | |||||
| --~ end | |||||
| for line=1,8 do | |||||
| lineplusoffset = line + FauxScrollFrame_GetOffset(TI_NPCListScrollFrame); | |||||
| if(lineplusoffset <= table.getn(TI_NPCIndex)) then | |||||
| getglobal("TI_OptionsNPCContainer"..line):SetID(lineplusoffset); | |||||
| getglobal("TI_OptionsNPCContainer"..line.."_Text"):SetText(TI_NPCIndex[lineplusoffset]); | |||||
| getglobal("TI_OptionsNPCContainer"..line.."_Check"):SetChecked(TI_NPCDB[TI_NPCIndex[lineplusoffset]].state); | |||||
| if(lineplusoffset == TI_LoadedNPCIndex) then | |||||
| getglobal("TI_OptionsNPCContainer"..line):LockHighlight(); | |||||
| else | |||||
| getglobal("TI_OptionsNPCContainer"..line):UnlockHighlight(); | |||||
| end | |||||
| getglobal("TI_OptionsNPCContainer"..line):Show(); | |||||
| else | |||||
| getglobal("TI_OptionsNPCContainer"..line):Hide(); | |||||
| end | |||||
| end | |||||
| end | |||||
| end | |||||
| function TI_SelectNPCIndex() | |||||
| local index = this:GetID(); | |||||
| if(TI_LoadedNPCIndex == index) then | |||||
| TI_LoadedNPCIndex = 0; | |||||
| else | |||||
| TI_LoadedNPCIndex = index; | |||||
| end | |||||
| TI_PopulateOptions("select npc"); | |||||
| end | |||||
| function TI_DeleteNPCIndex() | |||||
| local index = this:GetParent():GetID(); | |||||
| TI_DeleteNPC(index); | |||||
| if(TI_LoadedNPCIndex == index) then | |||||
| TI_LoadedNPCIndex = 0; | |||||
| end | |||||
| TI_PopulateOptions("npclist update"); | |||||
| end | |||||
| function TI_NPCToggle() | |||||
| local index = this:GetParent():GetID(); | |||||
| TI_NPCDB[TI_NPCIndex[index]].state = this:GetChecked(); | |||||
| if(TI_NPCDB[TI_NPCIndex[index]].state) then | |||||
| TI_LoadedNPCIndex = index; | |||||
| else | |||||
| if(TI_LoadedNPCIndex == index) then | |||||
| TI_LoadedNPCIndex = 0; | |||||
| end | |||||
| end | |||||
| TI_PopulateOptions("select npc"); | |||||
| end | |||||
| function TI_OptionMove(offset) | |||||
| local CurrOpts; | |||||
| if(TI_LoadedNPCIndex > 0) then | |||||
| CurrOpts = TI_NPCDB[TI_NPCIndex[TI_LoadedNPCIndex]]; | |||||
| else | |||||
| CurrOpts = TI_status.options; | |||||
| end | |||||
| local id = this:GetParent():GetID(); | |||||
| local newid = id + offset; | |||||
| if(newid < 1 or newid > table.getn(CurrOpts)) then | |||||
| return; | |||||
| end | |||||
| local temp = CurrOpts[newid]; | |||||
| CurrOpts[newid] = CurrOpts[id]; | |||||
| CurrOpts[id] = temp; | |||||
| TI_PopulateOptions("move"); | |||||
| end | |||||
| function TI_OptionToggle() | |||||
| local CurrOpts; | |||||
| if(TI_LoadedNPCIndex > 0) then | |||||
| CurrOpts = TI_NPCDB[TI_NPCIndex[TI_LoadedNPCIndex]]; | |||||
| else | |||||
| CurrOpts = TI_status.options; | |||||
| end | |||||
| local id = this:GetParent():GetID(); | |||||
| if(this:GetChecked()) then | |||||
| CurrOpts[id].state=true; | |||||
| else | |||||
| CurrOpts[id].state=false; | |||||
| end | |||||
| end | |||||
| function TI_StatusIndicatorUpdate() | |||||
| if(TI_status) then | |||||
| if(TI_status.state) then | |||||
| TI_StatusIndicator_Status:SetText("On"); | |||||
| TI_StatusIndicator_Status:SetTextColor(0,1,0); | |||||
| else | |||||
| TI_StatusIndicator_Status:SetText("Off"); | |||||
| TI_StatusIndicator_Status:SetTextColor(1,0,0); | |||||
| end | |||||
| TI_StatusIndicator_Checkbox:SetChecked(TI_status.state); | |||||
| end | |||||
| end | |||||
| function TI_StatusIndicator_CheckFn() | |||||
| if(this:GetChecked()) then | |||||
| TI_Switch("on"); | |||||
| else | |||||
| TI_Switch("off"); | |||||
| end | |||||
| end | |||||
| function TI_TempNPCListTooltipShow() | |||||
| TI_Tooltip:SetOwner(this, ANCHOR_PRESERVE); | |||||
| TI_Tooltip:ClearLines(); | |||||
| local id = this:GetID(); | |||||
| TI_Tooltip:AddLine(TI_TempNPCList[id].location); | |||||
| for i,v in ipairs(TI_TempNPCList[id].list) do | |||||
| TI_Tooltip:AddLine("- " .. v.name); | |||||
| end | |||||
| --TI_Tooltip:SetText(text); | |||||
| TI_Tooltip:Show(); | |||||
| end | |||||
| function TI_TooltipHide() | |||||
| TI_Tooltip:Hide(); | |||||
| end | |||||
| function TI_TooltipMessage(msg) | |||||
| TI_Tooltip:SetOwner(this, ANCHOR_PRESERVE); | |||||
| TI_Tooltip:ClearLines(); | |||||
| TI_Tooltip:SetText(msg); | |||||
| TI_Tooltip:Show(); | |||||
| end | |||||
| function TI_TempNPCListUpdate() | |||||
| local last = 1; | |||||
| for i,v in ipairs(TI_TempNPCList) do | |||||
| local tempbuttontext = getglobal("TI_TempNPCListWindow"..i.."_Text"); | |||||
| tempbuttontext:SetText(v.name); | |||||
| tempbuttontext:GetParent():Show(); | |||||
| last = last+1; | |||||
| end | |||||
| for j=last, TI_TempNPCListMaxSize, 1 do | |||||
| getglobal("TI_TempNPCListWindow" .. j):Hide(); | |||||
| end | |||||
| end | |||||
| function TI_NPCListCheckboxTooltip() | |||||
| if(this:GetChecked()) then | |||||
| TI_TooltipMessage("NPC is using specific settings."); | |||||
| else | |||||
| TI_TooltipMessage("NPC is using default settings."); | |||||
| end | |||||
| end | |||||
| function TI_OptionListCheckboxTooltip() | |||||
| if(this:GetChecked()) then | |||||
| TI_TooltipMessage("This option is enabled."); | |||||
| else | |||||
| TI_TooltipMessage("This option is disabled."); | |||||
| end | |||||
| end | |||||
| function TI_SettingCheckboxFn(var) | |||||
| if(this:GetChecked()) then | |||||
| TI_status[var] = true; | |||||
| else | |||||
| TI_status[var] = false; | |||||
| end | |||||
| end | |||||
| function TI_SettingCheckboxUpdate() | |||||
| if(TI_status) then | |||||
| TI_SettingCheckboxes_UseDefault:SetChecked(TI_status.usedefault); | |||||
| TI_SettingCheckboxes_AddAutomatically:SetChecked(TI_status.autoadd); | |||||
| end | |||||
| end |