Skip to content

Commit

Permalink
fix sound, remove server from names
Browse files Browse the repository at this point in the history
  • Loading branch information
coolmodi committed Aug 9, 2019
1 parent 39e9a4f commit f85a417
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
10 changes: 9 additions & 1 deletion main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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

Expand Down
16 changes: 8 additions & 8 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ local DEFAULTSETTINGS = {
["firstStart"] = true,
["isActive"] = true,
["chatFrame"] = 1,
["soundId"] = 567421,
["soundId"] = "sound/interface/itellmessage.ogg",
["showMinimapButton"] = true,
["snapToMinimap"] = true,
["outputFormat"] = "", -- fill from localization
["version"] = GetAddOnMetadata(_addonName, "Version")
};

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
Expand Down

0 comments on commit f85a417

Please sign in to comment.