From fc332c5b10ffe0a09b218aa8c50644826e37a1fc Mon Sep 17 00:00:00 2001 From: Darth Predator Date: Sat, 24 Jun 2017 11:57:30 +0300 Subject: [PATCH] Prevent dots fucking up conditions. Mentioined in #483 --- ElvUI_SLE/locales/english.lua | 1 + ElvUI_SLE/locales/german.lua | 1 + ElvUI_SLE/locales/russian.lua | 3 ++- ElvUI_SLE/modules/equipmanager.lua | 39 +++++++++++++++++++----------------- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua index cece38d..cc24fbe 100644 --- a/ElvUI_SLE/locales/english.lua +++ b/ElvUI_SLE/locales/english.lua @@ -470,6 +470,7 @@ L["SLE_EM_SET_NOT_EXIST"] = "Equipment set |cff9482c9%s|r doesn't exist!" L["SLE_EM_TAG_INVALID"] = "Invalid tag: %s" L["SLE_EM_TAG_INVALID_TALENT_TIER"] = "Invalid argument for talent tag. Tier is |cff9482c9%s|r, should be from 1 to 7." L["SLE_EM_TAG_INVALID_TALENT_COLUMN"] = "Invalid argument for talent tag. Column is |cff9482c9%s|r, should be from 1 to 3." +L["SLE_EM_TAG_DOT_WARNING"] = "Wrong separator for conditions detected. You need to use commas instead of dots." L["SLE_EM_CONDITIONS_DESC"] = [[Determines conditions under which specified sets are equipeed. This works as macros and controlled by a set of tags as seen below.]] L["SLE_EM_TAGS_HELP"] = [[Following tags and parameters are eligible for setting equip condition: diff --git a/ElvUI_SLE/locales/german.lua b/ElvUI_SLE/locales/german.lua index f5a8440..4c3b258 100644 --- a/ElvUI_SLE/locales/german.lua +++ b/ElvUI_SLE/locales/german.lua @@ -461,6 +461,7 @@ L["SLE_EM_SET_NOT_EXIST"] = "Equipment set |cff9482c9%s|r doesn't exist!" L["SLE_EM_TAG_INVALID"] = "Invalid tag: %s" L["SLE_EM_TAG_INVALID_TALENT_TIER"] = "Invalid argument for talent tag. Tier is |cff9482c9%s|r, should be from 1 to 7." L["SLE_EM_TAG_INVALID_TALENT_COLUMN"] = "Invalid argument for talent tag. Column is |cff9482c9%s|r, should be from 1 to 3." +L["SLE_EM_TAG_DOT_WARNING"] = "Wrong separator for conditions detected. You need to use commas instead of dots." L["SLE_EM_CONDITIONS_DESC"] = [[Determines conditions under which specified sets are equipeed. This works as macros and controlled by a set of tags as seen below.]] L["SLE_EM_TAGS_HELP"] = [[Following tags and parameters are eligible for setting equip condition: diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua index f125a10..b43b8a6 100644 --- a/ElvUI_SLE/locales/russian.lua +++ b/ElvUI_SLE/locales/russian.lua @@ -460,6 +460,7 @@ L["SLE_EM_SET_NOT_EXIST"] = "Комплекта |cff9482c9%s|r не сущест L["SLE_EM_TAG_INVALID"] = "Неверный тэг: %s" L["SLE_EM_TAG_INVALID_TALENT_TIER"] = "Неверный параметр для тэга talent. Указан ряд |cff9482c9%s|r, должен быть от 1 до 7." L["SLE_EM_TAG_INVALID_TALENT_COLUMN"] = "Неверный параметр для тэга talent. Указан столбец |cff9482c9%s|r, должен быть от 1 до 3." +L["SLE_EM_TAG_DOT_WARNING"] = "Обнаружен неверный разделитель. Необходимо использовать запятые, а не точки." L["SLE_EM_CONDITIONS_DESC"] = [[Определяет условия, при которых будут надеваться указанные сеты. Работает по принципу макросов и контроллируется набором тэгов, представленным ниже.]] L["SLE_EM_TAGS_HELP"] = [[Следующие тэги и параметры могут использоваться для условий экипировки: @@ -784,7 +785,7 @@ L["Tooltip X-offset"] = "Смещение подсказки по X" L["Offset the tooltip on the X-axis."] = "Смещает подсказку по оси X относительно выбранной точки крепления." L["Tooltip Y-offset"] = "Смещение подсказки по Y" L["Offset the tooltip on the Y-axis."] = "Смещает подсказку по оси Y относительно выбранной точки крепления." -L["RAID_TOS"] = "ToS" +L["RAID_TOS"] = "ГС" L["RAID_NH"] = "ЦН" L["RAID_TOV"] = "ИД" L["RAID_EN"] = "ИК" diff --git a/ElvUI_SLE/modules/equipmanager.lua b/ElvUI_SLE/modules/equipmanager.lua index 54d79bb..281f3f9 100644 --- a/ElvUI_SLE/modules/equipmanager.lua +++ b/ElvUI_SLE/modules/equipmanager.lua @@ -64,8 +64,7 @@ EM.TagsTable = { end, ["talent"] = function(tier, column) if not (tier or column) then return false end - tier = T.tonumber(tier) - column = T.tonumber(column) + if not (T.tonumber(tier) or T.tonumber(column)) then return false end if tier < 0 or tier > 7 then SLE:ErrorPrint(T.format(L["SLE_EM_TAG_INVALID_TALENT_TIER"], tier)) return false end if column < 0 or column > 3 then SLE:ErrorPrint(T.format(L["SLE_EM_TAG_INVALID_TALENT_COLUMN"], column)) return false end local index = T.GetSpecialization() @@ -152,23 +151,27 @@ function EM:TagsProcess(msg) if cnd then local command, argument = (":"):split(cnd) local argTable = {} - if ("/"):split(argument) then - local put - while argument and ("/"):split(argument) do - put, argument = ("/"):split(argument) - T.tinsert(argTable, put) - end - else - T.tinsert(argTable, argument) - end - - local tag = command:match("^%s*(.+)%s*$") - if EM.TagsTable[tag] then - T.tinsert(parsed_cmds, { cmd = command:match("^%s*(.+)%s*$"), arg = argTable }) + if T.find(argument, ".") then + SLE:ErrorPrint(L["SLE_EM_TAG_DOT_WARNING"]) else - SLE:ErrorPrint(T.format(L["SLE_EM_TAG_INVALID"], tag)) - T.twipe(EM.SetData) - return + if ("/"):split(argument) then + local put + while argument and ("/"):split(argument) do + put, argument = ("/"):split(argument) + T.tinsert(argTable, put) + end + else + T.tinsert(argTable, argument) + end + + local tag = command:match("^%s*(.+)%s*$") + if EM.TagsTable[tag] then + T.tinsert(parsed_cmds, { cmd = command:match("^%s*(.+)%s*$"), arg = argTable }) + else + SLE:ErrorPrint(T.format(L["SLE_EM_TAG_INVALID"], tag)) + T.twipe(EM.SetData) + return + end end end end -- 1.7.9.5