Thread Tools Display Modes
07-20-23, 03:24 PM   #1
nkttennessee
A Murloc Raider
Join Date: Jul 2023
Posts: 6
Adding a new reputation

I am extremely new to wow modding but I am trying to add a new reputation that will show up in a characters reputation tab. I believe I am successfully keeping track of the reputation amounts and updating them accordingly. However, I am very lost on gui elements and how to render my added reputations in the reputation tab of the character frame. Any examples, tutorials, or information would be greatly appreciated.

Left is current reputations, right is what I'm trying to add.
Attached Thumbnails
Click image for larger version

Name:	rep.PNG
Views:	53
Size:	456.9 KB
ID:	9832  
  Reply With Quote
07-20-23, 05:31 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
The game should add new reputation entries once your character has interacted with the faction and done something to attract a change in reputation status.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
07-20-23, 07:25 PM   #3
nkttennessee
A Murloc Raider
Join Date: Jul 2023
Posts: 6
Thank you, that is very nice to know. Since that is the case, it brings a new question that I am likely not knowledgable enough to ask correctly.

Currently I am storing my "new reputations" in a table, at the moment it is just a key/value (subfaction/reputationAmount). However since the game automatically adds new reputation entries, I assume I need to store or register my "new reputations" as factions or reputations somehow. Is there some documentation/examples of doing that?

Last edited by nkttennessee : 07-20-23 at 07:35 PM.
  Reply With Quote
07-20-23, 08:06 PM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
You can't "register" a faction. The game knows about the factions it knows about and is not interested in anything else.

Are you meaning you want to add some random not in-game identity to the reputation frame and generate your own reputation based on "stuff"? Although it looks like you've done that with the "my sub-faction" in the image.

Possibly you just want to update your personal reputation status bar etc when the reputation frame is displayed which you could do by hooking the ReputationFrame_OnShow function.
Lua Code:
  1. hooksecurefunc("ReputationFrame_OnShow", function(self)
  2.      -- update your widgets with the latest from information you've presumably stored in a table.
  3. end)

You could also use
Lua Code:
  1. ReputationFrame:HookScript("OnShow",function(self)
  2.      -- update your widgets with the latest from information you've presumably stored in a table.
  3. end)

Which is pretty much the same thing but works if the script doesn't call a separate function.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-20-23 at 08:16 PM.
  Reply With Quote
07-20-23, 08:20 PM   #5
nkttennessee
A Murloc Raider
Join Date: Jul 2023
Posts: 6
Originally Posted by Fizzlemizz View Post
Are you meaning you want to add some random not in-game identity to the reputation frame and generate your own reputation based on "stuff"? Although it looks like you've done that with the "my sub-faction" in the image.
This part is exactly what I'm trying to do. The image I just photoshopped as an example. I'm in the process of figuring out how to display my information on some other frame but I would like it to display in the reputation frame in the same style as the other reputations (like the photo).
  Reply With Quote
07-20-23, 09:05 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Adding to the ReputationFrame scrolllist is going to be tricky because you don't control the data.

To add one to you own frame then the actual list entries use the ReputationBarTemplate (this will place a rep entry at the top of your screen)
Lua Code:
  1. local f = CreateFrame("Button", "nkttennesseeRep", UIParent, "ReputationBarTemplate")
  2. f:SetSize(200, 50)
  3. f:SetPoint("TOP")
  4. f.Container:SetAllPoints()
  5. f.Container.Name:SetText("The Nkttennessee")
  6. f.Container.ReputationBar:SetStatusBarColor(0, 1, 0)
  7. f.Container.ReputationBar:SetValue(0.5)
  8. f.Container.ReputationBar.BonusIcon:Hide()
  9. f.Container.ReputationBar.FactionStanding:SetText("Awesome")
  10. f.Container.ExpandOrCollapseButton:Hide()
  11. f.Container.Paragon:Hide()
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
07-20-23, 09:15 PM   #7
nkttennessee
A Murloc Raider
Join Date: Jul 2023
Posts: 6
Thank you so much for your help. Anything else I have left I should be able to figure out.
  Reply With Quote
07-22-23, 10:25 AM   #8
nkttennessee
A Murloc Raider
Join Date: Jul 2023
Posts: 6
I stand corrected, I have a few follow up questions. Is there a place I can see all of the other attributes and methods available to ReputationBarTemplate?

How can I set bars to be parents/children of each other or headers? Is there a default way to do that with the template or would I need to create a frame that encapsulates the other bars?

When I hover a bar, the "Neutral/Revered/Exalted" text goes away and doesnt come back when I stop hovering the bar. How can I add a hover/highlight text, like when you hover a normal reputation you are shown the standing value like "701/2500" and how can I make the original FactionStanding text come back when I stop hovering?

(This question isnt very important)At the moment, the bars dont seem to render perfectly, there is a slight texture gap between the left section that includes the name and the right section that includes the faction standing.

https://imgur.com/a/53w9WXM Current sample picture


Last edited by nkttennessee : 07-22-23 at 10:29 AM. Reason: Added current sample picture.
  Reply With Quote
07-22-23, 10:43 AM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
You can extract all the game UI code to peruse it at your leasure. The layout of the template itself is in ReputationFrame.xml.

In the code above, to make the frame created by the template a child of another frame, replace UIParent with the parent frame. eg.
Lua Code:
  1. local RepFrame = CreateFreame("Frame", 'nkttennesseeRepFrame", UIParent)
  2. RepFrame.RepX = CreateFrame("Button", "$parentRepX", RepFrame, "ReputationBarTemplate")

Once you extracted the code you can look in ReputationFrame.lua and see what's happening in the OnEnter/OnLeave code. You can either hook you bars OnEnter/OnLeave scripts to do something after that or replace one ot both of them:
Lua Code:
  1. RepFrame.RepX:SetScript("OnEnter", function(self) ... end)
  2. RepFrame.RepX:SetScript("OnLeave", function(self) ... end)

For the last, it probably something in the template OnLoad code expecting a particular sizing of the .container element. You could override that after the bar is created.

The other possabilty is just creating the bars/fontstrings etc. from scratch which wouldn't contain all the template bits you're not interested in.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 07-22-23 at 10:46 AM.
  Reply With Quote
07-22-23, 10:58 AM   #10
nkttennessee
A Murloc Raider
Join Date: Jul 2023
Posts: 6
Thank you again
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Adding a new reputation


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