Skip to content

Commit

Permalink
Consider human racial for reputation
Browse files Browse the repository at this point in the history
  • Loading branch information
Anonomit committed Dec 21, 2023
1 parent cb41993 commit a2a912f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Config/OptionsTables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ local function MakeExtraOptions(opts, categoryName)
local function MakeRequiredRacesOption()
local stat = "RequiredRaces"

local defaultText = format(ITEM_RACES_ALLOWED, self.MY_RACE_NAME)
local defaultText = format(ITEM_RACES_ALLOWED, self.MY_RACE_LOCALNAME)
local formattedText = defaultText
local changed
if self:GetOption("hide", stat) then
Expand Down
2 changes: 1 addition & 1 deletion Init/InitAddon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ end
-- ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝╚══════╝╚══════╝

do
Addon.MY_RACE_NAME = UnitRace"player"
Addon.MY_RACE_LOCALNAME, Addon.MY_RACE_FILENAME = UnitRace"player"

-- Races: Human, Orc, Dwarf, Night Elf, Undead, Tauren, Gnome, Troll, Blood Elf, Draenei
local raceIDs = {}
Expand Down
42 changes: 31 additions & 11 deletions Operations/AddReputation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ local Addon = LibStub("AceAddon-3.0"):GetAddon(ADDON_NAME)
local strGsub = string.gsub
local strMatch = string.match

local mathFloor = math.floor


--[[
Reputation standings
Expand All @@ -24,9 +26,9 @@ Reputation standings



local REPUTATION_TEXT_PATTERN = "%s +%d"
local REPUTATION_MAX_PATTERN = "/%d"
local REPUTATION_CUTOFF_PATTERN = " (|cff%s<%s|r)"
local REP_PATTERN = " +%d"
local WAYLAID_PATTERN = format(" +%%d (%s) | +%%d (%s)", EMPTY or GLYPH_EMPTY or GLYPH_INACTIVE, LOC_TYPE_FULL or LOAD_FULL or SHAKE_INTENSITY_FULL)
local REPUTATION_CUTOFF_PATTERN = " (|cff%s%s/%s|r)"



Expand Down Expand Up @@ -54,9 +56,22 @@ for ids, repInfo in pairs{
[{211935, 211832, 211830, 211834, 211827, 211826}] = {factionID = Addon.MY_FACTION == "Alliance" and 2586 or 2587, min = 200, cutoff = 6, max = 800},
[{211841}] = {factionID = Addon.MY_FACTION == "Alliance" and 2586 or 2587, min = 800, cutoff = 6},
} do
local faction = GetFactionInfoByID(repInfo.factionID)
if faction then
repInfo.faction = faction
end

if Addon.MY_RACE_FILENAME == "Human" then
for _, k in ipairs{"min", "max"} do
local rep = repInfo[k]
if rep then
repInfo[k] = mathFloor(rep * 1.1)
end
end
end
for _, id in ipairs(ids) do
Addon:Assertf(not reputationItems[id], "Duplicate waylaid supply crate: %d", id)
reputationItems[id] = repInfo
Addon:Assertf(not reputationItems[id], "Duplicate reputation item: %d", id)
reputationItems[id] = repInfo
Addon.waylaidSupplies[id] = true
end
end
Expand All @@ -69,14 +84,19 @@ function Addon:RewordReputation(itemID)
local repInfo = reputationItems[itemID]
if not repInfo then return end

local faction, _, standingID = GetFactionInfoByID(repInfo.factionID)

local text = format(REPUTATION_TEXT_PATTERN, faction, repInfo.min)
if repInfo.max then
text = text .. format(REPUTATION_MAX_PATTERN, repInfo.max)
if not repInfo.faction then
repInfo.faction = GetFactionInfoByID(repInfo.factionID)
end

local text = repInfo.faction
if repInfo.cutoff then
text = text .. format(REPUTATION_CUTOFF_PATTERN, standingID < repInfo.cutoff and Addon.COLORS.GREEN or Addon.COLORS.RED, reputationStandings[repInfo.cutoff])
local standingID = select(3, GetFactionInfoByID(repInfo.factionID))
text = text .. format(REPUTATION_CUTOFF_PATTERN, standingID < repInfo.cutoff and Addon.COLORS.GREEN or Addon.COLORS.RED, reputationStandings[standingID], reputationStandings[repInfo.cutoff])
end
if repInfo.max then
text = text .. format(WAYLAID_PATTERN, repInfo.min, repInfo.max)
else
text = text .. format(REP_PATTERN, repInfo.min)
end

text = self:InsertIcon(text, stat)
Expand Down

0 comments on commit a2a912f

Please sign in to comment.