WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Mananing standing with non-standard factions (https://www.wowinterface.com/forums/showthread.php?t=58907)

Zax 08-25-21 12:49 PM

Mananing standing with non-standard factions
 
Hello,

How could I manage specials factions reputation, those which standing name or reputations not handled by FACTION_STANDING_LABEL, as described here:
https://wowpedia.fandom.com/wiki/StandingId

I currently use GetFactionInfo() to retreive factions standing but results are very strange with non-standard factions.

Thank you.

DahkCeles 08-25-21 10:20 PM

Do you mean 'friendships' with individuals? GetFriendshipReputation()

https://wowpedia.fandom.com/wiki/API...shipReputation

Zax 08-26-21 08:20 AM

Quote:

Originally Posted by DahkCeles (Post 339752)
Do you mean 'friendships' with individuals? GetFriendshipReputation()

https://wowpedia.fandom.com/wiki/API...shipReputation

Well, I don't understand: GetFriendshipReputation() always returns nil values.

Lua Code:
  1. local numFactions = GetNumFactions()
  2. local factionIndex = 1
  3. while (factionIndex <= numFactions) do
  4.     local name, description, standingId, bottomValue, topValue, earnedValue, atWarWith, canToggleAtWar,
  5.         isHeader, isCollapsed, hasRep, isWatched, isChild, factionID, hasBonusRepGain, canBeLFGBonus = GetFactionInfo(factionIndex)
  6.     if isHeader and isCollapsed then
  7.         ExpandFactionHeader(factionIndex)
  8.         numFactions = GetNumFactions()
  9.     end
  10.     if hasRep or not isHeader then
  11.         DEFAULT_CHAT_FRAME:AddMessage("Faction: " .. name .. " - " .. earnedValue)
  12.         local friendID, friendRep, friendMaxRep, friendName, _, _, friendTextLevel, friendThreshold, nextFriendThreshold = GetFriendshipReputation(factionID)
  13.         print(friendID, friendRep) -- ------> NIL
  14.     end
  15.     factionIndex = factionIndex + 1
  16. end

What I would like to do is just to have correct values from GetFactionInfo() with some specials factions like Venari for instance.

Seerah 08-26-21 11:37 AM

When are you running the above code?

Zax 08-26-21 12:36 PM

Normally at LOGIN event.
For testing purpose, I ran the script manually (long time after LOGIN) with the same NIL result.

Ketho 08-31-21 12:26 AM

Quote:

Originally Posted by Zax (Post 339755)
Normally at LOGIN event.
For testing purpose, I ran the script manually (long time after LOGIN) with the same NIL result.


Even on a fresh login GetFriendshipReputation() returns valid information for me, without waiting for any events
Lua Code:
  1. local info = {GetFriendshipReputation(1273)}
  2. DevTools_Dump(info)

Zax 09-01-21 08:13 AM

GetFriendshipReputation(47) - Stormwind - returns nil, so it seems this function only returns values for "non-standard" factions standing.

Ketho 09-02-21 02:15 AM

Quote:

Originally Posted by Zax (Post 339784)
GetFriendshipReputation(47) - Stormwind - returns nil, so it seems this function only returns values for "non-standard" factions standing.


That's exactly what DahkCeles is saying.

Quote:

Originally Posted by DahkCeles (Post 339752)
Do you mean 'friendships' with individuals? GetFriendshipReputation()

https://wowpedia.fandom.com/wiki/API...shipReputation


Ketho 09-02-21 02:18 AM

Quote:

Originally Posted by Zax (Post 339751)
I currently use GetFactionInfo() to retreive factions standing but results are very strange with non-standard factions.


Can you elaborate? What in particular is strange about the results?

This looks fine to me.
Lua Code:
  1. for i = 1, GetNumFactions() do
  2.     print(GetFactionInfo(i))
  3. end
Lua Code:
  1. "The Tillers", "The Tillers are peaceful and productive pandaren, working with the land to feed the massive appetites of their people.", 8, 42000, 42000, 42000, false, false, true, false, true, false, true, 1272, false
  2. "Chee Chee", "If you've ever had a question about sheep, Chee Chee will know the answer.", 1, 0, 8400, 2200, false, false, false, false, false, false, true, 1277, false

Zax 09-02-21 06:37 AM

Quote:

Originally Posted by Ketho (Post 339788)
Can you elaborate? What in particular is strange about the results?

For some factions, like Venari, standingID returned value by GetFactionInfo() doesn't match with FACTION_STANDING_LABEL, as described here:
https://wowpedia.fandom.com/wiki/StandingId

So I now understand these factions have to managed with GetFriendshipReputation(), as DahkCeles said.

myrroddin 09-03-21 07:36 AM

If I understand the question correctly, FACTION_STANDING_LABEL_n is a 0-8 table. While the names are "Unknown" through "Exalted", the 0-8 should map to friendship levels, even if the text isn't the same. In Ve'nari's case, there should be 9 (0-8) friendship levels, just as Chromie or Jogu the Drunk.

If you want the correct text, because "Unknown" through "Exalted" aren't applicable, you'll need the seventh return of GetFriendShipLevel().

AFAIK, all "friends" have the same 9 faction levels to be compatible with FACTION_STANDING_LABEL_n.

You can also look into https://wowpedia.fandom.com/wiki/API...eputationRanks

myrroddin 09-03-21 08:22 AM

Oops, I had told you some incorrect information. Friendships do not have 9 levels; that wouldn't make sense. They have between 6 and 8 ranks of "standingID" just to be confusing.

The "standingID" of friends should map to FACTION_BAR_COLORS, which is what I was thinking about in my first post. Not all the values of FACTION_BAR_COLORS will work obviously.

Update: Blizzard always defines friends as colour index 5, which is green, or FACTION_BAR_COLORS[5]. Look at lines 51-77 of https://www.townlong-yak.com/framexm...utationBar.lua

Zax 09-03-21 01:16 PM

Quote:

Originally Posted by myrroddin (Post 339794)
If I understand the question correctly, FACTION_STANDING_LABEL_n is a 0-8 table. While the names are "Unknown" through "Exalted", the 0-8 should map to friendship levels, even if the text isn't the same. In Ve'nari's case, there should be 9 (0-8) friendship levels, just as Chromie or Jogu the Drunk.

If you want the correct text, because "Unknown" through "Exalted" aren't applicable, you'll need the seventh return of GetFriendShipLevel().

That's right.

And thank you myrroddin for all these informations. Handling the reputations is not very convenient at this time.


All times are GMT -6. The time now is 12:25 AM.

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