Thread Tools Display Modes
06-07-22, 01:00 PM   #1
Shargul
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Jun 2022
Posts: 3
Edit text of existing in-game frame

Hey all. I'm sort of a wow add-on noob so apologies if this is a trivial question.

I recently began creating my first add-on which calculates the probability of a skill-up when crafting certain trade-skill items, based on the following formula from the wiki. I've managed to implement it almost fully now, by gathering up all the percentage chances for the players crafts, as seen here:

https://imgur.com/a/At9rOOy

Now all I want to do is display these percentages beside each craftable item in the players TradeSkill frame, rather than just printing it out in chat like I have been doing thus far.

To help understand, I made a quick image edit of what I mean:

This
https://imgur.com/a/M8rNCQi

Rather than this:
https://imgur.com/a/CLlTv8T

Would anyone be able to give me some pointers on how to achieve this? I initially tried using the frame stack to access the child frames belonging to each consecutive item, but using functions like frame:SetText() and the like proved futile.

Any help with this would be greatly appreciated.

Last edited by Shargul : 06-07-22 at 01:05 PM.
  Reply With Quote
06-07-22, 06:32 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
This in an addon that loads with the Blizzard_TradeSkillUI will add the recipe ID to the text.

You can use that (or whatever you need) to do your calculation and add that text instead. The Count ([nnn]) at the end of the text is a separate fontstring. There's only so much space so the recipe text can be truncated for long recipe titles.

Lua Code:
  1. local function AddRecipeInfo(self, textWidth, tradeSkillInfo)
  2.     if not self.isHeader then
  3.         self.Text:SetText(self.Text:GetText().."-(|cff00ff00ID:|r |cffffff00"..self.tradeSkillInfo.recipeID..")|r ")
  4.     end
  5. end
  6. for k, v in pairs(TradeSkillFrame.RecipeList.buttons) do
  7.     hooksecurefunc(v, "SetUpRecipe", AddRecipeInfo)
  8. end
Hooks the SetUpRecipe function of each row button in the recipes list to call the AddRecipeInfo function after it's finished.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 06-07-22 at 06:43 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Edit text of existing in-game frame

Thread Tools
Display Modes

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