View Single Post
06/03/23, 09:35 PM   #11
Dolgubon
 
Dolgubon's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 409
Here's my current implementation of a writ search function, which as far as I know works well. It does have a bit more functionality, but you can strip that out if you don't need it. Line 446 in WritCreator.lua.
Lua Code:
  1. local function writSearch()
  2.     local W = {}
  3.     local anyFound = false
  4.     if not WritCreater.questExceptions then
  5.         return {}, false
  6.     end
  7.     for i=1 , 25 do
  8.         local Qname=GetJournalQuestName(i)
  9.         Qname=WritCreater.questExceptions(Qname)
  10.         if (GetJournalQuestType(i) == QUEST_TYPE_CRAFTING or string.find(Qname, WritCreater.writNames["G"])) and GetJournalQuestRepeatType(i)==QUEST_REPEAT_DAILY then
  11.             for j = 1, #WritCreater.writNames do
  12.                 if string.find(myLower(Qname),myLower(WritCreater.writNames[j])) then
  13.                     W[j] = i
  14.                     anyFound = true
  15.                 end
  16.             end
  17.         end
  18.     end
  19.     return W , anyFound
  20. end
writNames["G"] is "writ", writNames[1 -> 6] are the craft specific names of writs. questExceptions is a pre-format function you can overwrite for specific languages, but not really too important. All of the writNames and questExceptions can be found in the various localization files.

Last edited by Dolgubon : 06/03/23 at 09:37 PM.
  Reply With Quote