:sparkles: Update 2.1

Edgar [05-31-19 - 18:37]
:sparkles: Update 2.1
Filename
ESOTheatreII.lua
ESOTheatreII.txt
ESOTheatreIISettings.lua
ReadMe.md
changelog.md
forms/ESOEmotesListGUI.lua
forms/ESOFavoritesGUI.lua
diff --git a/ESOTheatreII.lua b/ESOTheatreII.lua
index b6f0700..e6f82df 100644
--- a/ESOTheatreII.lua
+++ b/ESOTheatreII.lua
@@ -10,13 +10,13 @@ ETII.ETIIEmoteData integer description
 --]]--

 ESOTheatreII = {
-	Name = "ESOTheatreII",
-	Title = "ESO Theatre II",
-	Author = "Halja, II by AnotherFoxGuy",
-	Version = "2.0",
-	SV = "ESOTheatreIISavedVariables",
-	SVersion = "2.0",
-	CurrentSVars = {},
+  Name = "ESOTheatreII",
+  Title = "ESO Theatre II",
+  Author = "Halja, II by AnotherFoxGuy",
+  Version = "2.1.0",
+  SV = "ESOTheatreIISavedVariables",
+  SVersion = "2.1.0",
+  CurrentSVars = {},
 }

 local ETII = ESOTheatreII
@@ -24,22 +24,22 @@ ETII.ETIIEmoteData = {}

 ETII.ETIIEmoteCategory =
 {
-	[0] = "ceremonial",
-	[1] = "cheers and jeers",
-	[2] = "collected",
-	[3] = "deprecated",
-	[4] = "emotion",
-	[5] = "entertainment",
-	[6] = "food and drink",
-	[7] = "give directions",
-	[8] = "invalid",
-	[9] = "perpetual",
-	[10] = "personality override",
-	[11] = "physical",
-	[12] = "poses and fidgets",
-	[13] = "prop",
-	[14] = "social",
-	[15] = "all"
+  [0] = "ceremonial",
+  [1] = "cheers and jeers",
+  [2] = "collected",
+  [3] = "deprecated",
+  [4] = "emotion",
+  [5] = "entertainment",
+  [6] = "food and drink",
+  [7] = "give directions",
+  [8] = "invalid",
+  [9] = "perpetual",
+  [10] = "personality override",
+  [11] = "physical",
+  [12] = "poses and fidgets",
+  [13] = "prop",
+  [14] = "social",
+  [15] = "all"
 }

 local TransparentFlag = false
@@ -47,373 +47,374 @@ local LastKnownTarget = nil

 local verboseFlag = false
 local lastEmote = {
-	Name = "",
-	ID = 0,
+  Name = "",
+  ID = 0,
 }

 function ETII.GetEmoteData()
-	local edat
-	for i = 1, GetNumEmotes() do
-		edat = { GetEmoteInfo(i) }
-		ETII.ETIIEmoteData[i] = edat
-	end
+  local edat
+  for i = 1, GetNumEmotes() do
+    edat = { GetEmoteInfo(i) }
+    ETII.ETIIEmoteData[i] = edat
+  end
 end

 function ETII.GetLastEmote()
-	return lastEmote
+  return lastEmote
 end

 function ETII.SetLastEmote(name, id)
-	lastEmote.Name = name
-	lastEmote.ID = id
+  lastEmote.Name = name
+  lastEmote.ID = id
 end

 function ETII.GetLastKnownTarget()
-	return LasstKnownTarget
+  return LasstKnownTarget
 end

 function ETII.IsVerbose()
-	if (verboseFlag ~= nil) then
-		return verboseFlag
-	else
-		return false
-	end
+  if (verboseFlag ~= nil) then
+    return verboseFlag
+  else
+    return false
+  end
 end

 local function PlayerTargetOnChange()
-	local name = GetUnitName("reticleover")
-	local caption = GetUnitCaption("reticleover")
-	if DoesUnitExist('reticleover') then
-		--if IsUnitPlayer('reticleover') then
-		if (name ~= LastKnownTarget) then
-			LastKnownTarget = name
-			if ETII.IsVerbose() then
-				ETII.PrintSystemChat( "New Target: "..name )
-			end
-		end
-		--end
-	end
+  local name = GetUnitName("reticleover")
+  local caption = GetUnitCaption("reticleover")
+  if DoesUnitExist('reticleover') then
+    --if IsUnitPlayer('reticleover') then
+    if (name ~= LastKnownTarget) then
+      LastKnownTarget = name
+      if ETII.IsVerbose() then
+        ETII.PrintSystemChat( "New Target: "..name )
+      end
+    end
+    --end
+  end
 end

 function ETII.PrintSystemChat( text )
-	if (type(text) ~= string) then
-		text = tostring(text)
-	end
-	--d( text )
-	CHAT_SYSTEM:AddMessage(text)
+  if (type(text) ~= string) then
+    text = tostring(text)
+  end
+  --d( text )
+  CHAT_SYSTEM:AddMessage(text)
 end

 function ETII.EmptyTable( aTable )
-	for k, v in pairs (aTable) do
-		aTable[k] = nil
-	end
+  for k, v in pairs (aTable) do
+    aTable[k] = nil
+  end
 end

 function ETII.TableSize( aTable )
-	-- # shortcut for lua table count is not always working?
-	local count = 0
-	for k in pairs (aTable) do
-		count = count + 1
-	end
-	return count
+  -- # shortcut for lua table count is not always working?
+  local count = 0
+  for k in pairs (aTable) do
+    count = count + 1
+  end
+  return count
 end

 function ETII.IsString(obj)
-	return type(obj) == 'string'
+  return type(obj) == 'string'
 end

 function ETII.IsNumber(obj)
-	return type(obj) == 'number'
+  return type(obj) == 'number'
 end

 function ETII.GetTransparentFlag()
-	return TransparentFlag
+  return TransparentFlag
 end

 function ETII.SetTransparentFlag()
-	TransparentFlag = not TransparentFlag
-	if ETII.IsVerbose()then
-		ETII.PrintSystemChat(TransparentFlag)
-	end
-	local TransparencyLevel = tonumber(ETII.CurrentSVars.UserSettings.TransparencyLevel)
-
-	if (TransparencyLevel < 1) then TransparencyLevel = 1 end
-	if (TransparencyLevel > 100) then TransparencyLevel = 100 end
-	TransparencyLevel = (TransparencyLevel / 100)
-
-	local mainFrame = GetControl("TheatreFrame")
-	local configFrame = GetControl("PlaybillFrame")
-	if TransparentFlag then
-		mainFrame:SetAlpha(1)
-		configFrame:SetAlpha(1)
-	else
-		mainFrame:SetAlpha(TransparencyLevel)
-		configFrame:SetAlpha(TransparencyLevel)
-	end
+  TransparentFlag = not TransparentFlag
+  if ETII.IsVerbose()then
+    ETII.PrintSystemChat(TransparentFlag)
+  end
+  local TransparencyLevel = tonumber(ETII.CurrentSVars.UserSettings.TransparencyLevel)
+
+  if (TransparencyLevel < 1) then TransparencyLevel = 1 end
+  if (TransparencyLevel > 100) then TransparencyLevel = 100 end
+  TransparencyLevel = (TransparencyLevel / 100)
+
+  local mainFrame = GetControl("TheatreFrame")
+  local configFrame = GetControl("PlaybillFrame")
+  if TransparentFlag then
+    mainFrame:SetAlpha(1)
+    configFrame:SetAlpha(1)
+  else
+    mainFrame:SetAlpha(TransparencyLevel)
+    configFrame:SetAlpha(TransparencyLevel)
+  end
 end

 function ETII.EmoteIdByName(aname)
-	local id = -1
-	local tblemote = ETII.ETIIEmoteData
-
-	for k, v in pairs (tblemote) do
-		if (aname == v[4]) then
-			id = v[3]
-		end
-	end
-	return id
+  local id = -1
+  local tblemote = ETII.ETIIEmoteData
+
+  for k, v in pairs (tblemote) do
+    if (aname == v[4]) then
+      id = v[3]
+    end
+  end
+  return id
 end

 function ETII.CategoryIdByName(aname)
-	local id = 0
-	local tblCategory = ETII.ETIIEmoteCategory
-
-	for k in pairs (tblCategory) do
-		if (aname == tblCategory[k]) then
-			id = k
-		end
-	end
-	return id
+  local id = 0
+  local tblCategory = ETII.ETIIEmoteCategory
+
+  for k in pairs (tblCategory) do
+    if (aname == tblCategory[k]) then
+      id = k
+    end
+  end
+  return id
 end

 function ETII.EmoteNameByID(id)
-	local name = ""
-	local tblemote = ETII.ETIIEmoteData
-
-	for k, v in pairs (tblemote) do
-		if (id == v[3]) then
-			name = v[4]
-		end
-	end
-	return name
+  local name = ""
+  local tblemote = ETII.ETIIEmoteData
+
+  for k, v in pairs (tblemote) do
+    if (id == v[3]) then
+      name = v[4]
+    end
+  end
+  return name
 end

 function ETII.PlayEmoteByName(name)
-	local emoteid = ETII.EmoteIdByName(name)
-	if (emoteid > 0) then
-		PlayEmoteByIndex(GetEmoteIndex(emoteid))
-		if ETII.IsVerbose() then
-			ETII.PrintSystemChat( "Playing "..name.." By Name")
-		end
-		ETII.SetLastEmote(name, emoteid)
-	end
+  local emoteid = ETII.EmoteIdByName(name)
+  if (emoteid > 0) then
+    PlayEmoteByIndex(GetEmoteIndex(emoteid))
+    if ETII.IsVerbose() then
+      ETII.PrintSystemChat( "Playing "..name.." By Name")
+    end
+    ETII.SetLastEmote(name, emoteid)
+  end
 end

 function ETII.PlayEmoteByID(id)
-	PlayEmoteByIndex(GetEmoteIndex(id))
-	if ETII.IsVerbose() then
-		ETII.PrintSystemChat( "Playing "..ETII.EmoteNameByID(id) .." By ID")
-	end
-	ETII.SetLastEmote(eName, ID)
+  PlayEmoteByIndex(GetEmoteIndex(id))
+  if ETII.IsVerbose() then
+    ETII.PrintSystemChat( "Playing "..ETII.EmoteNameByID(id) .." By ID")
+  end
+  ETII.SetLastEmote(eName, ID)
 end

 local function ShouldHideAddon()
-	local CompassIsHidden = ZO_CompassFrame:IsHidden()
-	if (CompassIsHidden and IsReticleHidden() ) then
-		ESOTheatreII:Hide()
-		ESOEmotesListGUI:Hide()
-	else
-		--There is a variable in the class to check that it should really become visible.
-		ESOTheatreII:Show()
-	end
+  local CompassIsHidden = ZO_CompassFrame:IsHidden()
+  if (CompassIsHidden and IsReticleHidden() ) then
+    ESOTheatreII:Hide()
+    ESOEmotesListGUI:Hide()
+  else
+    --There is a variable in the class to check that it should really become visible.
+    ESOTheatreII:Show()
+  end
 end

 function ETII.ToggleAddon()
-	ETII.ESOFavoritesGUI:ToggleWindow()
+  ETII.ESOFavoritesGUI:ToggleWindow()
 end

 function ETII.ToggleEmotesWindow()
-	ETII.ESOEmotesListGUI:ToggleWindow()
+  ETII.ESOEmotesListGUI:ToggleWindow()
 end

 function ETII.QuickEmotes( btnNumber )
-	local emotename = ETII.ESOFavoritesGUI:GetFavoriteButtonEmote( btnNumber )
-	if (emotename ~= nul) then
-		ETII.PlayEmoteByName(emotename)
-	end
+  local emotename = ETII.ESOFavoritesGUI:GetFavoriteButtonEmote( btnNumber )
+  if (emotename ~= nul) then
+    ETII.PlayEmoteByName(emotename)
+  end
 end

 function ETII.RandomEmote()
-	local randomIndex = math.random(1, GetNumEmotes())
-	local randomEmote = { GetEmoteInfo(randomIndex) }
-	ETII.PrintSystemChat( "Playing "..randomEmote[4])
-	PlayEmoteByIndex(randomIndex)
+  local randomIndex = math.random(1, GetNumEmotes())
+  local randomEmote = { GetEmoteInfo(randomIndex) }
+  ETII.PrintSystemChat( "Playing "..randomEmote[4])
+  PlayEmoteByIndex(randomIndex)
 end

 local function ReloadRawTable()
-	ETII.CurrentSVars.RawTable = {}
+  ETII.CurrentSVars.RawTable = {}

-	for i = 1, GetNumEmotes() do
-		d(GetEmoteInfo(i))
-	end
+  for i = 1, GetNumEmotes() do
+    d(GetEmoteInfo(i))
+  end

-	ETII.CurrentSVars.RawTable = ETII.ETIIEmoteData
+  ETII.CurrentSVars.RawTable = ETII.ETIIEmoteData
 end

 local function ReloadAddOnDefaults()

-	local size = ETII.TableSize(ETII.FavoriteTable)
+  local size = ETII.TableSize(ETII.FavoriteTable)

-	if ( size > 0) then
-		if ETII.IsVerbose() then
-			ETII.PrintSystemChat("Starting reset...")
-		end
+  if ( size > 0) then
+    if ETII.IsVerbose() then
+      ETII.PrintSystemChat("Starting reset...")
+    end

-		ETII.EmptyTable( ETII.CurrentSVars.FavoriteTable )
-		ETII.EmptyTable( ETII.CurrentSVars.RawTable )
-		ETII.EmptyTable( ETII.CurrentSVars.UserSettings )
+    ETII.EmptyTable( ETII.CurrentSVars.FavoriteTable )
+    ETII.EmptyTable( ETII.CurrentSVars.RawTable )
+    ETII.EmptyTable( ETII.CurrentSVars.UserSettings )

-		ETII.CurrentSVars.UserSettings = ETII.UserSettings
-		ETII.CurrentSVars.FavoriteTable = ETII.FavoriteTable
-		ETII.CurrentSVars.RawTable = {}
+    ETII.CurrentSVars.UserSettings = ETII.UserSettings
+    ETII.CurrentSVars.FavoriteTable = ETII.FavoriteTable
+    ETII.CurrentSVars.RawTable = {}

-		ETII.ESOFavoritesGUI.ReLoadFavoriteButtons()
-		local x = ETII.CurrentSVars.UserSettings.StageLocation.Xoffset
-		local y = ETII.CurrentSVars.UserSettings.StageLocation.Yoffset
-		ETII.ESOFavoritesGUI:MoveWindow( x, y )
+    ETII.ESOFavoritesGUI.ReLoadFavoriteButtons()
+    local x = ETII.CurrentSVars.UserSettings.StageLocation.Xoffset
+    local y = ETII.CurrentSVars.UserSettings.StageLocation.Yoffset
+    ETII.ESOFavoritesGUI:MoveWindow( x, y )

-		x = ETII.CurrentSVars.UserSettings.PlaybillLocation.Xoffset
-		y = ETII.CurrentSVars.UserSettings.PlaybillLocation.Yoffset
-		ETII.ESOEmotesListGUI:MoveWindow( x, y )
+    x = ETII.CurrentSVars.UserSettings.PlaybillLocation.Xoffset
+    y = ETII.CurrentSVars.UserSettings.PlaybillLocation.Yoffset
+    ETII.ESOEmotesListGUI:MoveWindow( x, y )

-		if ETII.IsVerbose() then
-			ETII.PrintSystemChat("Reset Done")
-		end
-	end
+    if ETII.IsVerbose() then
+      ETII.PrintSystemChat("Reset Done")
+    end
+  end
 end

 local function OnAddSlashCommand( ... )

-	--only parsing the first argument
-	local arg1 = select(1, ...)
-	if ( arg1 ~= nil and arg1 ~= "") then
-		if ETII.IsVerbose() then
-			ETII.PrintSystemChat( arg1 )
-		end
-
-		if (arg1 == "-help" or arg1 == "-h"or arg1 == "-?") then
-			ETII.PrintSystemChat(ETII.Name.." Slash Commands")
-			ETII.PrintSystemChat("******************************************")
-			ETII.PrintSystemChat("/esotheatre : Display emote window")
-			ETII.PrintSystemChat("/et : Alias to display emote window")
-			ETII.PrintSystemChat("/et -< Options >")
-			ETII.PrintSystemChat("/et -help : This message")
-			-- ETII.PrintSystemChat("/et -enumsys : Pulls system emotes and copies to SavedVariables file")
-			ETII.PrintSystemChat("/et -reload : Reloads Add-on default to SavedVariables file")
-			ETII.PrintSystemChat("/et -repin : Reset main window position to top left corner")
-			ETII.PrintSystemChat("/et ####	Plays the games emote id")
-			ETII.PrintSystemChat("/et -f##	Plays the emote based on the favorite's button number i.e. /et -f9 plays the emote you assigned to button 9.")
-			ETII.PrintSystemChat("******************************************")
-		end
-
-		if arg1 == "-enumsys" then
-			ReloadRawTable()
-		end
-
-		if arg1 == "-reload" then
-			ReloadAddOnDefaults()
-		end
-
-		if arg1 == "-repin" then
-			ETII.ESOFavoritesGUI:MoveWindow( 30, 20 )
-			ETII.ESOEmotesListGUI:MoveWindow( 360, 20 )
-		end
-
-		if (string.sub(string.upper(arg1), 1, 2) == "-F") then
-			local btnNumber = string.sub(arg1, 3)
-			local emotename = ETII.ESOFavoritesGUI:GetFavoriteButtonEmote( btnNumber )
-			if (emotename ~= nul) then
-				--No error checking just tossing over the fence :P
-				ETII.PlayEmoteByName(emotename)
-			end
-		end
-
-		if arg1 == "-v" then
-			if ETII.IsVerbose() then
-				verboseFlag = false
-			else
-				verboseFlag = true
-			end
-		end
-
-
-		local emoteid = tonumber(arg1)
-		if (emoteid ~= nul and ETII.IsNumber(emoteid) == true) then
-			ETII.PlayEmoteByID(emoteid)
-		else
-			--No error checking just tossing over the fence :P
-			ETII.PlayEmoteByName(arg1)
-		end
-
-	else
-		ETII.ESOFavoritesGUI:OnSlashCommand()
-	end
+  --only parsing the first argument
+  local arg1 = select(1, ...)
+  if ( arg1 ~= nil and arg1 ~= "") then
+    if ETII.IsVerbose() then
+      ETII.PrintSystemChat( arg1 )
+    end
+
+    if (arg1 == "-help" or arg1 == "-h"or arg1 == "-?") then
+      ETII.PrintSystemChat(ETII.Name.." Slash Commands")
+      ETII.PrintSystemChat("******************************************")
+      ETII.PrintSystemChat("/esotheatre : Display emote window")
+      ETII.PrintSystemChat("/et : Alias to display emote window")
+      ETII.PrintSystemChat("/et -< Options >")
+      ETII.PrintSystemChat("/et -help : This message")
+      -- ETII.PrintSystemChat("/et -enumsys : Pulls system emotes and copies to SavedVariables file")
+      ETII.PrintSystemChat("/et -reload : Reloads Add-on default to SavedVariables file")
+      ETII.PrintSystemChat("/et -repin : Reset main window position to top left corner")
+      ETII.PrintSystemChat("/et ####	Plays the games emote id")
+      ETII.PrintSystemChat("/et -f##	Plays the emote based on the favorite's button number i.e. /et -f9 plays the emote you assigned to button 9.")
+      ETII.PrintSystemChat("******************************************")
+    end
+
+    if arg1 == "-enumsys" then
+      ReloadRawTable()
+    end
+
+    if arg1 == "-reload" then
+      ReloadAddOnDefaults()
+    end
+
+    if arg1 == "-repin" then
+      ETII.ESOFavoritesGUI:MoveWindow( 30, 20 )
+      ETII.ESOEmotesListGUI:MoveWindow( 360, 20 )
+    end
+
+    if (string.sub(string.upper(arg1), 1, 2) == "-F") then
+      local btnNumber = string.sub(arg1, 3)
+      local emotename = ETII.ESOFavoritesGUI:GetFavoriteButtonEmote( btnNumber )
+      if (emotename ~= nul) then
+        --No error checking just tossing over the fence :P
+        ETII.PlayEmoteByName(emotename)
+      end
+    end
+
+    if arg1 == "-v" then
+      if ETII.IsVerbose() then
+        verboseFlag = false
+      else
+        verboseFlag = true
+      end
+    end
+
+
+    local emoteid = tonumber(arg1)
+    if (emoteid ~= nul and ETII.IsNumber(emoteid) == true) then
+      ETII.PlayEmoteByID(emoteid)
+    else
+      --No error checking just tossing over the fence :P
+      ETII.PlayEmoteByName(arg1)
+    end
+
+  else
+    ETII.ESOFavoritesGUI:OnSlashCommand()
+  end

 end

 function ETII.AddonInitialized( self )

-	ETII.ESOFavoritesGUI:Initialize()
-	ETII.ESOFavoritesGUI:Hide()
+  ETII.ESOFavoritesGUI:Initialize()
+  ETII.ESOFavoritesGUI:Hide()

-	ETII.ESOEmotesListGUI:Initialize()
-	local control = GetControl("PlaybillFrame")
-	control:SetHidden( true )
+  ETII.ESOEmotesListGUI:Initialize()
+  local control = GetControl("PlaybillFrame")
+  control:SetHidden( true )

 end

 local function OnAddOnLoaded(eventCode, addOnName)
-	if (addOnName == ETII.Name) then
-
-	 	ETII.GetEmoteData()
-
-		local defaultSV = {
-			["FavoriteTable"] =
-			{
-			},
-			["RawTable"] =
-			{
-			},
-			["UserSettings"] =
-			{
-			},
-		}
-
-		defaultSV.UserSettings = ETII.UserSettings
-		defaultSV.FavoriteTable = ETII.FavoriteTable
-
-		--initialize saved variables
-		--if ( EmotesAccountWide == 1 ) then
-		ETII.CurrentSVars = ZO_SavedVars:NewAccountWide(ETII.SV, ETII.SVersion, "Session", defaultSV)
-		--else
-			--ETII.CurrentSVars = ZO_SavedVars:New(ETII.SV, ETII.SVersion, "Session", defaultSV)
-		--end
-
-		--Initialize Slash commands
-		SLASH_COMMANDS["/esotheatre"] = function( ... ) OnAddSlashCommand( ... ) end
-		SLASH_COMMANDS["/et"] = function( ... ) OnAddSlashCommand( ... ) end
-
-		ETII.ESOFavoritesGUI:LoadFavoriteButtons()
-		local x = ETII.CurrentSVars.UserSettings.StageLocation.Xoffset
-		local y = ETII.CurrentSVars.UserSettings.StageLocation.Yoffset
-		ETII.ESOFavoritesGUI:MoveWindow( x, y )
-
-		x = ETII.CurrentSVars.UserSettings.PlaybillLocation.Xoffset
-		y = ETII.CurrentSVars.UserSettings.PlaybillLocation.Yoffset
-		ETII.ESOEmotesListGUI:MoveWindow( x, y )
-		ETII.ESOEmotesListGUI:LoadCategoryFilters()
-
-	end
+  if (addOnName == ETII.Name) then
+
+    ETII.GetEmoteData()
+
+    local defaultSV = {
+      ["FavoriteTable"] =
+      {
+      },
+      ["RawTable"] =
+      {
+      },
+      ["UserSettings"] =
+      {
+      },
+    }
+
+    defaultSV.UserSettings = ETII.UserSettings
+    defaultSV.FavoriteTable = ETII.FavoriteTable
+
+    --initialize saved variables
+    --if ( EmotesAccountWide == 1 ) then
+    ETII.CurrentSVars = ZO_SavedVars:NewAccountWide(ETII.SV, ETII.SVersion, "Session", defaultSV)
+    --else
+    --ETII.CurrentSVars = ZO_SavedVars:New(ETII.SV, ETII.SVersion, "Session", defaultSV)
+    --end
+
+    --Initialize Slash commands
+    SLASH_COMMANDS["/esotheatre"] = function( ... ) OnAddSlashCommand( ... ) end
+    SLASH_COMMANDS["/et"] = function( ... ) OnAddSlashCommand( ... ) end
+
+    ETII.ESOFavoritesGUI:LoadFavoriteButtons()
+    local x = ETII.CurrentSVars.UserSettings.StageLocation.Xoffset
+    local y = ETII.CurrentSVars.UserSettings.StageLocation.Yoffset
+    ETII.ESOFavoritesGUI:MoveWindow( x, y )
+
+    x = ETII.CurrentSVars.UserSettings.PlaybillLocation.Xoffset
+    y = ETII.CurrentSVars.UserSettings.PlaybillLocation.Yoffset
+    ETII.ESOEmotesListGUI:MoveWindow( x, y )
+
+    ETII.ESOEmotesListGUI:LoadCategoryFilters()
+    ETII.ESOEmotesListGUI:FillScrollList()
+  end
 end

 function ETII.TestFoo()
-	---A Placeholder for trying stuff
+  ---A Placeholder for trying stuff

-	ETII.ESOEmotesListGUI:FillScrollList()
+  ETII.ESOEmotesListGUI:FillScrollList()

-	if ETII.IsVerbose() then
-		ETII.PrintSystemChat( "Done :D" )
-	end
+  if ETII.IsVerbose() then
+    ETII.PrintSystemChat( "Done :D" )
+  end
 end


@@ -436,75 +437,75 @@ ZO_CreateStringId("SI_BINDING_NAME_RANDOM_EMOTE", "Play Random Emote")


 ETII.FavoriteTable = {
-	[1] =
-	{
-		["EmoteName"] = "Hello",
-		["ID"] = 137,
-	},
-	[2] =
-	{
-		["EmoteName"] = "Congratulate",
-		["ID"] = 143,
-	},
-	[3] =
-	{
-		["EmoteName"] = "Sit chair",
-		["ID"] = 100,
-	},
-	[4] =
-	{
-		["EmoteName"] = "Eat apple",
-		["ID"] = 178,
-	},
-	[5] =
-	{
-		["EmoteName"] = "Drinking from flagon",
-		["ID"] = 8,
-	},
-	[6] =
-	{
-		["EmoteName"] = "Play dead",
-		["ID"] = 115,
-	},
-	[7] =
-	{
-		["EmoteName"] = "Dust off",
-		["ID"] = 80,
-	},
-	[8] =
-	{
-		["EmoteName"] = "Dance",
-		["ID"] = 72,
-	},
-	[9] =
-	{
-		["EmoteName"] = "Dance drunk",
-		["ID"] = 79,
-	},
-	[10] =
-	{
-		["EmoteName"] = "Play lute",
-		["ID"] = 5,
-	},
+  [1] =
+  {
+    ["EmoteName"] = "Hello",
+    ["ID"] = 137,
+  },
+  [2] =
+  {
+    ["EmoteName"] = "Congratulate",
+    ["ID"] = 143,
+  },
+  [3] =
+  {
+    ["EmoteName"] = "Sit chair",
+    ["ID"] = 100,
+  },
+  [4] =
+  {
+    ["EmoteName"] = "Eat apple",
+    ["ID"] = 178,
+  },
+  [5] =
+  {
+    ["EmoteName"] = "Drinking from flagon",
+    ["ID"] = 8,
+  },
+  [6] =
+  {
+    ["EmoteName"] = "Play dead",
+    ["ID"] = 115,
+  },
+  [7] =
+  {
+    ["EmoteName"] = "Dust off",
+    ["ID"] = 80,
+  },
+  [8] =
+  {
+    ["EmoteName"] = "Dance",
+    ["ID"] = 72,
+  },
+  [9] =
+  {
+    ["EmoteName"] = "Dance drunk",
+    ["ID"] = 79,
+  },
+  [10] =
+  {
+    ["EmoteName"] = "Play lute",
+    ["ID"] = 5,
+  },
 }

 ESOTheatreII.TweaksUI = {
-	["MainWindow"] =
-	{
-		["WindowWidth"] = 305,
-		["WindowHeight"] = 215,
-		["ButtonBaseOffsetX"] = 2,
-		["ButtonBaseOffsetY"] = 1,
-		["ButtonRelativeOffsetX"] = 140,
-		["ButtonRelativeOffsetY"] = 35,
-		["ButtonSize"] = 150,
-	},
-	["EmoteConfigWindow"] =
-	{
-		["WindowMinWidth"] = 150,
-		["WindowMinHeight"] = 750,
-		["ButtonSize"] = 150,
-		["WindowMaxWidth"] = 265,
-		["WindowMaxHeight"] = 750,
-	},
+  ["MainWindow"] =
+  {
+    ["WindowWidth"] = 305,
+    ["WindowHeight"] = 215,
+    ["ButtonBaseOffsetX"] = 2,
+    ["ButtonBaseOffsetY"] = 1,
+    ["ButtonRelativeOffsetX"] = 140,
+    ["ButtonRelativeOffsetY"] = 35,
+    ["ButtonSize"] = 150,
+  },
+  ["EmoteConfigWindow"] =
+  {
+    ["WindowMinWidth"] = 250,
+    ["WindowMinHeight"] = 750,
+    ["ButtonSize"] = 250,
+    ["WindowMaxWidth"] = 265,
+    ["WindowMaxHeight"] = 750,
+  },
 }
diff --git a/ESOTheatreII.txt b/ESOTheatreII.txt
index 5becd22..776c4dc 100644
--- a/ESOTheatreII.txt
+++ b/ESOTheatreII.txt
@@ -1,7 +1,7 @@
 ## Title: ESO Theatre II
 ## Author: Halja, II by AnotherFoxGuy
-## Version: 2.0
-## APIVersion: 100021
+## Version: 2.1.0
+## APIVersion: 100027
 ## SavedVariables: ESOTheatreIISavedVariables
 ##
 ## This Add-on is not created by, affiliated with or sponsored by ZeniMax Media Inc. or its affiliates.
diff --git a/ESOTheatreIISettings.lua b/ESOTheatreIISettings.lua
index 224d18d..bddb285 100644
--- a/ESOTheatreIISettings.lua
+++ b/ESOTheatreIISettings.lua
@@ -6,18 +6,18 @@ TransparencyLevel = 1 to 100

 Below loaded to savedvars file
 --]]--
-ESOTheatreII.UserSettings =
+ESOTheatreII.UserSettings =
 {
-	["StageLocation"] =
-	{
-		["Xoffset"] = 30,
-		["Yoffset"] = 20,
-	},
-	["PlaybillLocation"] =
-	{
-		["Xoffset"] = 360,
-		["Yoffset"] = 20,
-	},
-	["TransparencyLevel"] = 25,
-	["ChannelPush"] = 0,
-}
\ No newline at end of file
+  ["StageLocation"] =
+  {
+    ["Xoffset"] = 30,
+    ["Yoffset"] = 20,
+  },
+  ["PlaybillLocation"] =
+  {
+    ["Xoffset"] = 360,
+    ["Yoffset"] = 20,
+  },
+  ["TransparencyLevel"] = 25,
+  ["ChannelPush"] = 0,
+}
diff --git a/ReadMe.md b/ReadMe.md
index 0e6f256..a1c56db 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -9,10 +9,6 @@ This is a new version of the addon because the original hasn't been updated sinc
 * Fixed ```attempt to index a nil value``` bug
 * Repositioned and updated the favourite edit buttons

-### Known bugs
-* Favourites button is too small to display some emotes names
-* Emotes list window doesn't show the list correctly after startup (Scrolling or selecting a different category fixes it)
-* Some categories are empty

 Original Readme from ESO Theatre
 --------------------
diff --git a/changelog.md b/changelog.md
index a48efef..3d48374 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,10 @@
+Version 2.0.1 -- 31/05/2019
+  Updated to API release 100027
+  Fixed emotes list window doesn't show the list correctly after startup
+
 Version 1.0
   Updated to API release 100021

-
 Version 0.4.8 -- 10/22/2016
 	Updated to API release 100017 (Patch 2.6.4)
 	/letterlookup and /bdcake were removed
diff --git a/forms/ESOEmotesListGUI.lua b/forms/ESOEmotesListGUI.lua
index e87df5d..3546f75 100644
--- a/forms/ESOEmotesListGUI.lua
+++ b/forms/ESOEmotesListGUI.lua
@@ -3,201 +3,207 @@ local IsConfigurationMode = false
 local ETII = ESOTheatreII
 local IsDataLoaded = false

-function ETII.SetEmoteListItem(control,data)
-	control:SetWidth(ETII.TweaksUI.EmoteConfigWindow.ButtonSize)
-	local listitemtext = control:GetNamedChild( "Name" )
-	listitemtext:SetText( data.EmoteName )
-	listitemtext:SetColor(0.77,0.76,0.62,1)
-	listitemtext:SetWidth(ETII.TweaksUI.EmoteConfigWindow.ButtonSize - 10)
+function ETII.SetEmoteListItem(control, data)
+  control:SetWidth(ETII.TweaksUI.EmoteConfigWindow.ButtonSize)
+  local listitemtext = control:GetNamedChild( "Name" )
+  listitemtext:SetText( data.EmoteName )
+  listitemtext:SetColor(0.77, 0.76, 0.62, 1)
+  listitemtext:SetWidth(ETII.TweaksUI.EmoteConfigWindow.ButtonSize - 10)
 end

 function ETII.ESOEmotesListGUI:FillScrollList()
-	IsDataLoaded = true
-	local control = GetControl("PlaybillFrameList")
-	ZO_ScrollList_Clear(control)
+  local control = GetControl("PlaybillFrameList")
+  ZO_ScrollList_Clear(control)

-	local tblCategory = ETII.ETIIEmoteCategory
-	for k  in pairs (tblCategory) do
-		--ZO_ScrollList_AddCategory(control, tblCategory[k])
-		ZO_ScrollList_AddCategory(control, k)
-	end
+  local tblCategory = ETII.ETIIEmoteCategory
+  for k in pairs (tblCategory) do
+    --ZO_ScrollList_AddCategory(control, tblCategory[k])
+    ZO_ScrollList_AddCategory(control, k)
+  end

   local datalist = ZO_ScrollList_GetDataList(control)
-	local tblemote = ETII.ETIIEmoteData
-	local listsize = ETII.TableSize( tblemote )
-	for i = 1, listsize do
-		datalist[i] = ZO_ScrollList_CreateDataEntry( 1, { EmoteName = tblemote[i][4], ID = tblemote[i][3], }, tblemote[i][2])
-	end
-	ZO_ScrollList_Commit(control, datalist)
-	--control:RefreshData()
+  local tblemote = ETII.ETIIEmoteData
+  local listsize = ETII.TableSize( tblemote )
+  for i = 1, listsize do
+    datalist[i] = ZO_ScrollList_CreateDataEntry( 1, { EmoteName = tblemote[i][4], ID = tblemote[i][3], }, tblemote[i][2])
+  end
+  ZO_ScrollList_Commit(control, datalist)
 end


 function ETII.ESOEmotesListGUI:Initialize()
-	local control = GetControl("PlaybillFrameList")
-	control:SetHeight(300)
-	control:SetWidth(125)
-	ZO_ScrollList_AddDataType(control, 1 , "PlaybillListItemTemplate", 20,  ETII.SetEmoteListItem)
-	-- ETII.ESOEmotesListGUI:FillScrollList()
+  local control = GetControl("PlaybillFrameList")
+  control:SetHeight(300)
+  control:SetWidth(125)
+  ZO_ScrollList_AddDataType(control, 1, "PlaybillListItemTemplate", 20, ETII.SetEmoteListItem)
 end

 function ETII.ESOEmotesListGUI:ToggleWindow()
-	local control = GetControl("PlaybillFrame")
-    if ( control:IsHidden() ) then
-		ETII.ESOEmotesListGUI:Show()
-	else
-		control:SetHidden( true )
-    end
+  local control = GetControl("PlaybillFrame")
+  if ( control:IsHidden() ) then
+    ETII.ESOEmotesListGUI:Show()
+  else
+    control:SetHidden( true )
+  end
 end

 function ETII.ESOEmotesListGUI:PlaybillFrameOnSave()
-	local lastEmote = ETII.GetLastEmote()
-	if (lastEmote.ID > 0) then
-		local control = GetControl("PlaybillFrame")
-		local statuspaneltxt = control:GetNamedChild("StatusLabel")
-		local btntochange = statuspaneltxt:GetText()
-		if ETII.IsVerbose() then
-			ETII.PrintSystemChat( string.format("Going to change %s to emote id %d ( %s )" , btntochange, lastEmote.ID, lastEmote.Name))
-		end
-		ETII.ESOFavoritesGUI:FavoriteButtonOnChange(btntochange, lastEmote.ID)
-	end
-	ETII.ESOEmotesListGUI:Hide()
+  local lastEmote = ETII.GetLastEmote()
+  if (lastEmote.ID > 0) then
+    local control = GetControl("PlaybillFrame")
+    local statuspaneltxt = control:GetNamedChild("StatusLabel")
+    local btntochange = statuspaneltxt:GetText()
+    if ETII.IsVerbose() then
+      ETII.PrintSystemChat( string.format("Going to change %s to emote id %d ( %s )", btntochange, lastEmote.ID, lastEmote.Name))
+    end
+    ETII.ESOFavoritesGUI:FavoriteButtonOnChange(btntochange, lastEmote.ID)
+  end
+  ETII.ESOEmotesListGUI:Hide()
 end


 function ETII.ESOEmotesListGUI:Show(aname)
-	if not IsDataLoaded then
-		 ETII.ESOEmotesListGUI:FillScrollList()
-	end
-
-	local width
-	local height
-	local control = GetControl("PlaybillFrame")
-	if (control:IsHidden()) then
-		ETII.SetLastEmote("",0)
-		control:SetHidden( false )
-		local emotelabel = GetControl("PlaybillFrameBottomPanelStatusEmote")
-		emotelabel:SetText("")
-
-		local WindowTitle =GetControl("PlaybillFrameHeaderPanelTitle")
-		local btnSave = control:GetNamedChild("ButtonSave")
-		local btnCancel = control:GetNamedChild("ButtonCancel")
-
-		local tblemote = ETII.ETIIEmoteData
-
-		--btnSave:SetText(ETII.AddOnStrings.EN_SAVE)
-		--btnCancel:SetText(ETII.AddOnStrings.EN_CANCEL)
-
-		if (aname ~= nil) then
-			IsConfigurationMode = true
-			width = ETII.TweaksUI.EmoteConfigWindow.WindowMaxWidth
-			height = ETII.TweaksUI.EmoteConfigWindow.WindowMaxHeight
-			ETII.ESOFavoritesGUI:MinimizeWindowToggle()
-			local statuspaneltxt = control:GetNamedChild("StatusLabel")
-			statuspaneltxt:SetText(string.sub(aname,13))
-			if ETII.IsVerbose() then
-				statuspaneltxt:SetHidden( false )
-			else
-				statuspaneltxt:SetHidden( true )
-			end
-			local apanel =  control:GetNamedChild("List")
-			apanel:SetHeight( height - 120 )
-			apanel:SetWidth( ETII.TweaksUI.EmoteConfigWindow.ButtonSize )
-
-			local apanel =  control:GetNamedChild("BottomPanel")
-			apanel:SetWidth( width - 5 )
-			apanel:SetHeight( 45 )
-			local child =  apanel:GetNamedChild("StatusEmote")
-			child:ClearAnchors()
-			child:SetAnchor( CENTER, apanel, TOP, 0, 2)
-			btnSave:SetHidden( false )
-			btnCancel:SetHidden( false )
-		else
-			IsConfigurationMode = false
-			width = ETII.TweaksUI.EmoteConfigWindow.WindowMinWidth
-			height = ETII.TweaksUI.EmoteConfigWindow.WindowMinHeight
-			local apanel =  control:GetNamedChild("List")
-			apanel:SetHeight( height - 110 )
-			apanel:SetWidth( ETII.TweaksUI.EmoteConfigWindow.ButtonSize )
-
-			local apanel =  control:GetNamedChild("BottomPanel")
-			apanel:SetWidth( width - 5 )
-			apanel:SetHeight( 35 )
-			local child =  apanel:GetNamedChild("StatusEmote")
-			child:ClearAnchors()
-			child:SetAnchor( CENTER, apanel, CENTER, nil, nil)
-			btnSave:SetHidden( true )
-			btnCancel:SetHidden( true )
-		end
-		control:SetWidth(width)
-		control:SetHeight(height)
-		local apanel =  control:GetNamedChild("HeaderPanel")
-		apanel:SetWidth( width - 5 )
-		local apanel =  control:GetNamedChild("CenterPanel")
-		apanel:SetWidth( width - 5 )
-		apanel:SetHeight( height- 5 )
-
-	else
-		if (aname ~= nil) then
-			ETII.ESOEmotesListGUI:Hide()
-			ETII.ESOEmotesListGUI:Show(aname)
-		end
-	end
+
+  local width
+  local height
+  local control = GetControl("PlaybillFrame")
+
+  if (control:IsHidden()) then
+    ETII.SetLastEmote("", 0)
+    control:SetHidden( false )
+    local emotelabel = GetControl("PlaybillFrameBottomPanelStatusEmote")
+    emotelabel:SetText("")
+
+    local WindowTitle = GetControl("PlaybillFrameHeaderPanelTitle")
+    local btnSave = control:GetNamedChild("ButtonSave")
+    local btnCancel = control:GetNamedChild("ButtonCancel")
+
+    local tblemote = ETII.ETIIEmoteData
+
+    --btnSave:SetText(ETII.AddOnStrings.EN_SAVE)
+    --btnCancel:SetText(ETII.AddOnStrings.EN_CANCEL)
+
+    if (aname ~= nil) then
+      IsConfigurationMode = true
+      width = ETII.TweaksUI.EmoteConfigWindow.WindowMaxWidth
+      height = ETII.TweaksUI.EmoteConfigWindow.WindowMaxHeight
+      ETII.ESOFavoritesGUI:MinimizeWindowToggle()
+      local statuspaneltxt = control:GetNamedChild("StatusLabel")
+      statuspaneltxt:SetText(string.sub(aname, 13))
+      if ETII.IsVerbose() then
+        statuspaneltxt:SetHidden( false )
+      else
+        statuspaneltxt:SetHidden( true )
+      end
+      local apanel = control:GetNamedChild("List")
+      apanel:SetHeight( height - 120 )
+      apanel:SetWidth( ETII.TweaksUI.EmoteConfigWindow.ButtonSize )
+
+      local apanel = control:GetNamedChild("BottomPanel")
+      apanel:SetWidth( width - 5 )
+      apanel:SetHeight( 45 )
+      local child = apanel:GetNamedChild("StatusEmote")
+      child:ClearAnchors()
+      child:SetAnchor( CENTER, apanel, TOP, 0, 2)
+      btnSave:SetHidden( false )
+      btnCancel:SetHidden( false )
+    else
+      IsConfigurationMode = false
+      width = ETII.TweaksUI.EmoteConfigWindow.WindowMinWidth
+      height = ETII.TweaksUI.EmoteConfigWindow.WindowMinHeight
+      local apanel = control:GetNamedChild("List")
+      apanel:SetHeight( height - 110 )
+      apanel:SetWidth( ETII.TweaksUI.EmoteConfigWindow.ButtonSize )
+
+      local apanel = control:GetNamedChild("BottomPanel")
+      apanel:SetWidth( width - 5 )
+      apanel:SetHeight( 35 )
+      local child = apanel:GetNamedChild("StatusEmote")
+      child:ClearAnchors()
+      child:SetAnchor( CENTER, apanel, CENTER, nil, nil)
+      btnSave:SetHidden( true )
+      btnCancel:SetHidden( true )
+    end
+    control:SetWidth(width)
+    control:SetHeight(height)
+    local apanel = control:GetNamedChild("HeaderPanel")
+    apanel:SetWidth( width - 5 )
+    local apanel = control:GetNamedChild("CenterPanel")
+    apanel:SetWidth( width - 5 )
+    apanel:SetHeight( height - 5 )
+
+  else
+    if (aname ~= nil) then
+      ETII.ESOEmotesListGUI:Hide()
+      ETII.ESOEmotesListGUI:Show(aname)
+    end
+  end
+
+  if not IsDataLoaded then
+    IsDataLoaded = true
+    local control = GetControl("PlaybillFrameList")
+    ZO_ScrollList_HideAllCategories(control)
+    for k in ipairs (ETII.ETIIEmoteCategory) do
+      --d(k)
+      ZO_ScrollList_ShowCategory(control, k)
+    end
+  end
+
 end

 function ETII.ESOEmotesListGUI:Hide()
-	local control = GetControl("PlaybillFrame")
-	control:SetHidden( true )
-	if (IsConfigurationMode == true) then
-		ETII.ESOFavoritesGUI:MinimizeWindowToggle()
-	end
+  local control = GetControl("PlaybillFrame")
+  control:SetHidden( true )
+  if (IsConfigurationMode == true) then
+    ETII.ESOFavoritesGUI:MinimizeWindowToggle()
+  end
 end

 function ETII.ESOEmotesListGUI:MoveWindow( x, y )
-		local mainframe = GetControl("PlaybillFrame")
-		mainframe:ClearAnchors()
-		mainframe:SetAnchor( TOPLEFT, GetControl("GuiRoot"), TOPLEFT, x, y)
+  local mainframe = GetControl("PlaybillFrame")
+  mainframe:ClearAnchors()
+  mainframe:SetAnchor( TOPLEFT, GetControl("GuiRoot"), TOPLEFT, x, y)
 end

 function ETII.ESOEmotesListGUI:SaveWindowPosition()
-	local mainframe = GetControl("PlaybillFrame")
-	local x =mainframe:GetLeft()
-	local y = mainframe:GetTop()
-	if ETII.IsVerbose() then
-		ETII.PrintSystemChat( string.format("Top and Left inside GuiRoot= %d : %d",x ,y ))
-	end
-	ETII.CurrentSVars.UserSettings.PlaybillLocation.Xoffset = x
-	ETII.CurrentSVars.UserSettings.PlaybillLocation.Yoffset = y
+  local mainframe = GetControl("PlaybillFrame")
+  local x = mainframe:GetLeft()
+  local y = mainframe:GetTop()
+  if ETII.IsVerbose() then
+    ETII.PrintSystemChat( string.format("Top and Left inside GuiRoot= %d : %d", x, y ))
+  end
+  ETII.CurrentSVars.UserSettings.PlaybillLocation.Xoffset = x
+  ETII.CurrentSVars.UserSettings.PlaybillLocation.Yoffset = y
 end

 function ETII.ESOEmotesListGUI:LoadCategoryFilters()
-	local comboBox = ZO_ComboBox_ObjectFromContainer(PlaybillFrameComboBox01)
-	comboBox:SetSortsItems(false)
-	comboBox:SetSpacing(4)
-
-	local function OnFilterChanged(comboBox, entryText, entry)
-		if ETII.IsVerbose() then
-			ETII.PrintSystemChat( string.format("%s", entryText ))
-		end
-		local emotecatid = ETII.CategoryIdByName(entryText)
-		local control = GetControl("PlaybillFrameList")
-		ZO_ScrollList_HideAllCategories(control)
-		if (emotecatid < 15) then
-			ZO_ScrollList_ShowCategory(control, emotecatid)
-		else
-			for k in ipairs (ETII.ETIIEmoteCategory) do
-				--d(k)
-				ZO_ScrollList_ShowCategory(control, k)
-			end
-		end
-	end
-
-	local tblCategory = ETII.ETIIEmoteCategory
-
-	for k  in ipairs (tblCategory) do
-		local entry = comboBox:CreateItemEntry(tblCategory[k], OnFilterChanged)
-		comboBox:AddItem(entry)
-	end
-
-	comboBox:SetSelectedItem("all")
+  local comboBox = ZO_ComboBox_ObjectFromContainer(PlaybillFrameComboBox01)
+  comboBox:SetSortsItems(false)
+  comboBox:SetSpacing(4)
+
+  local function OnFilterChanged(comboBox, entryText, entry)
+    if ETII.IsVerbose() then
+      ETII.PrintSystemChat( string.format("%s", entryText ))
+    end
+    local emotecatid = ETII.CategoryIdByName(entryText)
+    local control = GetControl("PlaybillFrameList")
+    ZO_ScrollList_HideAllCategories(control)
+    if (emotecatid < 15) then
+      ZO_ScrollList_ShowCategory(control, emotecatid)
+    else
+      for k in ipairs (ETII.ETIIEmoteCategory) do
+        --d(k)
+        ZO_ScrollList_ShowCategory(control, k)
+      end
+    end
+  end
+
+  local tblCategory = ETII.ETIIEmoteCategory
+
+  for k in ipairs (tblCategory) do
+    local entry = comboBox:CreateItemEntry(tblCategory[k], OnFilterChanged)
+    comboBox:AddItem(entry)
+  end
+
+  comboBox:SetSelectedItem("all")
 end
diff --git a/forms/ESOFavoritesGUI.lua b/forms/ESOFavoritesGUI.lua
index e1d118a..ffc0b3b 100644
--- a/forms/ESOFavoritesGUI.lua
+++ b/forms/ESOFavoritesGUI.lua
@@ -13,219 +13,219 @@ local maxButtons = 10
 local StageIsActive = false

 function ETII.ESOFavoritesGUI:Initialize()
-	local control = GetControl("TheatreFrame")
-	local quickbtns = CreateControlFromVirtual("TheatreFrameButtonGroup", control, "ButtonPanelTemplate",1)
-	quickbtns:ClearAnchors()
-	quickbtns:SetAnchor(CENTER, control , TOP, 0, 10)
-	quickbtns:SetHidden( true )
-
-	local BtnClose = control:GetNamedChild( "ButtonClose" )
-	BtnClose:SetHandler( 'OnClicked', function() self:Hide() StageIsActive = false end )
-	local BtnMinimize = control:GetNamedChild( "ButtonMinimize" )
-	BtnMinimize:SetHandler( 'OnClicked', function() ESOTheatreII.ESOFavoritesGUI:MinimizeWindowToggle() end )
-
-	local BtnTest = control:GetNamedChild( "ButtonTesting" )
-	BtnTest:SetHidden(true)
-
-	local checkboxcontrol = GetControl("TheatreFrameCheckbox")
-	checkboxcontrol.checkedText = "Off"
-	checkboxcontrol.uncheckedText = "On"
-	checkboxcontrol:SetText("Off")
-	--checkboxcontrol:SetState(BSTATE_NORMAL, true)
-	ZO_PreHookHandler(checkboxcontrol, "OnClicked", function() ESOTheatreII.SetTransparentFlag(not ESOTheatreII.GetTransparentFlag()) end )
+  local control = GetControl("TheatreFrame")
+  local quickbtns = CreateControlFromVirtual("TheatreFrameButtonGroup", control, "ButtonPanelTemplate", 1)
+  quickbtns:ClearAnchors()
+  quickbtns:SetAnchor(CENTER, control, TOP, 0, 10)
+  quickbtns:SetHidden( true )
+
+  local BtnClose = control:GetNamedChild( "ButtonClose" )
+  BtnClose:SetHandler( 'OnClicked', function() self:Hide() StageIsActive = false end )
+  local BtnMinimize = control:GetNamedChild( "ButtonMinimize" )
+  BtnMinimize:SetHandler( 'OnClicked', function() ESOTheatreII.ESOFavoritesGUI:MinimizeWindowToggle() end )
+
+  local BtnTest = control:GetNamedChild( "ButtonTesting" )
+  BtnTest:SetHidden(true)
+
+  local checkboxcontrol = GetControl("TheatreFrameCheckbox")
+  checkboxcontrol.checkedText = "Off"
+  checkboxcontrol.uncheckedText = "On"
+  checkboxcontrol:SetText("Off")
+  --checkboxcontrol:SetState(BSTATE_NORMAL, true)
+  ZO_PreHookHandler(checkboxcontrol, "OnClicked", function() ESOTheatreII.SetTransparentFlag(not ESOTheatreII.GetTransparentFlag()) end )

 end

 function ETII.ESOFavoritesGUI:Show()
-	local control = GetControl("TheatreFrame")
-	if StageIsActive then
-		control:SetHidden( false )
-	end
+  local control = GetControl("TheatreFrame")
+  if StageIsActive then
+    control:SetHidden( false )
+  end
 end

 function ETII.ESOFavoritesGUI:Hide()
-	local control = GetControl("TheatreFrame")
-	control:SetHidden( true )
+  local control = GetControl("TheatreFrame")
+  control:SetHidden( true )
 end

 function ETII.ESOFavoritesGUI:ToggleWindow()
-	local control = GetControl("TheatreFrame")
-    if ( control:IsHidden() ) then
-		StageIsActive = true
-        control:SetHidden( false )
-	else
-		StageIsActive = false
-		control:SetHidden( true )
-    end
+  local control = GetControl("TheatreFrame")
+  if ( control:IsHidden() ) then
+    StageIsActive = true
+    control:SetHidden( false )
+  else
+    StageIsActive = false
+    control:SetHidden( true )
+  end
 end

 function ETII.ESOFavoritesGUI:LoadFavoriteButtons()

-		local control = GetControl("TheatreFrame")
+  local control = GetControl("TheatreFrame")

-		local x = 0
-		local y = 0
+  local x = 0
+  local y = 0

-		local uielements = ETII.TweaksUI.MainWindow
+  local uielements = ETII.TweaksUI.MainWindow

-		control:SetWidth(uielements.WindowWidth)
-		control:SetHeight(uielements.WindowHeight)
+  control:SetWidth(uielements.WindowWidth)
+  control:SetHeight(uielements.WindowHeight)

-		local xOffsetbase = uielements.ButtonBaseOffsetX
-		local yOffsetbase = uielements.ButtonBaseOffsetY
-		local xOffsetRelative = uielements.ButtonRelativeOffsetX
-		local yOffsetRelative = uielements.ButtonRelativeOffsetY
-		local btnWidth = uielements.ButtonSize
+  local xOffsetbase = uielements.ButtonBaseOffsetX
+  local yOffsetbase = uielements.ButtonBaseOffsetY
+  local xOffsetRelative = uielements.ButtonRelativeOffsetX
+  local yOffsetRelative = uielements.ButtonRelativeOffsetY
+  local btnWidth = uielements.ButtonSize


-		for i,v in pairs(ETII.CurrentSVars.FavoriteTable) do
-			if (y < 5) then
-				y = y + 1
-			else
-				y = 1
-				x = x + 1
-			end
+  for i, v in pairs(ETII.CurrentSVars.FavoriteTable) do
+    if (y < 5) then
+      y = y + 1
+    else
+      y = 1
+      x = x + 1
+    end

-			local itemcontrol = CreateControlFromVirtual("TheatreFrameButtonFavorite", control, "ButtonFavoriteTemplate", i)
-			itemcontrol:ClearAnchors()
-			itemcontrol:SetAnchor(TOPLEFT, nul, nul, xOffsetbase+(xOffsetRelative*x), yOffsetbase+(yOffsetRelative*y))
-			local favbtncontrol = itemcontrol:GetNamedChild( "ButtonFavorite" )
-			favbtncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.PlayEmoteByID( v["ID"]  ) end )
-			favbtncontrol:SetWidth(btnWidth)
-			local favbtnLabel = favbtncontrol:GetLabelControl()
-			favbtnLabel:SetText(string.format("%s", v["EmoteName"] ))
-			local cfgbtncontrol = itemcontrol:GetNamedChild( "ButtonCfgFavorite" )
-			cfgbtncontrol:SetHandler( 'OnClicked', function()  ESOTheatreII.ESOEmotesListGUI:Show( itemcontrol:GetName() ) end )
-			if ( i <= 5 ) then
-				local btncontrol = GetControl("TheatreFrameButtonGroup1Panel"..i.."Button" )
-				btncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.PlayEmoteByID( v["ID"]  ) end )
-			end
-			if ( x > 0) then
-				cfgbtncontrol:ClearAnchors()
-				cfgbtncontrol:SetAnchor(TOPLEFT, favbtncontrol, TOPRIGHT, -10, 0)
-			end
-		end
+    local itemcontrol = CreateControlFromVirtual("TheatreFrameButtonFavorite", control, "ButtonFavoriteTemplate", i)
+    itemcontrol:ClearAnchors()
+    itemcontrol:SetAnchor(TOPLEFT, nul, nul, xOffsetbase + (xOffsetRelative * x), yOffsetbase + (yOffsetRelative * y))
+    local favbtncontrol = itemcontrol:GetNamedChild( "ButtonFavorite" )
+    favbtncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.PlayEmoteByID( v["ID"] ) end )
+    favbtncontrol:SetWidth(btnWidth)
+    local favbtnLabel = favbtncontrol:GetLabelControl()
+    favbtnLabel:SetText(string.format("%s", v["EmoteName"] ))
+    local cfgbtncontrol = itemcontrol:GetNamedChild( "ButtonCfgFavorite" )
+    cfgbtncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.ESOEmotesListGUI:Show( itemcontrol:GetName() ) end )
+    if ( i <= 5 ) then
+      local btncontrol = GetControl("TheatreFrameButtonGroup1Panel"..i.."Button" )
+      btncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.PlayEmoteByID( v["ID"] ) end )
+    end
+    if ( x > 0) then
+      cfgbtncontrol:ClearAnchors()
+      cfgbtncontrol:SetAnchor(TOPLEFT, favbtncontrol, TOPRIGHT, - 10, 0)
+    end
+  end

 end

 function ETII.ESOFavoritesGUI:ReLoadFavoriteButtons()

-		for i,v in pairs(ETII.CurrentSVars.FavoriteTable) do
-			local favbtncontrol = GetControl( "TheatreFrameButtonFavorite"..i.."ButtonFavorite" )
-			favbtncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.PlayEmoteByID( v["ID"]  ) end )
-			local favbtnLabel = favbtncontrol:GetLabelControl()
-			favbtnLabel:SetText(string.format("%s", v["EmoteName"] ))
-			local cfgbtncontrol = GetControl( "TheatreFrameButtonFavorite"..i.."ButtonCfgFavorite" )
-			cfgbtncontrol:SetHandler( 'OnClicked', function()  ESOTheatreII.ESOEmotesListGUI:Show( "TheatreFrameButtonFavorite"..i ) end )
-		end
+  for i, v in pairs(ETII.CurrentSVars.FavoriteTable) do
+    local favbtncontrol = GetControl( "TheatreFrameButtonFavorite"..i.."ButtonFavorite" )
+    favbtncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.PlayEmoteByID( v["ID"] ) end )
+    local favbtnLabel = favbtncontrol:GetLabelControl()
+    favbtnLabel:SetText(string.format("%s", v["EmoteName"] ))
+    local cfgbtncontrol = GetControl( "TheatreFrameButtonFavorite"..i.."ButtonCfgFavorite" )
+    cfgbtncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.ESOEmotesListGUI:Show( "TheatreFrameButtonFavorite"..i ) end )
+  end

 end

 function ETII.ESOFavoritesGUI:FavoriteButtonOnChange(aname, emoteid)
-	--Change the Stage button
-	local control = GetControl("TheatreFrame")
-	local favbtncontrol = control:GetNamedChild( aname.."ButtonFavorite" )
-	favbtncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.PlayEmoteByID( emoteid  ) end )
-	local favbtnLabel = favbtncontrol:GetLabelControl()
-	local oldemote = favbtnLabel:GetText()
-	favbtnLabel:SetText(string.format("%s", ETII.EmoteNameByID(emoteid)))
-
-	--Update the SavedVariables
-	--Using table index in-case someone wants an emote more than once
-	local tableindex = 0
-	tableindex = tonumber(string.sub(aname,15))
-
-	for i,v in pairs(ETII.CurrentSVars.FavoriteTable) do
-		if ( i == tableindex ) then
-		--[[--
+  --Change the Stage button
+  local control = GetControl("TheatreFrame")
+  local favbtncontrol = control:GetNamedChild( aname.."ButtonFavorite" )
+  favbtncontrol:SetHandler( 'OnClicked', function() ESOTheatreII.PlayEmoteByID( emoteid ) end )
+  local favbtnLabel = favbtncontrol:GetLabelControl()
+  local oldemote = favbtnLabel:GetText()
+  favbtnLabel:SetText(string.format("%s", ETII.EmoteNameByID(emoteid)))
+
+  --Update the SavedVariables
+  --Using table index in-case someone wants an emote more than once
+  local tableindex = 0
+  tableindex = tonumber(string.sub(aname, 15))
+
+  for i, v in pairs(ETII.CurrentSVars.FavoriteTable) do
+    if ( i == tableindex ) then
+      --[[--
 			if ETII.IsVerbose() then
 				ETII.PrintSystemChat( string.format("%d %s", i, v["ID"]))
 				ETII.PrintSystemChat( string.format("%d %s", i, v["EmoteName"]))
 			end
 		--]]--
-			v["ID"] = emoteid
-			v["EmoteName"] = string.format("%s", ETII.EmoteNameByID(emoteid))
-		end
-	end
+      v["ID"] = emoteid
+      v["EmoteName"] = string.format("%s", ETII.EmoteNameByID(emoteid))
+    end
+  end
 end

 function ETII.ESOFavoritesGUI:ButtonStateToggle()
-	--Used when the configuration window shown/hidden
-	for i = 1, maxButtons do
-		local cfgbtncontrol = GetControl("TheatreFrameButtonFavorite"..i.."ButtonCfgFavorite")
-		local btnstatus = cfgbtncontrol:GetState()
-		if (btnstatus == BSTATE_DISABLED) then
-			cfgbtncontrol:SetState(BSTATE_NORMAL, false)
-		else
-			cfgbtncontrol:SetState(BSTATE_DISABLED, true)
-		end
-	end
+  --Used when the configuration window shown/hidden
+  for i = 1, maxButtons do
+    local cfgbtncontrol = GetControl("TheatreFrameButtonFavorite"..i.."ButtonCfgFavorite")
+    local btnstatus = cfgbtncontrol:GetState()
+    if (btnstatus == BSTATE_DISABLED) then
+      cfgbtncontrol:SetState(BSTATE_NORMAL, false)
+    else
+      cfgbtncontrol:SetState(BSTATE_DISABLED, true)
+    end
+  end
 end

 function ETII.ESOFavoritesGUI:MinimizeWindowToggle()
-	local control = GetControl("TheatreFrame")
-	local btncontrol = control:GetNamedChild("ButtonGroup1" )
-	if (btncontrol:IsHidden()) then
-		btncontrol:SetHidden( false )
-	else
-		btncontrol:SetHidden( true )
-	end
-	--Quick way to appear to be minimizing window
-	for i = 1, maxButtons do
-		local cfgbtncontrol = GetControl("TheatreFrameButtonFavorite"..i.."ButtonCfgFavorite")
-		local favbtncontrol = GetControl( "TheatreFrameButtonFavorite"..i.."ButtonFavorite" )
-
-		if cfgbtncontrol:IsHidden() then
-			cfgbtncontrol:SetHidden( false )
-			favbtncontrol:SetHidden( false )
-			control:SetHeight(215)
-		else
-			cfgbtncontrol:SetHidden( true )
-			favbtncontrol:SetHidden( true )
-			control:SetHeight(25)
-		end
-	end
+  local control = GetControl("TheatreFrame")
+  local btncontrol = control:GetNamedChild("ButtonGroup1" )
+  if (btncontrol:IsHidden()) then
+    btncontrol:SetHidden( false )
+  else
+    btncontrol:SetHidden( true )
+  end
+  --Quick way to appear to be minimizing window
+  for i = 1, maxButtons do
+    local cfgbtncontrol = GetControl("TheatreFrameButtonFavorite"..i.."ButtonCfgFavorite")
+    local favbtncontrol = GetControl( "TheatreFrameButtonFavorite"..i.."ButtonFavorite" )
+
+    if cfgbtncontrol:IsHidden() then
+      cfgbtncontrol:SetHidden( false )
+      favbtncontrol:SetHidden( false )
+      control:SetHeight(215)
+    else
+      cfgbtncontrol:SetHidden( true )
+      favbtncontrol:SetHidden( true )
+      control:SetHeight(25)
+    end
+  end
 end

 function ETII.ESOFavoritesGUI:MoveWindow( x, y )
-		local mainFrame = GetControl("TheatreFrame")
-		mainFrame:ClearAnchors()
-		mainFrame:SetAnchor( TOPLEFT, GetControl("GuiRoot"), TOPLEFT, x, y)
+  local mainFrame = GetControl("TheatreFrame")
+  mainFrame:ClearAnchors()
+  mainFrame:SetAnchor( TOPLEFT, GetControl("GuiRoot"), TOPLEFT, x, y)
 end

 function ETII.ESOFavoritesGUI:SaveWindowPosition()

-	local mainFrame = GetControl("TheatreFrame")
-	local _,a,_,b,x,y = mainFrame:GetAnchor()
-	local x2 =mainFrame:GetLeft()
-	local y2 = mainFrame:GetTop()
-	if ETII.IsVerbose() then
-		ETII.PrintSystemChat( string.format("Anchor location returned= %d : %d",x ,y ))
-		ETII.PrintSystemChat( string.format("Top and Left inside GuiRoot= %d : %d",x2 ,y2 ))
-	end
-	--I'm going with Top and Left :D
-	--Anchor appears to be influenced by other controls on the screen?
-	ETII.CurrentSVars.UserSettings.StageLocation.Xoffset = x2
-	ETII.CurrentSVars.UserSettings.StageLocation.Yoffset = y2
+  local mainFrame = GetControl("TheatreFrame")
+  local _, a, _, b, x, y = mainFrame:GetAnchor()
+  local x2 = mainFrame:GetLeft()
+  local y2 = mainFrame:GetTop()
+  if ETII.IsVerbose() then
+    ETII.PrintSystemChat( string.format("Anchor location returned= %d : %d", x, y ))
+    ETII.PrintSystemChat( string.format("Top and Left inside GuiRoot= %d : %d", x2, y2 ))
+  end
+  --I'm going with Top and Left :D
+  --Anchor appears to be influenced by other controls on the screen?
+  ETII.CurrentSVars.UserSettings.StageLocation.Xoffset = x2
+  ETII.CurrentSVars.UserSettings.StageLocation.Yoffset = y2

 end

 function ETII.ESOFavoritesGUI:GetFavoriteButtonEmote( btnnumber )
-	local buttonid = tonumber(btnnumber) or 0
-	if (buttonid > 0) and (buttonid <= maxButtons) then
-		local favbtncontrol = GetControl( "TheatreFrameButtonFavorite"..buttonid.."ButtonFavorite" )
-		local favbtnLabel = favbtncontrol:GetLabelControl()
-		emotename = favbtnLabel:GetText()
-		return emotename
-	end
-	return
+  local buttonid = tonumber(btnnumber) or 0
+  if (buttonid > 0) and (buttonid <= maxButtons) then
+    local favbtncontrol = GetControl( "TheatreFrameButtonFavorite"..buttonid.."ButtonFavorite" )
+    local favbtnLabel = favbtncontrol:GetLabelControl()
+    emotename = favbtnLabel:GetText()
+    return emotename
+  end
+  return
 end

 function ETII.ESOFavoritesGUI:OnSlashCommand()
-	local control = GetControl("TheatreFrame")
-	StageIsActive = true
-	ETII.ESOFavoritesGUI:Show()
-	if ETII.IsVerbose() then
-		ETII.PrintSystemChat(ETII.Name.." "..ETII.Version.." Loaded.")
-	end
+  local control = GetControl("TheatreFrame")
+  StageIsActive = true
+  ETII.ESOFavoritesGUI:Show()
+  if ETII.IsVerbose() then
+    ETII.PrintSystemChat(ETII.Name.." "..ETII.Version.." Loaded.")
+  end
 end