Skip to content

Instantly share code, notes, and snippets.

/core.lua Secret

Created July 17, 2014 22:29
Show Gist options
  • Save anonymous/1b400f80c468ed3069fc to your computer and use it in GitHub Desktop.
Save anonymous/1b400f80c468ed3069fc to your computer and use it in GitHub Desktop.
idTweaks = LibStub('AceAddon-3.0'):NewAddon('idTweaks',
'AceConsole-3.0'
)
idTweaks.replaceChatMessagesFilters = {
CHAT_MSG_AFK = {
},
CHAT_MSG_COMBAT_FACTION_CHANGE = {
},
CHAT_MSG_COMBAT_GUILD_XP_GAIN = {
},
CHAT_MSG_COMBAT_HONOR_GAIN = {
},
CHAT_MSG_COMBAT_XP_GAIN = {
['(.+) dies, you gain (.+) experience. %(%+(.+)exp Rested bonus%)'] = '+ %2 (+%3) xp: %1',
['(.+) dies, you gain (.+) experience.'] = '+ %2 xp: %1'
},
CHAT_MSG_COMBAT_MISC_INFO = {
},
CHAT_MSG_CURRENCY = {
},
CHAT_MSG_DND = {
},
CHAT_MSG_GUILD_ACHIEVEMENT = {
['%%s has earned the achievement (.+)!'] = '\124cff00ff00g %1 %%s\124hwat123'
},
CHAT_MSG_IGNORED = {
},
CHAT_MSG_LOOT = {
['You receive loot: (.+)%.'] = '+ %1'
},
CHAT_MSG_MONEY = {
},
CHAT_MSG_SKILL = {
},
CHAT_MSG_SYSTEM = {
['You are now Busy: in combat'] = '+ Combat',
['You are no longer marked Busy.'] = '- Combat'
},
CHAT_MSG_TARGETICONS = {
},
CHAT_MSG_TRADESKILLS = {
}
}
function idTweaks:OnInitialize()
self.db = LibStub('AceDB-3.0'):New('idTweaksDB')
self.options = {
name = 'idTweaks',
handler = self,
type = 'group',
args = {
profile = LibStub('AceDBOptions-3.0'):GetOptionsTable(self.db)
}
}
end
function idTweaks:OnEnable()
self:EnableReplaceChatMessages()
self:EnableMaxCameraDistance()
LibStub('AceConfig-3.0'):RegisterOptionsTable('idTweaks', self.options, { 'idt', 'idtweaks' })
end
function idTweaks:OnDisable()
self:DisableReplaceChatMessages()
self:DisableMaxCameraDistance()
end
function idTweaks:EnableReplaceChatMessages()
for event, eventFilters in pairs(idTweaks.replaceChatMessagesFilters) do
ChatFrame_AddMessageEventFilter(event, function(frame, event, message, ...)
if next(eventFilters) == nil then
idTweaks:Print(event..' :'..message)
end
for k,v in pairs(eventFilters) do
message = message:gsub(k, v)
end
return nil, message, ...
end)
end
end
function idTweaks:DisableReplaceChatMessages()
end
function idTweaks:EnableMaxCameraDistance()
self.MaxCameraDistance = GetCVar('cameraDistanceMax')
SetCVar('cameraDistanceMax', 30)
end
function idTweaks:DisableMaxCameraDistance()
SetCVar('cameraDistanceMax', self.MaxCameraDistance)
end
--local f = CreateFrame('Frame')
--local anchorTooltipsToMouse = function()
-- hooksecurefunc('GameTooltip_SetDefaultAnchor', function(tooltip, self)
-- tooltip:SetOwner(self, 'ANCHOR_CURSOR')
-- end)
--end
--
--local addSlashCommands = function()
-- SlashCmdList['IDTWEAKS_RELOAD'] = ReloadUI
-- SLASH_IDTWEAKS_RELOAD1 = '/rl'
-- SLASH_IDTWEAKS_RELOAD2 = '/reload'
--end
--
--local onevent = function(frame, event, ...)
-- if event == 'PLAYER_LOGIN' then
-- replaceChatMessages()
-- setCameraDistance()
-- anchorTooltipsToMouse()
-- addSlashCommands()
-- end
--end
--
--f:SetScript('OnEvent', onevent)
--f:RegisterEvent('PLAYER_LOGIN')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment