WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Adding a new reputation (https://www.wowinterface.com/forums/showthread.php?t=59639)

nkttennessee 07-20-23 03:24 PM

Adding a new reputation
 
1 Attachment(s)
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.

Fizzlemizz 07-20-23 05:31 PM

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.

nkttennessee 07-20-23 07:25 PM

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?

Fizzlemizz 07-20-23 08:06 PM

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.

nkttennessee 07-20-23 08:20 PM

Quote:

Originally Posted by Fizzlemizz (Post 342652)
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).

Fizzlemizz 07-20-23 09:05 PM

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()

nkttennessee 07-20-23 09:15 PM

Thank you so much for your help. Anything else I have left I should be able to figure out.

nkttennessee 07-22-23 10:25 AM

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


Fizzlemizz 07-22-23 10:43 AM

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.

nkttennessee 07-22-23 10:58 AM

Thank you again


All times are GMT -6. The time now is 10:36 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI