-
-
Save Industrial/53e182c661e0466a4de5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local idTweaks = LibStub('AceAddon-3.0'):NewAddon('idTweaks', | |
'AceConsole-3.0' | |
) | |
function idTweaks:OnInitialize() | |
self.defaults = { | |
} | |
self.db = LibStub('AceDB-3.0'):New('idTweaksDB', self.defaults, 'Default') | |
self.options = { | |
name = 'idTweaks', | |
handler = self, | |
type = 'group', | |
args = { | |
} | |
} | |
LibStub('AceConfig-3.0'):RegisterOptionsTable('idTweaks', self.options, { 'idt', 'idtweaks' }) | |
LibStub('AceConfigDialog-3.0'):AddToBlizOptions('idTweaks') | |
self.profileOptions = LibStub('AceDBOptions-3.0'):GetOptionsTable(self.db) | |
LibStub('AceConfig-3.0'):RegisterOptionsTable('idTweaks-Profiles', self.profileOptions) | |
LibStub('AceConfigDialog-3.0'):AddToBlizOptions('idTweaks-Profiles', 'Profiles', 'idTweaks') | |
end | |
function idTweaks:addOptions(name, options) | |
self.options.args[name] = options | |
end | |
function idTweaks:OnEnable() | |
end | |
local MaxCameraDistance = idTweaks:NewModule('MaxCameraDistance') | |
function MaxCameraDistance:OnInitialize() | |
-- TODO: make this static | |
self.originalValue = GetCVar('cameraDistanceMax') | |
-- TODO: Make this an option | |
self.defaultValue = 30 | |
self.value = nil | |
self.options = { | |
name = 'Max Camera Distance', | |
handler = self, | |
type = 'group', | |
args = { | |
value = { | |
name = 'Value', | |
type = 'range', | |
min = 20, | |
max = 30, | |
get = 'getValue', | |
set = 'setValue' | |
} | |
} | |
} | |
LibStub('AceConfig-3.0'):RegisterOptionsTable('idTweaks-MaxCameraDistance', self.options, { 'cam', 'camera' }) | |
LibStub('AceConfigDialog-3.0'):AddToBlizOptions('idTweaks-MaxCameraDistance', 'Max Camera Distance', 'idTweaks') | |
end | |
function MaxCameraDistance:getValue() | |
return self.value | |
end | |
function MaxCameraDistance:setValue(_, value) | |
self.value = value and math.floor(value) or self.options.args.value.min | |
self:setDistance() | |
end | |
function MaxCameraDistance:setDistance() | |
SetCVar('cameraDistanceMax', self.value) | |
end | |
function MaxCameraDistance:OnEnable() | |
self:setValue(nil, self.defaultValue) | |
end | |
function MaxCameraDistance:OnDisable() | |
self:setValue(nil, self.originalValue) | |
end | |
local ReplaceChatMessages = idTweaks:NewModule('ReplaceChatMessages') | |
function ReplaceChatMessages:OnInitialize() | |
self.filters = { | |
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 = { | |
} | |
} | |
end | |
function ReplaceChatMessages:OnEnable() | |
for event, eventFilters in pairs(self.filters) do | |
ChatFrame_AddMessageEventFilter(event, function(frame, event, message, ...) | |
if next(eventFilters) == nil then | |
ReplaceChatMessages:Print(event..' :'..message) | |
end | |
for k,v in pairs(eventFilters) do | |
message = message:gsub(k, v) | |
end | |
return nil, message, ... | |
end) | |
end | |
end | |
-- Make this a module to create new slash commands from the config/options. | |
local SlashCommands = idTweaks:NewModule('SlashCommands') | |
function SlashCommands:OnEnable() | |
SlashCmdList['IDTWEAKS_RELOAD'] = ReloadUI | |
SLASH_IDTWEAKS_RELOAD1 = '/rl' | |
SLASH_IDTWEAKS_RELOAD2 = '/reload' | |
end | |
function SlashCommands:OnDisable() | |
SlashCmdList['IDTWEAKS_RELOAD'] = nil | |
SLASH_IDTWEAKS_RELOAD1 = nil | |
SLASH_IDTWEAKS_RELOAD2 = nil | |
end | |
local AnchorMouse = idTweaks:NewModule('AnchorMouse', 'AceHook-3.0') | |
function AnchorMouse:GameTooltip_SetDefaultAnchor(tooltip, self) | |
tooltip:SetOwner(self, 'ANCHOR_CURSOR') | |
end | |
function AnchorMouse:OnEnable() | |
self:SecureHook('GameTooltip_SetDefaultAnchor') | |
end | |
function AnchorMouse:OnDisable() | |
self:Unhook('GameTooltip_SetDefaultAnchor') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment