From def0ad71bf60d60b05ab3dbd307281458f94ae25 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Wed, 11 Nov 2020 13:52:01 -0300 Subject: [PATCH] Added alert for rare spawns on Icecrown from pre-patch --- .gitignore | 1 + FlashTaskBar.lua | 56 +++++++++++++++++++++++++++++++++++++---------- libs/DF/fw.lua | 23 +++++++++++++++++-- libs/DF/panel.lua | 19 ++++++++++++++-- 4 files changed, 84 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 4f7ee96..cd53c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,4 @@ locales/ptBR.lua locales/ruRU.lua locales/zhCN.lua locales/zhTW.lua +wowapi.lua diff --git a/FlashTaskBar.lua b/FlashTaskBar.lua index e6a5337..782916f 100644 --- a/FlashTaskBar.lua +++ b/FlashTaskBar.lua @@ -585,10 +585,44 @@ function FlashTaskBar.OnInit (self) --/dump C_VignetteInfo.GetVignetteInfo (C_VignetteInfo.GetVignettes()[1]) --/dump C_VignetteInfo.GetVignettes() - for index, GUID in ipairs (C_VignetteInfo.GetVignettes()) do - local vignetteInfo = C_VignetteInfo.GetVignetteInfo (GUID) - if (vignetteInfo and vignetteInfo.onMinimap and not vignetteInfo.isDead and vignetteInfo.atlasName == "VignetteKill") then --vignetteID == 2004 + --track special events + --[=[]] + for i, vignetteID in ipairs (C_VignetteInfo.GetVignettes()) do + local vignetteInfo = C_VignetteInfo.GetVignetteInfo (vignetteID) + if (vignetteInfo) then + local serial = vignetteInfo.objectGUID + + if (serial) then + local name = vignetteInfo.name + local objectIcon = vignetteInfo.atlasName + + --naga event + if (objectIcon == "nazjatar-nagaevent") then + WorldQuestTracker.NagaEventCooldown = WorldQuestTracker.NagaEventCooldown or 0 + if (WorldQuestTracker.NagaEventCooldown < time()) then + WorldQuestTracker:Msg("a naga event is happening, open the map for location.|r") + WorldQuestTracker.NagaEventCooldown = time() + 360 --6min + end + end + end + end + end + --]=] + ----------------------- + + for _, vignetteID in ipairs (C_VignetteInfo.GetVignettes()) do + local vignetteInfo = C_VignetteInfo.GetVignetteInfo (vignetteID) + + --special event on icecrown map 9.0.1 event + if (vignetteInfo and C_Map.GetBestMapForUnit ("player") == 118) then + local objectIcon = vignetteInfo.atlasName + if (objectIcon == "nazjatar-nagaevent") then + FlashTaskBar:DoFlash ("rare_scan") + end + end + + if (vignetteInfo and vignetteInfo.onMinimap and not vignetteInfo.isDead and vignetteInfo.atlasName == "VignetteKill") then --vignetteID == 2004 local objectGUID = vignetteInfo.objectGUID if (FlashTaskBar.db.profile.any_rare) then if (not UnitOnTaxi ("player")) then @@ -599,11 +633,11 @@ function FlashTaskBar.OnInit (self) end elseif (vignetteInfo.name) then - for _, npc_name in ipairs (FlashTaskBar.db.profile.rare_names) do - npc_name = lower (npc_name) - name = lower (name) - if (npc_name == name) then - if (not FlashTaskBar.RareFlashCooldown [objectGUID] or FlashTaskBar.RareFlashCooldown [objectGUID] < time()) then + for _, npcName in ipairs(FlashTaskBar.db.profile.rare_names) do + npcName = lower(npcName) + local vignetteName = lower(vignetteInfo.name) + if (npcName == vignetteName) then + if (not FlashTaskBar.RareFlashCooldown[objectGUID] or FlashTaskBar.RareFlashCooldown[objectGUID] < time()) then FlashTaskBar:DoFlash ("rare_scan") FlashTaskBar.RareFlashCooldown [objectGUID] = time() + 180 end @@ -822,7 +856,7 @@ function FlashTaskBar.OnInit (self) if (FlashTaskBar.db.profile.on_chat_player_name) then FlashTaskBar:EnableChatScan() else - --ver se tem alguma outra função usando o chat scan + --ver se tem alguma outra fun��o usando o chat scan if (not FlashTaskBar.db.profile.chat_scan) then FlashTaskBar:DisableChatScan() end @@ -955,7 +989,7 @@ function FlashTaskBar.OnInit (self) if (value) then FlashTaskBar:EnableChatScan() else - --ver se tem alguma outra função usando o chat scan + --ver se tem alguma outra fun��o usando o chat scan if (not FlashTaskBar.db.profile.on_chat_player_name) then FlashTaskBar:DisableChatScan() end @@ -1006,7 +1040,7 @@ function FlashTaskBar.OnInit (self) button_keyword_remove:SetPoint ("left", dropdown_keyword_remove, "right", 2, 0) label_keyword_remove:SetPoint ("topleft", FlashTaskBar.OptionsFrame1, "topleft", 10, y_chat_scan-60) - --ativar o chat scan se necessário + --ativar o chat scan se necess�rio if (FlashTaskBar.db.profile.chat_scan or FlashTaskBar.db.profile.on_chat_player_name) then FlashTaskBar:EnableChatScan() end diff --git a/libs/DF/fw.lua b/libs/DF/fw.lua index 4720bd0..528dd06 100644 --- a/libs/DF/fw.lua +++ b/libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 214 +local dversion = 218 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary (major, minor) @@ -609,7 +609,26 @@ function DF:TruncateText (fontString, maxWidth) if (string.len (text) <= 1) then break end - end + end + + text = DF:CleanTruncateUTF8String(text) + fontString:SetText (text) +end + +function DF:CleanTruncateUTF8String(text) + if type(text) == "string" and text ~= "" then + local b1 = (#text > 0) and strbyte(strsub(text, #text, #text)) or nil + local b2 = (#text > 1) and strbyte(strsub(text, #text-1, #text)) or nil + local b3 = (#text > 2) and strbyte(strsub(text, #text-2, #text)) or nil + if b1 and b1 >= 194 and b1 <= 244 then + text = strsub (text, 1, #text - 1) + elseif b2 and b2 >= 224 and b2 <= 244 then + text = strsub (text, 1, #text - 2) + elseif b3 and b3 >= 240 and b3 <= 244 then + text = strsub (text, 1, #text - 3) + end + end + return text end function DF:Msg (msg, ...) diff --git a/libs/DF/panel.lua b/libs/DF/panel.lua index 76d49a5..04190a8 100644 --- a/libs/DF/panel.lua +++ b/libs/DF/panel.lua @@ -5131,6 +5131,7 @@ DF.IconRowFunctions = { cooldownFrame:SetAllPoints() cooldownFrame:EnableMouse (false) cooldownFrame:SetFrameLevel (newIconFrame:GetFrameLevel()+1) + cooldownFrame:SetHideCountdownNumbers (self.options.surpress_blizzard_cd_timer) cooldownFrame.noCooldownCount = self.options.surpress_tulla_omni_cc newIconFrame.CountdownText = cooldownFrame:CreateFontString (nil, "overlay", "GameFontNormal") @@ -5224,12 +5225,15 @@ DF.IconRowFunctions = { iconFrame.CountdownText:SetPoint (self.options.text_anchor or "center", iconFrame, self.options.text_rel_anchor or "center", self.options.text_x_offset or 0, self.options.text_y_offset or 0) DF:SetFontSize (iconFrame.CountdownText, self.options.text_size) + DF:SetFontFace (iconFrame.CountdownText, self.options.text_font) + DF:SetFontOutline (iconFrame.CountdownText, self.options.text_outline) iconFrame.CountdownText:SetText (formattedTime) - iconFrame.Cooldown:SetHideCountdownNumbers (true) + else iconFrame.CountdownText:Hide() - iconFrame.Cooldown:SetHideCountdownNumbers (false) end + + iconFrame.Cooldown:SetHideCountdownNumbers (self.options.surpress_blizzard_cd_timer) else iconFrame.CountdownText:Hide() end @@ -5240,6 +5244,8 @@ DF.IconRowFunctions = { iconFrame.Desc:SetTextColor (DF:ParseColors (descText.text_color or self.options.desc_text_color)) iconFrame.Desc:SetPoint(self.options.desc_text_anchor or "bottom", iconFrame, self.options.desc_text_rel_anchor or "top", self.options.desc_text_x_offset or 0, self.options.desc_text_y_offset or 2) DF:SetFontSize (iconFrame.Desc, descText.text_size or self.options.desc_text_size) + DF:SetFontFace (iconFrame.Desc, self.options.desc_text_font) + DF:SetFontOutline (iconFrame.Desc, self.options.desc_text_outline) else iconFrame.Desc:Hide() end @@ -5250,6 +5256,8 @@ DF.IconRowFunctions = { iconFrame.StackText:SetTextColor (DF:ParseColors (self.options.desc_text_color)) iconFrame.StackText:SetPoint (self.options.stack_text_anchor or "center", iconFrame, self.options.stack_text_rel_anchor or "bottomright", self.options.stack_text_x_offset or 0, self.options.stack_text_y_offset or 0) DF:SetFontSize (iconFrame.StackText, self.options.stack_text_size) + DF:SetFontFace (iconFrame.StackText, self.options.stack_text_font) + DF:SetFontOutline (iconFrame.StackText, self.options.stack_text_outline) else iconFrame.StackText:Hide() end @@ -5330,6 +5338,8 @@ local default_icon_row_options = { show_text = true, text_color = {1, 1, 1, 1}, text_size = 12, + text_font = "Arial Narrow", + text_outline = "NONE", text_anchor = "center", text_rel_anchor = "center", text_x_offset = 0, @@ -5337,6 +5347,8 @@ local default_icon_row_options = { desc_text = true, desc_text_color = {1, 1, 1, 1}, desc_text_size = 7, + desc_text_font = "Arial Narrow", + desc_text_outline = "NONE", desc_text_anchor = "bottom", desc_text_rel_anchor = "top", desc_text_x_offset = 0, @@ -5344,6 +5356,8 @@ local default_icon_row_options = { stack_text = true, stack_text_color = {1, 1, 1, 1}, stack_text_size = 10, + stack_text_font = "Arial Narrow", + stack_text_outline = "NONE", stack_text_anchor = "center", stack_text_rel_anchor = "bottomright", stack_text_x_offset = 0, @@ -5356,6 +5370,7 @@ local default_icon_row_options = { backdrop_border_color = {0, 0, 0, 1}, anchor = {side = 6, x = 2, y = 0}, grow_direction = 1, --1 = to right 2 = to left + surpress_blizzard_cd_timer = false, surpress_tulla_omni_cc = false, }