You can define your own custom tags using the available data from Pretty Reputation. You can even modify existing tags. The newly created tags will be listed and available in the config of Pretty Reputation.
From info parameter in the function (as described in the Structure of a TAG section) contains the following information:
- faction = Name of the faction, as provided by the Blizzard reputation message
- change = Absolute value of the actual gain/loss
- negative = Set to true if the change is negative (i.e., a reputation loss), otherwise nil
- session = Reputation change during the session (this value may be negative)
- factionId = ID of the faction
It is possible that Pretty Reputation will not be able to fill these variables (as I am a bad programmer). In that case, Pretty Reputation will override the entire message with a predefined text.
- name = Name of the faction
- standingId = ID of the standing
- standingText = Reputation standing (e.g., "Friendly," "Revered," "True friend," etc.), it may include a reward icon and the paragon level if set in the options.
- standingColor = Color string in the format of "|cffrrggbb" for integrating in your message. Don't forget to add "|r" at the end.
- color = Same as above, but the format is {r = x, g = y, b = z}, where x, y, and z are numbers from 0 to 1.
- current = Current reputation value
- maximum = Maximum value of the current reputation (e.g., for Revered it is 21000 to reach Exalted)
- bottom = Raw number of reputation points for the current standing (bottom value)
- top = Raw number of reputation points for the current standing (top value)
- paragon = Reward icon (if available) and if set in the options, the paragon level. Empty string if no paragon level is obtained.
- renown = Renown level, empty string if no renown is available.
From LibStub("PrettyReputationTags").Options. These are returned as functions.
Reputation.barChar()= character for the bar-like progressReputation.barLength()= length of the bar-like progressReputation.showParagonCount()= whether to display paragon count in standing textReputation.shortCharCount()= number of characters in 'Short' TAGsStandingColors()= table of defined colors in escaped format ready to be used in print (in format "|cffrrggbb") {[1] = hated, [2] = hostile, [3] = unfriendly, [4] = neutral, [5] = friendly, [6] = honored, [7] = revered, [8] = exalted, [9] = paragon, [10] = renown}Colors()= same as above but the format is {r = x, g = y, b = z} instead of "|cffrrggbb"
From LibStub("PrettyReputationTags").Const. These are plain values.
Colors.name= color of name TAGColors.bar_full= color of filled bar charsColors.bar_empty= color of empty bar charsColors.bar_edge= color of brackets of bar-like progressColors.positive= color of positive gain, also used in Enable text and tooltipColors.negative= color of negative loss, also used in Disable text and tooltip
You will need LibStub (included in this example)
...
## Dependencies: PrettyReputation
...
Libs\LibStub\LibStub.lua
...
local tags = LibStub("PrettyReputationTags")
local definition = tags.Definition
local options = tags.Options
local const = tags.ConstIn the definition variable, all predefined TAGS are stored. It is possible to add new ones or modify existing ones.
definition["<<TAG>>"] = {
desc = "<<description>>",
value = function(info)
return "<<string>>"
end
}where
<<TAG>>= tag name<<description>>= description string shown in the configuration<<string>>= what will be displayed in chat if this TAG is used, must be a string
The value is defined as a function with one parameter. The members of this parameter are described in the Available info section.
The function defined in value is called only if that TAG is used in a message pattern (or in debug mode). You can use this function to do whatever you want, but remember, it is called every time a reputation message is displayed, and it MUST return a string!
definition["MD-newTag"] = {
desc = "new testing tag",
value = function(info)
return info.name
end
}definition["MD-paragonTest"] = {
desc = "paragon testing tag",
value = function(info)
local reputationColors = options.StandingColors()
if options.Reputation.showParagonCount() then
return reputationColors[9] .. "Paragon count is shown" .. "|r"
else
return const.Colors.negative .. "Paragon count is hidden" .. "|r"
end
end
}Any available tag can be modified
definition["name"].value = function(info) return "Faction name: " .. info.name enddefinition["c_name"] = {
desc = "redefined c_name tag",
value = function(info)
return info.standingColor .. "Faction name is " .. info.name .. "|r"
end
}