Thread Tools Display Modes
01/07/16, 07:49 PM   #1
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
Help Appending To In-Game Quest List

I really know it's going to be something dumb. I'm looking to add to the existing in-game quest list on the journal page.

From Wyykyd's Quest Tracker, I can use

Code:
local allQuests, allCategories, seenCategories = QUEST_JOURNAL_MANAGER:GetQuestListData()
to actually get all the quests and tree structure information. I thought I could hook or overload (I'm not sure the difference) QUEST_JOURNAL_MANAGER:GetQuestListData(), but unless I'm just missing it, the in-game journal doesn't seem to fire QUEST_JOURNAL_MANAGER:GetQuestListData() in the creation of the list. Perhaps it's firing before my add-on is loaded? But I could add to allQuests if I can get it to hook properly right?

Is this not the best way to do this? Should I be using a different method? Any help you can provide is appreciated. Also any hints or tidbits on the next steps, of getting my added quest to cycle when "T" is pressed or provide additional information in the journal panel when it's active or clicked would be appreciated as I am sure that will be my next stumbling block. ;-)


For those interested, I'm trying to build this. I got the questing logic and stuff worked out and functioning in an alpha state, but I'm trying to integrate most everything into the base UI to make it the best experience possible.

TIA
  Reply With Quote
01/07/16, 09:15 PM   #2
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by dominoid View Post
I really know it's going to be something dumb. I'm looking to add to the existing in-game quest list on the journal page.

From Wyykyd's Quest Tracker, I can use

Code:
local allQuests, allCategories, seenCategories = QUEST_JOURNAL_MANAGER:GetQuestListData()
That method is only used at startup to create initial tables, so called master list, here http://esodata.uesp.net/current/src/...d.lua.html#229

You'll probably want to manipulate that questMasterList. But then you might run into issues with MAX_JOURNAL_QUESTS, the active quest limit.


Originally Posted by dominoid View Post
I thought I could hook or overload (I'm not sure the difference)
You can't overload functions in Lua There's no way to attach argument count/type restrictions to a function.
  Reply With Quote
01/07/16, 09:35 PM   #3
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Your looking for this:
Lua Code:
  1. local function UpdateQuestInfo()
  2.     local allQuests, allCategories, seenCategories = QUEST_JOURNAL_MANAGER:GetQuestListData()
  3.     ...
  4.    
  5. end
  6.  
  7. local OrigRefreshQuestMasterList = ZO_QuestJournal_Keyboard.RefreshQuestMasterList
  8. function ZO_QuestJournal_Keyboard:RefreshQuestMasterList()
  9.     OrigRefreshQuestMasterList(self)
  10.    
  11.     UpdateQuestInfo()
  12. end


Here is an example of how to do it:
Warning: Spoiler


The above code allows you to create quest categories and quests and add them to the journal, but as merlight said there are problems you might run into like MAX_JOURNAL_QUESTS & all of the quest functions that use any quest info like questIndex. You would probably have to hook all of them and handle them yourself or you would probably crash any addon that works with quests. Also who knows what trouble you might run into if ZOS code runs some private functions or something server side and attempts to use your fake questIndex or any of your other fake quest info.

Last edited by circonian : 01/07/16 at 09:59 PM.
  Reply With Quote
01/07/16, 09:50 PM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by dominoid View Post
Also any hints or tidbits on the next steps, of getting my added quest to cycle when "T" is pressed or provide additional information in the journal panel when it's active or clicked would be appreciated as I am sure that will be my next stumbling block. ;-)
That is one of the things I meant when I said you would probably have to hook a lot of functions involving quest info and handle them yourself. You would have to do it to get info to show on the journal page like the description, stepText, Condition text, hints, exc... It would also be required to get the "T" key to cycle to your quest properly.
  Reply With Quote
01/08/16, 08:05 AM   #5
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
Thank you both for going above and beyond. The code worked exactly as I had hoped. As pointed out, I will need to hook a bunch more. I will spend the day trying to figure it out. I THINK the code above combined with using MailR as a good "how to" for how they handled all hooks inside the messaging screen MIGHT get me there. Thanks again.
  Reply With Quote
01/08/16, 08:30 AM   #6
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,579
Originally Posted by dominoid View Post
Thank you both for going above and beyond. The code worked exactly as I had hoped. As pointed out, I will need to hook a bunch more. I will spend the day trying to figure it out. I THINK the code above combined with using MailR as a good "how to" for how they handled all hooks inside the messaging screen MIGHT get me there. Thanks again.
Just keep in mind that you should leave the original code path intact for other addons when you add your hooks. I think I remember that MailR simply replaced some methods in the past without calling the original function which made it incompatible with some features of AwesomeGuildStore, not sure if it has been updated in the meantime. If it is still the same it might not be the best example of how to achieve this.
  Reply With Quote
01/08/16, 11:40 AM   #7
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
Argh. Using MailR as an example, which apparently may not be the best case, I put this at the top:

Lua Code:
  1. local GetJournalQuestInfo_Orig = GetJournalQuestInfo

Assigned the following in my intialization:

Lua Code:
  1. GetJournalQuestInfo = QuestMaker.GetJournalQuestInfo

And created this:

Lua Code:
  1. function QuestMaker:GetJournalQuestInfo(questIndex)
  2.  
  3.         local questName, bgText, stepText, stepType, stepOverrideText, completed, tracked, _, _, _, instanceDisplayType = GetJournalQuestInfo_Orig(questIndex)
  4.         return questName, bgText, stepText, stepType, stepOverrideText, completed, tracked, _, _, _, instanceDisplayType
  5.  
  6. end

Which to my limited knowledge should simply run the original GetJournalQuestInfo, but questIndex is coming in nil. I got it to not come in nil once by accident, made some changes, and can't get it back. What am I missing? The plan would be to check the quest index number and if it's a custom quest pass back custom quest info, but if it's a vanilla quest to use the vanilla function as coded above.

Thank again.

Last edited by dominoid : 01/08/16 at 11:43 AM.
  Reply With Quote
01/08/16, 11:51 AM   #8
dominoid
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 34
Ok so changing QuestMaker:GetJournalQuestInfo to QuestMaker.GetJournalQuestInfo worked? What's the difference and why did it work for MailR and not mine?

Sorry for all the noob stuff. I swear I know what I'm outside of here. My problem is my base knowledge is VB.net syntax. If I really new C# or C++, the LUA syntax would look better to me (I think). That and I'm self taught.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Help Appending To In-Game Quest List


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off