Quantcast

v1.13 - Option to disable info messages

Pawel [05-23-16 - 18:30]
v1.13 - Option to disable info messages
Filename
TDButtons.lua
TDDps.lua
TDDps.toc
TDSettings.lua
diff --git a/TDButtons.lua b/TDButtons.lua
index 88d9180..a3f77c3 100644
--- a/TDButtons.lua
+++ b/TDButtons.lua
@@ -142,7 +142,7 @@ function TDButton_Fetch()
 		TDButton_FetchButtonForge();
 	end

-	print(_tdInfo .. TDDpsName .. ': Fetched action bars!');
+	TDDps_Print(_tdInfo, 'Fetched action bars!');
 end

 ----------------------------------------------
@@ -218,6 +218,14 @@ end
 ----------------------------------------------
 function TDButton_FetchElvUI()
 	local ret = false;
+--	local slotID = rememberedActionSlot[spellName];
+--	local bonusOffset = ((NUM_ACTIONBAR_PAGES + GetBonusBarOffset() - 1) * NUM_ACTIONBAR_BUTTONS);
+--	slotID = slotID - bonusOffset;
+--	local bar = math.floor(slotID / 10) + 1;
+--	local btn = slotID % 10;
+--
+--	local button = _G['ElvUI_Bar' .. bar .. 'Button' .. btn];
+
 	for x = 1, 10 do
 		for i = 1, 12 do
 			local button = _G['ElvUI_Bar' .. x .. 'Button' .. i];
@@ -276,7 +284,6 @@ function TDButton_FetchBartender4()
 			local spellId = button:GetSpellId();
 			if spellId then
 				local actionName, _ = GetSpellInfo(spellId);
-				print(actionName, spellId);
 				if actionName then
 					if TDButton_Spells[actionName] == nil then
 						TDButton_Spells[actionName] = {};
@@ -350,7 +357,7 @@ function TDButton_GlowSpell(spellName)
 		end
 		TDButton_SpellsGlowing[spellName] = 1;
 	else
-		print(_tdError .. TDDpsName .. ': Spell not found on action bars: ' .. spellName);
+		TDDps_Print(_tdError, 'Spell not found on action bars: ' .. spellName);
 	end
 end

diff --git a/TDDps.lua b/TDDps.lua
index 8c254b2..4ca243f 100644
--- a/TDDps.lua
+++ b/TDDps.lua
@@ -31,6 +31,14 @@ local Classes = {
 local TDDps_Frame = CreateFrame('Frame', 'TDDps_Frame');
 TDDps_Frame.rotationEnabled = false;

+function TDDps_Print(color, message)
+	if TDDps_Options.disabledInfo then
+		return;
+	end
+
+	print(color .. TDDpsName .. ': ' .. message);
+end
+
 ----------------------------------------------
 -- Disable dps addon functionality
 ----------------------------------------------
@@ -39,7 +47,7 @@ function TDDps_DisableAddon()
 		return;
 	end
 	TDButton_DestroyAllOverlays();
-	print(_tdInfo .. TDDpsName .. ': Disabling');
+	TDDps_Print(_tdInfo, 'Disabling');
 	TDDps_Frame:SetScript('OnUpdate', nil);
 	DPS_Skill = nil;
 	TDDps_Frame.rotationEnabled = false;
@@ -61,17 +69,16 @@ function TDDps_InitAddon()

 	TDDps_Frame:SetScript('OnEvent', TDDps_OnEvent);

-	print(_tdInfo .. TDDpsName .. ': Initialized');
+	TDDps_Print(_tdInfo, 'Initialized');
 end

 ----------------------------------------------
 -- Enable dps addon functionality
 ----------------------------------------------
 function TDDps_EnableAddon(mode)
-	print(_tdInfo .. TDDpsName .. ': Enabling');
+	TDDps_Print(_tdInfo, 'Enabling');

 	if _TD['DPS_NextSpell'] == nil then
-		print(_tdError .. TDDpsName .. ': No addon selected, cannot enable');
 		return;
 	end

@@ -90,7 +97,7 @@ function TDDps_EnableAddon(mode)
 	TDDps_Frame:SetScript('OnUpdate', TDDps_OnUpdate);

 	_TD['DPS_Enabled'] = 1;
-	print(_tdSuccess .. TDDpsName .. ': Enabled');
+	TDDps_Print(_tdSuccess, 'Enabled');
 end

 ----------------------------------------------
@@ -128,12 +135,12 @@ function TDDps_OnEvent(self, event)
 		end
 	end
 	if event == 'PLAYER_REGEN_DISABLED' and TDDps_Options.onCombatEnter and not TDDps_Frame.rotationEnabled then
-		print(_tdSuccess .. TDDpsName .. ': Auto enable on combat!');
+		TDDps_Print(_tdSuccess, 'Auto enable on combat!');
 		TDDps_Frame.rotationEnabled = true;
 		TDDps_LoadModule();
 	end
 --	if event == 'PLAYER_REGEN_ENABLED' then
---		print(_tdSuccess .. TDDpsName .. ': Auto disable on combat!');
+--		TDDps_Print(_tdSuccess, 'Auto disable on combat!');
 --		TDDps_Frame.rotationEnabled = false;
 --		TDDps_DisableAddon();
 --	end
@@ -158,18 +165,18 @@ function TDDps_LoadModule()

 	local _, _, classId = UnitClass('player');
 	if Classes[classId] == nil then
-		print(_tdError .. TDDpsName .. ': Invalid player class, please contact author of addon.');
+		TDDps_Print(_tdError, 'Invalid player class, please contact author of addon.');
 		return;
 	end

 	local module = 'TDDps_' .. Classes[classId];

 	if not IsAddOnLoaded(module) then
-		LoadAddOn(module)
+		LoadAddOn(module);
 	end

 	if not IsAddOnLoaded(module) then
-		print(_tdError .. TDDpsName .. ': Could not find class module.');
+		TDDps_Print(_tdError, 'Could not find class module.');
 		return;
 	end

@@ -177,6 +184,11 @@ function TDDps_LoadModule()
 	local init = module .. '_EnableAddon';

 	_G[init](mode);
+
+	if _TD['DPS_NextSpell'] == nil then
+		TDDps_Frame.rotationEnabled = false;
+		TDDps_Print(_tdError, 'Specialization is not supported.');
+	end
 end

 TDDps_InitAddon();
\ No newline at end of file
diff --git a/TDDps.toc b/TDDps.toc
index cde4a70..f80b8e9 100644
--- a/TDDps.toc
+++ b/TDDps.toc
@@ -1,6 +1,6 @@
 ## Title: TDDps
 ## Notes: Rotation helper framework.
-## Version: 1.12
+## Version: 1.13
 ## Author: Kaminaris
 ## Interface: 60200
 ## SavedVariables: TDDps_Options
diff --git a/TDSettings.lua b/TDSettings.lua
index 23b1d94..667b788 100644
--- a/TDSettings.lua
+++ b/TDSettings.lua
@@ -10,6 +10,7 @@ TDDps_textures = {

 TDDps_Options = {
 	enabled = true,
+	disabledInfo = false,
 	disableButtonGlow = false,
 	onCombatEnter = true,
 	texture = '',
@@ -51,6 +52,16 @@ local options = {
 			end,
 			get = function(info) return TDDps_Options.enabled end
 		},
+		disabledInfo = {
+			name = 'Disable info messages',
+			desc = 'Enables / disables info messages, if you have issues with addon, make sure to deselect this.',
+			type = 'toggle',
+			width = 'full',
+			set = function(info, val)
+				TDDps_Options.disabledInfo = val;
+			end,
+			get = function(info) return TDDps_Options.disabledInfo end
+		},
 		disableButtonGlow = {
 			name = 'Dissable blizzard button glow (experimental)',
 			desc = 'Disables original blizzard button glow',