Skip to content

Commit

Permalink
Get cached value for the user language
Browse files Browse the repository at this point in the history
  • Loading branch information
Tercioo committed Feb 10, 2020
1 parent 90ca7b9 commit bcdd7ae
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 55 deletions.
1 change: 1 addition & 0 deletions Details.toc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ functions\report.lua
functions\rowanimation.lua
functions\raidinfo.lua
functions\dungeon.lua
functions\pack.lua

core\timemachine.lua

Expand Down
4 changes: 2 additions & 2 deletions boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
_ = nil
_detalhes = LibStub("AceAddon-3.0"):NewAddon("_detalhes", "AceTimer-3.0", "AceComm-3.0", "AceSerializer-3.0", "NickTag-1.0")

_detalhes.build_counter = 7259
_detalhes.alpha_build_counter = 7259 --if this is higher than the regular counter, use it instead
_detalhes.build_counter = 7269
_detalhes.alpha_build_counter = 7269 --if this is higher than the regular counter, use it instead
_detalhes.game_version = "v8.3.0"
_detalhes.userversion = "v8.3.0." .. _detalhes.build_counter
_detalhes.realversion = 140 --core version, this is used to check API version for scripts and plugins (see alias below)
Expand Down
87 changes: 34 additions & 53 deletions classes/container_combatentes.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
-- actor container file

local _detalhes = _G._detalhes
local DF = DetailsFramework
local _

local CONST_CLIENT_LANGUAGE = DF.ClientLanguage

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> local pointers

Expand Down Expand Up @@ -392,15 +395,11 @@
end

return nome, dono_do_pet
end
end
end

--> check pet owner name with correct declension for ruRU locale
--> check pet owner name with correct declension for ruRU locale (from user 'denis-kam' on github)
local find_name_declension = function (petTooltip, playerName)
if (GetLocale() ~= "ruRU") then
return petTooltip:find(playerName)
end

--> 2 - male, 3 - female
for gender = 2, 3 do
for declensionSet = 1, GetNumDeclensionSets(playerName, gender) do
Expand Down Expand Up @@ -429,68 +428,50 @@
for playerName, _ in _pairs (_detalhes.tabela_vigente.raid_roster) do
local pName = playerName
playerName = playerName:gsub ("%-.*", "") --remove realm name
if (find_name_declension(text1, playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)

--if the user client is in russian language
--make an attempt to remove declensions from the character's name
--this is equivalent to remove 's from the owner on enUS
if (CONST_CLIENT_LANGUAGE == "ruRU") then
if (find_name_declension (text1, playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
else
if (text1:find (playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
end
else
if (text1:find (playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
end
end
end

local line2 = _G ["DetailsPetOwnerFinderTextLeft3"]
local text2 = line2 and line2:GetText()
if (text2 and text2 ~= "") then
for playerName, _ in _pairs (_detalhes.tabela_vigente.raid_roster) do
local pName = playerName
playerName = playerName:gsub ("%-.*", "") --remove realm name
if (find_name_declension(text2, playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
end
end
end

--[[
local find_pet_owner = function (serial, nome, flag, self)
pet_tooltip_frame:SetOwner (WorldFrame, "ANCHOR_NONE")
pet_tooltip_frame:SetHyperlink ("unit:" .. serial or "")
local text = pet_text_object:GetText()
if (text and text ~= "") then
text = text:gsub ("'s", "") --> enUS
if (IsFactionNpc [text]) then
text = follower_text_object:GetText()
if (text) then
text = text:gsub ("'s", "") --> enUS
else
return
end
end
for _, ownerName in _ipairs ({strsplit (" ", text)}) do
local cur_combat = _detalhes.tabela_vigente
if (cur_combat and cur_combat.raid_roster [ownerName]) then
local ownerGuid = _UnitGUID (ownerName)
if (ownerGuid) then
_detalhes.tabela_pets:Adicionar (serial, nome, flag, ownerGuid, ownerName, 0x00000417)
local nome_dele, dono_nome, dono_serial, dono_flag = _detalhes.tabela_pets:PegaDono (serial, nome, flag)
local dono_do_pet
if (nome_dele and dono_nome) then
nome = nome_dele
dono_do_pet = self:PegarCombatente (dono_serial, dono_nome, dono_flag, true, nome)

if (CONST_CLIENT_LANGUAGE == "ruRU") then
if (find_name_declension (text2, playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
else
if (text2:find (playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
--print ("Owner Found:", ownerName, nome)
return nome, dono_do_pet
end
else
if (text2:find (playerName)) then
return find_pet_found_owner (pName, serial, nome, flag, self)
end
end
end
end
end
--]]


function container_combatentes:PegarCombatente (serial, nome, flag, criar)

--[[statistics]]-- _detalhes.statistics.container_calls = _detalhes.statistics.container_calls + 1
Expand Down
3 changes: 3 additions & 0 deletions functions/pack.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


local _detalhes = _G._detalhes

0 comments on commit bcdd7ae

Please sign in to comment.