WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   Level up sound on reputation rank up. (https://www.wowinterface.com/forums/showthread.php?t=59070)

DonnieDice 03-16-22 11:38 PM

Level up sound on reputation rank up.
 
Currently trying to figure out how to add sound to reputation rank up. I can't seem to find a RegisterEvent thats related to reputation rank ups, similar to PLAYER_LEVEL_UP. I think in wow when you rank up reputation there is some sound file that plays, and an green level up animation that happens on your character. I am trying to change the sound that plays when this event takes place.

SDPhantom 03-17-22 02:46 AM

The animation you're referring to is in C code as it's actually rendered in-world and not by the UI system. The same applies to the sound played. Sound file replacements should still work, but I don't know what the path is for that specific sound.

DonnieDice 03-17-22 03:53 AM

I found this.
Code:

568016        sound/spells/reputationlevelup.ogg
I can mute the sound with this.
Code:

MuteSoundFile(568016)
But I can't figure out the RegisterEvent to trigger a new sound file when reputation rank increases.

SDPhantom 03-17-22 06:15 AM

Here's an example I came up with. It's based off how ReputationFrame updates and keeps track of rep by ID to avoid name collisions.
Lua Code:
  1. local TrackedFactions={};
  2. local EventFrame=CreateFrame("Frame");
  3. EventFrame:RegisterEvent("PLAYER_LOGIN");-- Player login
  4. EventFrame:RegisterEvent("UPDATE_FACTION");--   Kill rep
  5. EventFrame:RegisterEvent("QUEST_LOG_UPDATE");-- Quest rep
  6.  
  7. EventFrame:SetScript("OnEvent",function()
  8.     for i=1,GetNumFactions() do
  9.         local _,_,newstanding,_,_,_,_,_,_,_,hasrep,_,_,faction=GetFactionInfo(i);
  10.         if hasrep and faction and (newstanding or 0)>0 then--   Make sure we have the info we need and standing isn't UNKNOWN (0)
  11.             local oldstanding=TrackedFactions[faction];
  12.             if oldstanding and oldstanding<newstanding then--   Check if standing went up (allow same code to initialize tracking)
  13.                 PlaySoundFile("Interface\\AddOns\\YourAddOn\\YourSoundFile.ogg");
  14.             end
  15.  
  16.             TrackedFactions[faction]=newstanding;-- Update standing
  17.         end
  18.     end
  19. end);

Dridzt 03-17-22 07:41 AM

Holy addon spam :o

Would it be an idea to have a single "Better Level Up" addon where the player can select (and switch if they get bored of it) one of the many options?

Yukyuk 03-17-22 08:29 AM

Quote:

Originally Posted by Dridzt (Post 340428)
Holy addon spam :o

Would it be an idea to have a single "Better Level Up" addon where the player can select (and switch if they get bored of it) one of the many options?

+1 to that.

I won't repeat exactly what my first words were when I saw the NEW addon list, but they were "adult language" :p

DonnieDice 03-18-22 01:26 AM

Quote:

Originally Posted by Yukyuk (Post 340429)
+1 to that.

I won't repeat exactly what my first words were when I saw the NEW addon list, but they were "adult language" :p

You guys, I'm working on this! I'm a noob so.. it might take awhile. This solution was the easiest thing I could come up with :(

The end goal is in-fact a single addon with the option to choose which sound plays when you level up, and which sound plays when you rank up reputation, and maybe eventually a sound for ranking up in pvp. I'd also like to add the option to turn on and off the default sounds for level/rep rank up.

-- I'm currently learning how to setup api keys and attaching git to addon distribution sites for auto packaging.
-- I'm also trying to figure out how to set up the options menu and am struggling with drop down menus.

DonnieDice 03-18-22 04:24 AM

Quote:

Originally Posted by SDPhantom (Post 340427)
Here's an example I came up with. It's based off how ReputationFrame updates and keeps track of rep by ID to avoid name collisions.
Lua Code:
  1. local TrackedFactions={};
  2. local EventFrame=CreateFrame("Frame");
  3. EventFrame:RegisterEvent("PLAYER_LOGIN");-- Player login
  4. EventFrame:RegisterEvent("UPDATE_FACTION");--   Kill rep
  5. EventFrame:RegisterEvent("QUEST_LOG_UPDATE");-- Quest rep
  6.  
  7. EventFrame:SetScript("OnEvent",function()
  8.     for i=1,GetNumFactions() do
  9.         local _,_,newstanding,_,_,_,_,_,_,_,hasrep,_,_,faction=GetFactionInfo(i);
  10.         if hasrep and faction and (newstanding or 0)>0 then--   Make sure we have the info we need and standing isn't UNKNOWN (0)
  11.             local oldstanding=TrackedFactions[faction];
  12.             if oldstanding and oldstanding<newstanding then--   Check if standing went up (allow same code to initialize tracking)
  13.                 PlaySoundFile("Interface\\AddOns\\YourAddOn\\YourSoundFile.ogg");
  14.             end
  15.  
  16.             TrackedFactions[faction]=newstanding;-- Update standing
  17.         end
  18.     end
  19. end);

:( Just tested this and no dice. I'll test it again in a bit just to be doubly sure, maybe I did something wrong.

Fizzlemizz 03-18-22 11:43 PM

Lua Code:
  1. if oldstanding and oldstanding<newstanding then
TrackedFactions starts as an empty table so oldstanding will always be nil until a new faction entry is added.
Lua Code:
  1. if not oldstanding or oldstanding<newstanding then

SDPhantom 03-24-22 03:40 AM

Quote:

Originally Posted by Fizzlemizz (Post 340433)
Lua Code:
  1. if oldstanding and oldstanding<newstanding then
TrackedFactions starts as an empty table so oldstanding will always be nil until a new faction entry is added.
Lua Code:
  1. if not oldstanding or oldstanding<newstanding then

That only controls the sound playing, not the recording. The idea is for PLAYER_LOGIN to start the initial scan, populating TrackedFactions. Further updates compare previous values added and act accordingly. If a new faction was added mid-session, it's designed to not play the sound and still record the initial value.



Looks like the issue was with the hasrep flag. I assumed it was for all factions that show a reputation bar, but it only applies to headers. This adjusts accordingly.

Replace this
Code:

local _,_,newstanding,_,_,_,_,_,_,_,hasrep,_,_,faction=GetFactionInfo(i);
if hasrep and faction and (newstanding or 0)>0 then

with this
Code:

local _,_,newstanding,_,_,_,_,_,isheader,_,hasrep,_,_,faction=GetFactionInfo(i);
if faction and (not isheader or hasrep) and (newstanding or 0)>0 then



Also be sure to change PlaySoundFile("Interface\\AddOns\\YourAddOn\\YourSoundFile.ogg") to the path to the sound file you wish to play. This is relative to the client's install directory. Note YourAddOn and YourSoundFile.ogg are the parts to change accordingly.


All times are GMT -6. The time now is 06:48 AM.

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