Attempt to add Russian Cyrillic alphabet into the NickTag lib
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
local dversion = 229
|
||||
local dversion = 230
|
||||
|
||||
local major, minor = "DetailsFramework-1.0", dversion
|
||||
local DF, oldminor = LibStub:NewLibrary (major, minor)
|
||||
@@ -3550,7 +3550,7 @@ function DF:GetCharacterRaceList (fullList)
|
||||
|
||||
local alliedRaceInfo = C_AlliedRaces.GetRaceInfoByID (i)
|
||||
if (alliedRaceInfo and DF.AlliedRaceList [alliedRaceInfo.raceID]) then
|
||||
tinsert (DF.RaceCache, {Name = alliedRaceInfo.name, FileString = alliedRaceInfo.raceFileString})
|
||||
tinsert (DF.RaceCache, {Name = alliedRaceInfo.maleName, FileString = alliedRaceInfo.raceFileString})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
+15
-12
@@ -6092,7 +6092,7 @@ function DF:PassLoadFilters (loadTable, encounterID)
|
||||
local specIndex = DetailsFramework.GetSpecialization()
|
||||
if (specIndex) then
|
||||
local specID = DetailsFramework.GetSpecializationInfo (specIndex)
|
||||
if (not loadTable.spec [specID] or loadTable.spec [specID..""]) then
|
||||
if not specID or (not loadTable.spec [specID] and not loadTable.spec [specID..""]) then
|
||||
return false
|
||||
end
|
||||
else
|
||||
@@ -6114,7 +6114,7 @@ function DF:PassLoadFilters (loadTable, encounterID)
|
||||
local talentsInUse = DF:GetCharacterTalents (false, true)
|
||||
local hasTalent
|
||||
for talentID, _ in pairs (talentsInUse) do
|
||||
if (loadTable.talent [talentID]) then
|
||||
if talentID and (loadTable.talent [talentID] or loadTable.talent [talentID .. ""]) then
|
||||
hasTalent = true
|
||||
break
|
||||
end
|
||||
@@ -6129,7 +6129,7 @@ function DF:PassLoadFilters (loadTable, encounterID)
|
||||
local talentsInUse = DF:GetCharacterPvPTalents (false, true)
|
||||
local hasTalent
|
||||
for talentID, _ in pairs (talentsInUse) do
|
||||
if (loadTable.pvptalent [talentID]) then
|
||||
if talentID and (loadTable.pvptalent [talentID] or loadTable.pvptalent [talentID .. ""]) then
|
||||
hasTalent = true
|
||||
break
|
||||
end
|
||||
@@ -6171,7 +6171,7 @@ function DF:PassLoadFilters (loadTable, encounterID)
|
||||
local level, affixes, wasEnergized = C_ChallengeMode.GetActiveKeystoneInfo()
|
||||
local hasAffix = false
|
||||
for _, affixID in ipairs (affixes) do
|
||||
if (loadTable.affix [affixID]) then
|
||||
if affixID and (loadTable.affix [affixID] or loadTable.affix [affixID .. ""]) then
|
||||
hasAffix = true
|
||||
break
|
||||
end
|
||||
@@ -6285,7 +6285,10 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
f.OnRadioCheckboxClick = function (self, key, value)
|
||||
--hierarchy: DBKey ["class"] key ["HUNTER"] value TRUE
|
||||
local DBKey = self:GetParent().DBKey
|
||||
f.OptionsTable [DBKey] [key] = value and true or nil
|
||||
f.OptionsTable [DBKey] [key and key .. ""] = value and true or nil
|
||||
if not value then -- cleanup "number" type values
|
||||
f.OptionsTable [DBKey] [key] = nil
|
||||
end
|
||||
f.OnRadioStateChanged (self:GetParent(), f.OptionsTable [DBKey])
|
||||
f.RunCallback()
|
||||
end
|
||||
@@ -6347,7 +6350,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
name = talentTable.Name,
|
||||
set = f.OnRadioCheckboxClick,
|
||||
param = talentTable.ID,
|
||||
get = function() return f.OptionsTable.talent [talentTable.ID] end,
|
||||
get = function() return f.OptionsTable.talent [talentTable.ID] or f.OptionsTable.talent [talentTable.ID .. ""] end,
|
||||
texture = talentTable.Texture,
|
||||
})
|
||||
end
|
||||
@@ -6445,7 +6448,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
name = talentTable.Name,
|
||||
set = f.OnRadioCheckboxClick,
|
||||
param = talentTable.ID,
|
||||
get = function() return f.OptionsTable.pvptalent [talentTable.ID] end,
|
||||
get = function() return f.OptionsTable.pvptalent [talentTable.ID] or f.OptionsTable.pvptalent [talentTable.ID .. ""] end,
|
||||
texture = talentTable.Texture,
|
||||
})
|
||||
end
|
||||
@@ -6543,7 +6546,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
name = groupTable.Name,
|
||||
set = f.OnRadioCheckboxClick,
|
||||
param = groupTable.ID,
|
||||
get = function() return f.OptionsTable.group [groupTable.ID] end,
|
||||
get = function() return f.OptionsTable.group [groupTable.ID] or f.OptionsTable.group [groupTable.ID .. ""] end,
|
||||
})
|
||||
end
|
||||
local groupTypesGroup = DF:CreateRadionGroup (f, groupTypes, name, {width = 200, height = 200, title = "Group Types"})
|
||||
@@ -6558,7 +6561,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
name = roleTable.Texture .. " " .. roleTable.Name,
|
||||
set = f.OnRadioCheckboxClick,
|
||||
param = roleTable.ID,
|
||||
get = function() return f.OptionsTable.role [roleTable.ID] end,
|
||||
get = function() return f.OptionsTable.role [roleTable.ID] or f.OptionsTable.role [roleTable.ID .. ""] end,
|
||||
})
|
||||
end
|
||||
local roleTypesGroup = DF:CreateRadionGroup (f, roleTypes, name, {width = 200, height = 200, title = "Role Types"})
|
||||
@@ -6575,7 +6578,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
name = affixName,
|
||||
set = f.OnRadioCheckboxClick,
|
||||
param = i,
|
||||
get = function() return f.OptionsTable.affix [i] end,
|
||||
get = function() return f.OptionsTable.affix [i] or f.OptionsTable.affix [i .. ""] end,
|
||||
texture = texture,
|
||||
})
|
||||
end
|
||||
@@ -6643,7 +6646,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
name = talentTable.Name,
|
||||
set = DetailsFrameworkLoadConditionsPanel.OnRadioCheckboxClick,
|
||||
param = talentTable.ID,
|
||||
get = function() return DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID] end,
|
||||
get = function() return DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID] or DetailsFrameworkLoadConditionsPanel.OptionsTable.talent [talentTable.ID .. ""] end,
|
||||
texture = talentTable.Texture,
|
||||
})
|
||||
end
|
||||
@@ -6657,7 +6660,7 @@ function DF:OpenLoadConditionsPanel (optionsTable, callback, frameOptions)
|
||||
name = talentTable.Name,
|
||||
set = DetailsFrameworkLoadConditionsPanel.OnRadioCheckboxClick,
|
||||
param = talentTable.ID,
|
||||
get = function() return DetailsFrameworkLoadConditionsPanel.OptionsTable.pvptalent [talentTable.ID] end,
|
||||
get = function() return DetailsFrameworkLoadConditionsPanel.OptionsTable.pvptalent [talentTable.ID] or DetailsFrameworkLoadConditionsPanel.OptionsTable.pvptalent [talentTable.ID .. ""] end,
|
||||
texture = talentTable.Texture,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -276,7 +276,6 @@ function TimeBarMetaFunctions:SetTimer(currentTime, startTime, endTime)
|
||||
self.statusBar.timeLeft2 = currentTime
|
||||
end
|
||||
|
||||
--print("min|max values:", self.statusBar.starTime, self.statusBar.endTime)
|
||||
self.statusBar:SetMinMaxValues(self.statusBar.starTime, self.statusBar.endTime)
|
||||
|
||||
if (self.direction == "right") then
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
-- NickTag:SetNickname (name) -> set the player nick name, after set nicktag will broadcast the nick over addon guild channel.
|
||||
--
|
||||
|
||||
local major, minor = "NickTag-1.0", 12
|
||||
local major, minor = "NickTag-1.0", 13
|
||||
local NickTag, oldminor = LibStub:NewLibrary (major, minor)
|
||||
|
||||
if (not NickTag) then
|
||||
@@ -452,8 +452,26 @@ end
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
--> basic functions
|
||||
|
||||
local cyrillic = "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯЁЂЃЄЅІЇЈЉЊЋЌЎЏҐабвгдежзийклмнопрстуфхцчшщъыьэюяёђѓєѕіїјљњћќўџґАаБбВвГгДдЕеЁёЖжЗзИиЙйКкЛлМмНнОоПпРрСсТтУуФфХхЦцЧчШшЩщЪъЫыЬьЭэЮюЯя"
|
||||
local latin = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
local chinese = "ヲァィゥェォャュョッーアイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワン゙゚ᄀᄁᆪᄂᆬᆭᄃᄄᄅᆰᆱᆲᆳᆴᆵᄚᄆᄇᄈᄡᄉᄊᄋᄌᄍᄎᄏᄐᄑ하ᅢᅣᅤᅥᅦᅧᅨᅩᅪᅫᅬᅭᅮᅯᅰᅱᅲᅳᅴᅵ"
|
||||
|
||||
local alphabet = {
|
||||
cyrillic,
|
||||
latin,
|
||||
chinese,
|
||||
}
|
||||
|
||||
local allowedLetters = {}
|
||||
|
||||
for _, thisAlphabet in ipairs(alphabet) do
|
||||
for letter in thisAlphabet:gmatch(".") do
|
||||
allowedLetters[letter] = true
|
||||
end
|
||||
end
|
||||
|
||||
--> trim from from http://lua-users.org/wiki/StringTrim
|
||||
function trim (s)
|
||||
local function trim (s)
|
||||
local from = s:match"^%s*()"
|
||||
return from > #s and "" or s:match(".*%S", from)
|
||||
end
|
||||
@@ -474,11 +492,9 @@ end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--> we need to keep game smooth checking and formating nicknames.
|
||||
--> SetNickname and names comming from other player need to be check.
|
||||
function NickTag:CheckName (name)
|
||||
|
||||
--> as nicktag only work internally in the guild, we think that is not necessary a work filter to avoid people using bad language.
|
||||
|
||||
if (type (name) ~= "string") then
|
||||
@@ -486,19 +502,27 @@ end
|
||||
end
|
||||
|
||||
name = trim (name)
|
||||
|
||||
--> limit nickname to 12 characters, same as wow.
|
||||
--cyrillic seems to double the len using 2 bytes
|
||||
local len = string.len (name)
|
||||
if (len > 12) then
|
||||
return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_1"] --> error 1 = nickname is too long, max of 12 characters.
|
||||
end
|
||||
|
||||
|
||||
--> check if contain any non allowed characters, by now only accpet letters, numbers and spaces.
|
||||
--> by default wow do not accetp spaces, but here will allow.
|
||||
--> tested over lua 5.2 and this capture was okey with accents, not sure why inside wow this doesn't work.
|
||||
local notallow = string.find (name, "[^a-zA-Z�������%s]")
|
||||
if (notallow) then
|
||||
return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_2"] --> error 2 = nickname only support letters, numbers and spaces.
|
||||
|
||||
-- local notallow = string.find (name, "[^a-zA-Z�������%s]")
|
||||
-- if (notallow) then
|
||||
-- return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_2"] --> error 2 = nickname only support letters, numbers and spaces.
|
||||
-- end
|
||||
|
||||
for letter in name:gmatch(".") do
|
||||
print(letter, allowedLetters[letter])
|
||||
if (not allowedLetters[letter]) then
|
||||
return false, LibStub ("AceLocale-3.0"):GetLocale ("NickTag-1.0")["STRING_ERROR_2"] --> error 2 = nickname only support letters, numbers and spaces.
|
||||
end
|
||||
end
|
||||
|
||||
--> check if there is sequencial repeated characters, like "Jasooon" were repeats 3 times the "o" character.
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.0 MiB After Width: | Height: | Size: 1.0 MiB |
Reference in New Issue
Block a user