WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Frame temporary properties (frame.86c52870) (https://www.wowinterface.com/forums/showthread.php?t=58498)

Platine 12-29-20 04:40 AM

Frame temporary properties (frame.86c52870)
 
In the QuestInfo frame, text sometimes appears in the element:
QuestInfoRewardsFrame.86c52870
but the number 86c52870 changes randomly.



In the picture, this element contains the text "The following will be cast on you",
which I would like to change in my addon. How to identify this changing element?

Seerah 12-29-20 12:58 PM

It is an unnamed fontstring. Since it doesn't have a name, the reference you see to it (86c52870) is its address in memory.

You can try calling QuestInfoRewardsFrame:GetChildren()

Platine 12-29-20 01:34 PM

10 children, nothing special:

nil
QuestInfoRewardsFrameQuestInfoItem1
QuestInfoMoneyFrame
QuestInfoSkillPointFrame
QuestInfoXPFrame
nil
nil
QuestInfoPlayerTitleFrame
QuestInfoItemHighlight
nil

Vrul 12-29-20 02:10 PM

QuestInfoRewardsFrame uses CreateFontStringPool for those. You will need to do something like:
Lua Code:
  1. for fontString in QuestInfoRewardsFrame.spellHeaderPool:EnumerateActive() do
  2.     if fontString:GetText() == REWARD_AURA then
  3.         fontString:SetText("My custom aura header:")
  4.     end
  5. end

Platine 12-29-20 02:25 PM

Super, Vrul, this work perfectly.
Thanks.

And this element what method uses?
QuestMapFrame.DetailsFrame.RewardsFrame.4501dab0


Vrul 12-29-20 05:21 PM

Lua Code:
  1. local regions = { QuestMapFrame.DetailsFrame.RewardsFrame:GetRegions() }
  2. for index = 1, #regions do
  3.     local region = regions[index]
  4.     if region:GetObjectType() == "FontString" and region:GetText() == REWARDS then
  5.         region:SetText("My custom header")
  6.     end
  7. end

Platine 12-30-20 04:43 AM

Excellent, thank you very much, Vrul.

Platine 01-01-21 09:49 AM

Vrul, and how to get objective text from block of ObjectiveTrackerBlocksFrame?

Code:

hooksecurefunc(QUEST_TRACKER_MODULE, "SetBlockHeader", MY_ObjectiveTracker_Reader);

function MY_ObjectiveTracker_Reader(self, block)
  print(block.id);
  print(block.HeaderText:GetText());
  print(block.lines[1]:GetText());        -- error: index field : nil
  -- I need to change the objective text for this block
end


Vrul 01-01-21 10:33 PM

Lua Code:
  1. hooksecurefunc(QUEST_TRACKER_MODULE, "SetBlockHeader", function(self, block)
  2.     print("QuestID:", block.id)
  3.     print("QuestHeader:", block.HeaderText:GetText())
  4.     print("QuestObjectives:")
  5.     local objectives = block.lines
  6.     if objectives.QuestComplete then
  7.         print(("[?] %s"):format(objectives.QuestComplete.Text:GetText()))
  8.     else
  9.         for index = 1, #objectives do
  10.             print(("[%s] %s"):format(index, objectives[index].Text:GetText()))
  11.         end
  12.     end
  13. end)

Platine 01-02-21 08:12 AM

Thanks Vrul, this is a good way, but not quite it working.

Lua Code:
  1. hooksecurefunc(QUEST_TRACKER_MODULE, "SetBlockHeader", function(self, block)
  2.     local objectives = block.lines
  3.     if objectives.QuestComplete then
  4.          objectives.QuestComplete.Text:SetText("Gotowy do oddania");    -- Ready for turn-in
  5.     else
  6.         for index = 1, #objectives do
  7.              objectives[index].Text:SetText("My translation");
  8.         end
  9.     end
  10. end)

Line 4. and 7. - does not change the text in ObjectiveTracker on the game.



Blizzard does not support the Polish language in the game, so I developed some addons that display translated texts in key places in the game (quests, gossip, bubbles, cinematic subtitles, tutarials).

Vrul 01-02-21 11:15 AM

Translated with Google:
Lua Code:
  1. local objectiveSpecials = {
  2.     ClickComplete = function(fontString)
  3.         fontString:SetText("(kliknij, aby zakończyć)")    -- (click to complete)
  4.     end,
  5.  
  6.     Failed = function(fontString)
  7.         fontString:SetText("Niepowodzenie")             -- Failed
  8.     end,
  9.  
  10.     QuestComplete = function(fontString)
  11.         if fontString:GetText() == QUEST_WATCH_QUEST_READY then
  12.             fontString:SetText("Gotowy do oddania")     -- Ready for turn-in
  13.         else
  14.             fontString:SetText("Zadanie zakończone")   -- Quest Complete
  15.         end
  16.     end,
  17.  
  18.     Waypoint = function(fontString, questID)
  19.         local waypointText = C_QuestLog.GetNextWaypointText(questID)
  20.         fontString:SetText(("0/1 %s (Opcjonalny)"):format(waypointText))    -- 0/1 %s (Optional)
  21.     end
  22. }
  23.  
  24. hooksecurefunc(QUEST_TRACKER_MODULE, "EnumQuestWatchData", function()
  25.     for questID, block in pairs(QUEST_TRACKER_MODULE.usedBlocks.ObjectiveTrackerBlockTemplate) do
  26.         block.HeaderText:SetText("Translated Header")
  27.         local objectives = block.lines
  28.         for index = 1, #objectives do
  29.             objectives[index].Text:SetText("My translation")
  30.         end
  31.         for special, func in pairs(objectiveSpecials) do
  32.             if objectives[special] then
  33.                 func(objectives[special].Text, questID)
  34.             end
  35.         end
  36.     end
  37. end)

Platine 01-02-21 02:24 PM

Yes, yes, Vrul, now it's working perfectly.
I'll write a special thank for you inside the addon body.

Finally, I need a similar code to frame: Map & Quest Log.


Vrul 01-02-21 05:56 PM

Lua Code:
  1. hooksecurefunc("QuestLogQuests_Update", function()
  2.     for button in QuestScrollFrame.headerFramePool:EnumerateActive() do
  3.         button.ButtonText:SetText("My translated header")
  4.     end
  5.     for button in QuestScrollFrame.titleFramePool:EnumerateActive() do
  6.         button.Text:SetText("My translated title")
  7.     end
  8.     for frame in QuestScrollFrame.objectiveFramePool:EnumerateActive() do
  9.         frame.Text:SetText("My translated objective")
  10.     end
  11. end)

Platine 01-03-21 07:26 AM

And how to get questID for specific quests?

Vrul 01-03-21 08:09 AM

Lua Code:
  1. hooksecurefunc("QuestLogQuests_Update", function()
  2.     for button in QuestScrollFrame.headerFramePool:EnumerateActive() do
  3. --      button.questLogIndex
  4.         button.ButtonText:SetText("My translated header")
  5.     end
  6.     for button in QuestScrollFrame.titleFramePool:EnumerateActive() do
  7. --      button.questLogIndex
  8. --      button.questID
  9.         button.Text:SetText("My translated title")
  10.     end
  11.     for frame in QuestScrollFrame.objectiveFramePool:EnumerateActive() do
  12. --      frame.questID
  13.         frame.Text:SetText("My translated objective")
  14.     end
  15. end)

Platine 01-03-21 10:26 AM

Well done. Addon is complete.
Thanks again, Vrul, for you help.


Platine 01-06-21 06:48 AM

There is one more point where the objectives text does not update.
If I collect 5/5 items, the text changes to the next task within the same quest.







Objective: "0/1 Cook the meat on the campfire" don't fired on QUEST_TRACKER_MODULE:EnumQuestWatchData or isn't in block.lines

EDIT - OK, I already know - I should check the properties: block.currentLine.Text
.

Platine 01-15-21 07:38 AM

And the last problem in this objects:



Section: Bonus Objectives - how to get to them?


All times are GMT -6. The time now is 04:25 PM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI