Quantcast

Chat internal data and fishing lures updated

failcoder [07-31-15 - 14:54]
Chat internal data and fishing lures updated
Filename
SVUI_Chat/SVUI_Chat.lua
SVUI_CraftOMatic/components/fishing.lua
diff --git a/SVUI_Chat/SVUI_Chat.lua b/SVUI_Chat/SVUI_Chat.lua
index 3887a20..97c48ae 100644
--- a/SVUI_Chat/SVUI_Chat.lua
+++ b/SVUI_Chat/SVUI_Chat.lua
@@ -132,7 +132,7 @@ local CHANNEL_STRINGS 		= {
 	[L["Trade"]] 			= L["S_Trade"],
 	[L["WorldDefense"]] 	= L["WorldDefense"],
 }
-
+local INTERNAL_TABLES = { 'channelList', 'zoneChannelList', 'messageTypeList' };
 local WHISPER_SOUND = [[Interface\AddOns\SVUI_!Core\assets\sounds\whisper.mp3]];

 local GENERAL_LINK_PATTERN = "[^%:]+";
@@ -1118,8 +1118,8 @@ local function OpenNewSVUIChatFrame(newname)
 end

 function MOD:ResetChatWindows()
-	wipe(MOD.private.activeTabs);
-
+	MOD:ResetInternalData();
+
 	for k,v in pairs(SV.Dock.private.Disabled) do
 		if k:find("ChatFrame") then
 			SV.Dock.private.Disabled[k] = nil
@@ -1533,14 +1533,14 @@ do
 		if ( not dock.isDirty and not forceUpdate ) then
 			return;
 		end
-
+
 		for index, chatFrame in ipairs(dock.DOCKED_CHAT_FRAMES) do
 			local chatTab = _G[chatFrame:GetName().."Tab"];
 			chatTab:Show();
 		end
-
+
 		dock.isDirty = false;
-
+
 		return FCFDock_ScrollToSelectedTab(dock);
 	end

@@ -1649,6 +1649,14 @@ local function DockFadeOutChat(location)
 	end
 end

+function MOD:ResetInternalData()
+	wipe(self.private.history);
+	wipe(self.private.activeTabs);
+	wipe(self.private.channelList);
+	wipe(self.private.zoneChannelList);
+	wipe(self.private.messageTypeList);
+end
+
 function MOD:ReLoad()
 	self:RefreshChatFrames('RELOAD', true)
 end
@@ -1656,10 +1664,10 @@ end
 function MOD:Load()
 	self.private.history = self.private.history or {};
 	self.private.activeTabs = self.private.activeTabs or {};
-	self.ChatHistory = self.private.history;
-
 	self.private.channelList = self.private.channelList or {};
 	self.private.zoneChannelList = self.private.zoneChannelList or {};
+	self.private.messageTypeList = self.private.messageTypeList or {};
+	self.ChatHistory = self.private.history;

 	local baseDock = SV.Dock.BottomLeft;

@@ -1682,37 +1690,22 @@ function MOD:Load()
 	self:UpdateLocals()

 	for i,name in pairs(CHAT_FRAMES) do
-		if(_G[name]) then
-			self.private.channelList[i] = self.private.channelList[i] or {};
-			self.private.zoneChannelList[i] = self.private.zoneChannelList[i] or {};
-			self.private.messageTypeList[i] = self.private.messageTypeList[i] or {};
-			-- self.private.channelList[i] = {};
-			-- self.private.zoneChannelList[i] = {};
-			-- self.private.messageTypeList[i] = {};
+		local chatFrame = _G[name];
+		if(chatFrame) then
 			SetChatWindowUninteractable(i, false)
-
-			if(_G[name].channelList) then
-				for x,y in pairs(_G[name].channelList) do
-					self.private.channelList[i][x] = y
-				end
-			end
-			_G[name].channelList = self.private.channelList[i];
-
-			if(_G[name].zoneChannelList) then
-				for x,y in pairs(_G[name].zoneChannelList) do
-					self.private.zoneChannelList[i][x] = y
-				end
-			end
-			_G[name].zoneChannelList = self.private.zoneChannelList[i];
-
-			if(_G[name].messageTypeList) then
-				for x,y in pairs(_G[name].messageTypeList) do
-					self.private.messageTypeList[i][x] = y
+			for _, internal in pairs(INTERNAL_TABLES) do
+				if(not self.private[internal][name]) then
+					if(chatFrame[internal]) then
+						for x,y in pairs(chatFrame[internal]) do
+							self.private[internal][name][x] = y
+						end
+					else
+						self.private[internal][name] = {};
+					end
 				end
+				chatFrame[internal] = self.private[internal][name];
 			end
-			_G[name].messageTypeList = self.private.messageTypeList[i];
-
-			_G[name].oldAlpha = 0;
+			chatFrame.oldAlpha = 0;
 			local key = format("SVUI_ChatFrameDock%d", i)
 			if((not self.private.activeTabs[key]) and (i < 4)) then
 				self.private.activeTabs[key] = true
diff --git a/SVUI_CraftOMatic/components/fishing.lua b/SVUI_CraftOMatic/components/fishing.lua
index 5b3c8c0..e34ee6d 100644
--- a/SVUI_CraftOMatic/components/fishing.lua
+++ b/SVUI_CraftOMatic/components/fishing.lua
@@ -96,6 +96,7 @@ local refHats = {
 	{ ["id"] = 118380, 	["weight"] = 100, ["nocast"] = false 	},  --Hightfish Cap 7Days WOD
 	{ ["id"] = 118393, 	["weight"] = 100, ["nocast"] = false 	},  --Tentacled Hat 7Days WOD
 	{ ["id"] = 88710, 	["weight"] = 100, ["nocast"] = false 	},  --Nats Hat
+	{ ["id"] = 117405, 	["weight"] = 100, ["nocast"] = false 	},  --Nats Drinking Hat
 }
 local refPoles = {
 	{ ["id"] = 118381, 	["weight"] = 50 }, --Ephemeral Fishing Pole 24hours WOD