Skip to content

Commit

Permalink
Patch 7.3.0 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonaza committed Sep 27, 2017
1 parent 95c19a9 commit 8f46987
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 28 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.4.0
* TOC bump for patch 7.3.0.
* Updated artifact module to support tallying Artifact Power tokens that reward billions of AP. Support is lacking for Spanish and Russian localizations (and the rest are Google translated and may be incorrect anyway).
* Fixed guild reputation name in recent reputations list.

## 2.3.1
* Added a new keybind for honor bar: Shift middle-click will now toggle honor talents frame or FlashTalent (separate addon) honor talent window if it is installed.
* Fixed artifact module causing hangs in loading screen. This time it should work (famous last words).
Expand Down
4 changes: 2 additions & 2 deletions Experiencer.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Interface: 70200
## Interface: 70300
## Title: Experiencer
## Notes: Simple and Advanced Experience and Reputation Progress Bar
## Author: Sonaza
## Version: 2.3.1
## Version: 2.4.0
## OptionalDeps: Ace3
## SavedVariables: ExperiencerDB, ExperiencerDB_module_experience, ExperiencerDB_module_reputation, ExperiencerDB_module_artifact, ExperiencerDB_module_honor

Expand Down
95 changes: 72 additions & 23 deletions modules/artifact.lua
Original file line number Diff line number Diff line change
Expand Up @@ -324,28 +324,65 @@ local EMPOWERING_SPELL_ID = 227907;

local ExperiencerAPScannerTooltip = CreateFrame("GameTooltip", "ExperiencerAPScannerTooltip", nil, "GameTooltipTemplate");

local APStringValueMillion = {
["enUS"] = "(%d*[%p%s]?%d+) million",
["enGB"] = "(%d*[%p%s]?%d+) million",
["ptBR"] = "(%d*[%p%s]?%d+) [[milhão][milhões]]?",
["esMX"] = "(%d*[%p%s]?%d+) [[millón][millones]]?",
["deDE"] = "(%d*[%p%s]?%d+) [[Million][Millionen]]?",
["esES"] = "(%d*[%p%s]?%d+) [[millón][millones]]?",
["frFR"] = "(%d*[%p%s]?%d+) [[million][millions]]?",
["itIT"] = "(%d*[%p%s]?%d+) [[milione][milioni]]?",
["ruRU"] = "(%d*[%p%s]?%d+) млн",
["koKR"] = "(%d*[%p%s]?%d+)만",
["zhTW"] = "(%d*[%p%s]?%d+)萬",
["zhCN"] = "(%d*[%p%s]?%d+) 万",
local apStringValues = {
["enUS"] = {
"(%d*[%p%s]?%d+) million",
"(%d*[%p%s]?%d+) billion"
},
["enGB"] = {
"(%d*[%p%s]?%d+) million",
"(%d*[%p%s]?%d+) billion"
},
["ptBR"] = {
"(%d*[%p%s]?%d+) [[milhão][milhões]]?",
"(%d*[%p%s]?%d+) [[bilhão][bilhões]]?"
},
["esMX"] = {
"(%d*[%p%s]?%d+) [[millón][millones]]?",
"(%d*[%p%s]?%d+) [[billón][billones]]?" -- TODO
},
["deDE"] = {
"(%d*[%p%s]?%d+) [[Million][Millionen]]?",
"(%d*[%p%s]?%d+) [[Milliarde][Milliarden]]?"
},
["esES"] = {
"(%d*[%p%s]?%d+) [[millón][millones]]?",
"(%d*[%p%s]?%d+) [[billón][billones]]?" -- TODO
},
["frFR"] = {
"(%d*[%p%s]?%d+) [[million][millions]]?",
"(%d*[%p%s]?%d+) [[milliard][milliards]]?"
},
["itIT"] = {
"(%d*[%p%s]?%d+) [[milione][milioni]]?",
"(%d*[%p%s]?%d+) [[miliardo][miliardi]]?"
},
["ruRU"] = {
"(%d*[%p%s]?%d+) млн",
"(%d*[%p%s]?%d+) млн" -- TODO
},
["koKR"] = {
"(%d*[%p%s]?%d+)만",
"(%d*[%p%s]?%d+)억"
},
["zhTW"] = {
"(%d*[%p%s]?%d+)萬",
"(%d*[%p%s]?%d+)億"
},
["zhCN"] = {
"(%d*[%p%s]?%d+) 万",
"(%d*[%p%s]?%d+) 亿"
},
};
local APValueMultiplier = {
["koKR"] = 1e4,
["zhTW"] = 1e4,
["zhCN"] = 1e4,
local apValueMultipliers = {
["default"] = { 1e6, 1e9 },
["koKR"] = { 1e4, 1e8 },
["zhTW"] = { 1e4, 1e8 },
["zhCN"] = { 1e4, 1e8 },
};

local APStringValueMillionLocal = APStringValueMillion[GetLocale()];
local APValueMultiplierLocal = (APValueMultiplier[GetLocale()] or 1e6);
local apStringValuesLocal = apStringValues[GetLocale()];
local apValueMultiplierLocal = (apValueMultipliers[GetLocale()] or apValueMultipliers["default"]);

function module:FindPowerItemsInInventory()
if(self.inLoadingScreen) then return 0, 0 end
Expand Down Expand Up @@ -376,6 +413,16 @@ function module:FindPowerItemsInInventory()
return totalPower, powers;
end

function module:StringMatchMultipleValues(str, values)
for index, pattern in ipairs(values) do
local value = strmatch(str, pattern);
if(value) then
return value, index;
end
end
return nil;
end

function module:GetItemArtifactPower(link)
if(not link) then return nil end
if(self.inLoadingScreen) then return nil end
Expand All @@ -387,14 +434,16 @@ function module:GetItemArtifactPower(link)
if(not tooltipText) then return nil end

local digit1, digit2, digit3, power;
local value = strmatch(tooltipText, APStringValueMillionLocal);
local value, multiplierIndex = module:StringMatchMultipleValues(tooltipText, apStringValuesLocal);

if (value) then
if (value and multiplierIndex) then
local multiplier = apValueMultiplierLocal[multiplierIndex];

digit1, digit2 = strmatch(value, "(%d+)[%p%s](%d+)");
if (digit1 and digit2) then
power = tonumber(format("%s.%s", digit1, digit2)) * APValueMultiplierLocal;
power = tonumber(format("%s.%s", digit1, digit2)) * multiplier;
else
power = tonumber(value) * APValueMultiplierLocal;
power = tonumber(value) * multiplier;
end
else
digit1, digit2, digit3 = strmatch(tooltipText,"(%d+)[%p%s]?(%d+)[%p%s]?(%d*)");
Expand Down
16 changes: 13 additions & 3 deletions modules/reputation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,16 @@ function module:CHAT_MSG_COMBAT_FACTION_CHANGE(event, message, ...)

if(not reputation or not module.recentReputations) then return end

local isGuild = false;
if(reputation == GUILD) then
isGuild = true;

local guildName = GetGuildInfo("player");
if(guildName) then
reputation = guildName;
end
end

if(not module.recentReputations[reputation]) then
module.recentReputations[reputation] = {
amount = 0,
Expand All @@ -657,13 +667,13 @@ function module:CHAT_MSG_COMBAT_FACTION_CHANGE(event, message, ...)
if(self.db.global.AutoWatch.Enabled) then
local name = GetWatchedFactionInfo();
if(name ~= reputation) then
module:UpdateAutoWatch(reputation);
module:UpdateAutoWatch(reputation, isGuild);
end
end
end

function module:UpdateAutoWatch(reputation)
if(self.db.global.AutoWatch.IgnoreGuild and reputation == GUILD) then return end
function module:UpdateAutoWatch(reputation, isGuild)
if(self.db.global.AutoWatch.IgnoreGuild and isGuild) then return end

local factionListIndex, factionID = module:GetReputationID(reputation);
if(not factionListIndex) then return end
Expand Down

0 comments on commit 8f46987

Please sign in to comment.