From f85a4171f04183c4b7b597c5d846bbead12e86a9 Mon Sep 17 00:00:00 2001 From: coolmodi <7333074+coolmodi@users.noreply.github.com> Date: Fri, 9 Aug 2019 15:35:07 +0200 Subject: [PATCH] fix sound, remove server from names --- main.lua | 10 +++++++++- settings.lua | 16 ++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/main.lua b/main.lua index c99bdde..9a342c9 100644 --- a/main.lua +++ b/main.lua @@ -72,6 +72,12 @@ function _addon:FormNotifyMsg(search, source, from, msg, searchstart, searchend) fstart, fend = string.find(formed, "<%x%x%x%x%x%x>"); end + -- remove server dash + local dashLoc = string.find(from, "-"); + if dashLoc ~= nil then + from = string.sub(from, 1, dashLoc-1); + end + -- Placeholders formed = string.gsub(formed, "{K}", search); formed = string.gsub(formed, "{S}", source); @@ -92,6 +98,8 @@ function _addon:FormNotifyMsg(search, source, from, msg, searchstart, searchend) end local hours, minutes = GetGameTime(); + if hours < 10 then hours = "0" .. hours; end + if minutes < 10 then minutes = "0" .. minutes; end formed = string.gsub(formed, "{T}", hours..":"..minutes); return formed; @@ -107,7 +115,7 @@ function _addon:PostNotification(notiMsg, frameNum) _G["ChatFrame"..frameNum]:AddMessage(notiMsg); end - if CChatNotifier_settings.soundId > 0 then + if CChatNotifier_settings.soundId ~= "" then PlaySoundFile(CChatNotifier_settings.soundId, "Master"); end diff --git a/settings.lua b/settings.lua index b57445b..b0dad23 100644 --- a/settings.lua +++ b/settings.lua @@ -5,7 +5,7 @@ local DEFAULTSETTINGS = { ["firstStart"] = true, ["isActive"] = true, ["chatFrame"] = 1, - ["soundId"] = 567421, + ["soundId"] = "sound/interface/itellmessage.ogg", ["showMinimapButton"] = true, ["snapToMinimap"] = true, ["outputFormat"] = "", -- fill from localization @@ -13,13 +13,13 @@ local DEFAULTSETTINGS = { }; local SOUNDS = { - [0] = L["SOUND_NO_SOUND"], - [567094] = "Fog horn", -- sound/Doodad/LightHouseFogHorn.ogg - [567421] = "Whisper", --sound/interface/itellmessage.ogg - [539885] = "Dwarf", -- sound/character/dwarf/dwarfmale/dwarfmaledeatha.ogg - [567671] = "Something", -- sound/item/weapons/bow/arrowhitc.ogg - [567672] = "Something2", -- sound/item/weapons/bow/arrowhita.ogg - [567653] = "Hurts my ears", -- sound/item/weapons/axe2h/m2haxehitmetalweaponcrit.ogg + [""] = L["SOUND_NO_SOUND"], + ["sound/Doodad/LightHouseFogHorn.ogg"] = "Fog horn", -- 567094 + ["sound/interface/itellmessage.ogg"] = "Whisper", -- 567421 + ["sound/character/dwarf/dwarfmale/dwarfmaledeatha.ogg"] = "Dwarf", -- 539885 + ["sound/item/weapons/bow/arrowhitc.ogg"] = "Something", -- 567671 + ["sound/item/weapons/bow/arrowhita.ogg"] = "Something2", -- 567672 + ["sound/item/weapons/axe2h/m2haxehitmetalweaponcrit.ogg"] = "Hurts my ears" -- 567653 }; --- Handle stuff after settings changed, if needed