Quantcast

Moved boss status calculations out of time.lua

Darthpred [10-29-12 - 18:44]
Moved boss status calculations out of time.lua

Also changed the way this stuff is shown as i mentioned in PMs
Feel free to test this and say if you like it or not.

For lvl 80-85 DS is shown, for lvl 86-90 3 MoP raids
Filename
ElvUI_SLE/locales/english.lua
ElvUI_SLE/locales/russian.lua
ElvUI_SLE/modules/datatexts/lfr.lua
ElvUI_SLE/modules/datatexts/load_datatexts.xml
ElvUI_SLE/modules/datatexts/time.lua
diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua
index 672f3dd..cfbb1b2 100644
--- a/ElvUI_SLE/locales/english.lua
+++ b/ElvUI_SLE/locales/english.lua
@@ -75,6 +75,9 @@ L["Select if the editbox will be above or below chat."] = true
 --Datatexts--
 L["LFR Dragon Soul"] = true
 L["LFR Mogu'shan Vaults"] = true
+L["LFR Heart of Fear"] = true
+L["LFR Terrace of Endless Spring"] = true
+L["Bosses killed: "] = true
 L["SLE_AUTHOR_INFO"] = "Shadow & Light Edit by Darth Predator & Repooc"
 L["SLE_CONTACTS"] = [=[Bug reports, suggestions and other stuff accepted via:
 - Private Massage on TukUI.org to Darth Predator or Repooc
diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua
index 7b02ed1..e183e9b 100644
--- a/ElvUI_SLE/locales/russian.lua
+++ b/ElvUI_SLE/locales/russian.lua
@@ -75,6 +75,9 @@ L["Select if the editbox will be above or below chat."] = "Определяет
 --Datatexts--
 L["LFR Dragon Soul"] = "Душа Дракона ЛФР"
 L["LFR Mogu'shan Vaults"] = "Подземелья Могу'шан ЛФР"
+L["LFR Heart of Fear"] = "Сердце Страха ЛФР"
+L["LFR Terrace of Endless Spring"] = "Терраса Вечной Весны ЛФР"
+L["Bosses killed: "] = "Боссов убито: "
 L["SLE_AUTHOR_INFO"] = "Редакция \"Тень и Свет\" от Darth Predator и Repooc"
 L["SLE_CONTACTS"] = [=[При возникновении вопросов, предложений и прочего обращаться:
 - Личное сообщение на форуме TukUI (tukui.org), ник Darth Predator или Repooc
diff --git a/ElvUI_SLE/modules/datatexts/lfr.lua b/ElvUI_SLE/modules/datatexts/lfr.lua
new file mode 100644
index 0000000..40f51f4
--- /dev/null
+++ b/ElvUI_SLE/modules/datatexts/lfr.lua
@@ -0,0 +1,158 @@
+--LFR boss status calculations--
+local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore
+local DT = E:GetModule('DataTexts')
+
+--For 4 boss raid
+function DT:FourKill(id)
+	local killNum = 0
+	for i =1,4 do
+		_, _, isKilled = GetLFGDungeonEncounterInfo(id, i);
+		if ( isKilled ) then
+			killNum = killNum + 1
+		end
+	end
+	if killNum == 4 then
+		GameTooltip:AddLine(L["Bosses killed: "]..killNum.."/4", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b)
+	else
+		GameTooltip:AddLine(L["Bosses killed: "]..killNum.."/4", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b)
+	end
+end
+
+function DT:FourShift(id)
+	for i =1,4 do --1st part
+		bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id, i);
+		if ( isKilled ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
+		elseif ( isIneligible ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		else
+				GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		end
+	end
+end
+
+--For 6 boss raid
+function DT:SixKill(id1, id2)
+	local killNum = 0
+	for i =1,3 do --1st part
+		_, _, isKilled = GetLFGDungeonEncounterInfo(id1, i);
+		if ( isKilled ) then
+			killNum = killNum + 1
+		end
+	end
+	for i =4,6 do --2nd part
+		_, _, isKilled = GetLFGDungeonEncounterInfo(id2, i);
+		if ( isKilled ) then
+			killNum = killNum + 1
+		end
+	end
+	if killNum == 6 then
+		GameTooltip:AddLine(L["Bosses killed: "]..killNum.."/6", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b)
+	else
+		GameTooltip:AddLine(L["Bosses killed: "]..killNum.."/6", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b)
+	end
+end
+
+function DT:SixShift(id1, id2)
+	for i =1,3 do --1st part
+		bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id1, i);
+		if ( isKilled ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
+		elseif ( isIneligible ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		else
+				GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		end
+	end
+	for i =4,6 do --2nd part
+		bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id2, i);
+		if ( isKilled ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
+		elseif ( isIneligible ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		else
+			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		end
+	end
+end
+
+--For 8 boss raid
+function DT:EightKill(id1, id2)
+	local killNum = 0
+	for i =1,4 do --1st part
+		_, _, isKilled = GetLFGDungeonEncounterInfo(id1, i);
+		if ( isKilled ) then
+			killNum = killNum + 1
+		end
+	end
+	for i =5,8 do --2nd part
+		_, _, isKilled = GetLFGDungeonEncounterInfo(id2, i);
+		if ( isKilled ) then
+			killNum = killNum + 1
+		end
+	end
+	if killNum == 8 then
+		GameTooltip:AddLine(L["Bosses killed: "]..killNum.."/8", RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b)
+	else
+		GameTooltip:AddLine(L["Bosses killed: "]..killNum.."/8", GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b)
+	end
+end
+
+function DT:EightShift(id1, id2)
+	for i =1,4 do --1st part
+		bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id1, i);
+		if ( isKilled ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
+		elseif ( isIneligible ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		else
+				GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		end
+	end
+	for i =5,8 do --2nd part
+		bossName, _, isKilled, isIneligible = GetLFGDungeonEncounterInfo(id2, i);
+		if ( isKilled ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
+		elseif ( isIneligible ) then
+				GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		else
+			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
+		end
+	end
+end
+
+function DT:DragonSoul(id1, id2)
+	GameTooltip:AddLine(L["LFR Dragon Soul"]) --Instance name
+	if IsShiftKeyDown() then
+		DT:EightShift(id1, id2)
+	else
+		DT:EightKill(id1, id2)
+	end
+end
+
+function DT:Mogushan(id1, id2)
+	GameTooltip:AddLine(L["LFR Mogu'shan Vaults"]) --Instance name
+	if IsShiftKeyDown() then
+		DT:SixShift(id1, id2)
+	else
+		DT:SixKill(id1, id2)
+	end
+end
+
+function DT:HoF(id1, id2)
+	GameTooltip:AddLine(L["LFR Heart of Fear"]) --Instance name
+	if IsShiftKeyDown() then
+		DT:SixShift(id1, id2)
+	else
+		DT:SixKill(id1, id2)
+	end
+end
+
+function DT:ToES(id)
+	GameTooltip:AddLine(L["LFR Terrace of Endless Spring"]) --Instance name
+	if IsShiftKeyDown() then
+		DT:FourShift(id)
+	else
+		DT:FourKill(id)
+	end
+end
\ No newline at end of file
diff --git a/ElvUI_SLE/modules/datatexts/load_datatexts.xml b/ElvUI_SLE/modules/datatexts/load_datatexts.xml
index be0012f..919154a 100644
--- a/ElvUI_SLE/modules/datatexts/load_datatexts.xml
+++ b/ElvUI_SLE/modules/datatexts/load_datatexts.xml
@@ -1,4 +1,5 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/">
+	<Script file='lfr.lua'/>
 	<Script file='version.lua'/>
 	<Script file='time.lua'/>
 	<Script file='add_panels.lua'/>
diff --git a/ElvUI_SLE/modules/datatexts/time.lua b/ElvUI_SLE/modules/datatexts/time.lua
index c39d6be..2c3ffd9 100644
--- a/ElvUI_SLE/modules/datatexts/time.lua
+++ b/ElvUI_SLE/modules/datatexts/time.lua
@@ -124,60 +124,6 @@ local function OnLeave(self)
 	enteredFrame = false;
 end

-local function DragonSoul()
-	local dungeonId1 = 416
-	local dungeonId2 = 417
-	GameTooltip:AddLine(" ")
-	GameTooltip:AddLine(L["LFR Dragon Soul"]) --Instance name
-	for i =1,4 do --1st part
-		bossName, texture, isKilled, isIneligible = GetLFGDungeonEncounterInfo(dungeonId1, i);
-		if ( isKilled ) then
-			GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
-		 elseif ( isIneligible ) then
-			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
-		 else
-			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
-		end
-	end
-	for i =5,8 do --2nd part
-		bossName, texture, isKilled, isIneligible = GetLFGDungeonEncounterInfo(dungeonId2, i);
-		if ( isKilled ) then
-			GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
-		 elseif ( isIneligible ) then
-			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
-		 else
-			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
-		end
-	end
-end
-
-local function Mogushan()
-	local dungeonId1 = 527
-	local dungeonId2 = 528
-	GameTooltip:AddLine(" ")
-	GameTooltip:AddLine(L["LFR Mogu'shan Vaults"]) --Instance name
-	for i =1,3 do --1st part
-		bossName, texture, isKilled, isIneligible = GetLFGDungeonEncounterInfo(dungeonId1, i);
-		if ( isKilled ) then
-			GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
-		 elseif ( isIneligible ) then
-			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
-		 else
-			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
-		end
-	end
-	for i =4,6 do --2nd part
-		bossName, texture, isKilled, isIneligible = GetLFGDungeonEncounterInfo(dungeonId2, i);
-		if ( isKilled ) then
-			GameTooltip:AddDoubleLine(bossName, BOSS_DEAD, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b, RED_FONT_COLOR.r, RED_FONT_COLOR.g, RED_FONT_COLOR.b);
-		 elseif ( isIneligible ) then
-			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE_INELIGIBLE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
-		 else
-			GameTooltip:AddDoubleLine(bossName, BOSS_ALIVE, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b, GREEN_FONT_COLOR.r, GREEN_FONT_COLOR.g, GREEN_FONT_COLOR.b);
-		end
-	end
-end
-
 local function OnEnter(self)
 	DT:SetupTooltip(self)
 	enteredFrame = true;
@@ -216,10 +162,15 @@ local function OnEnter(self)
 	if E.db.datatexts.lfrshow then
 	--LFR lockout text
 	local lvl = UnitLevel("player")
+	GameTooltip:AddLine(" ")
 	if lvl >= 80 and lvl < 86 then
-		DragonSoul()
+		DT:DragonSoul(416, 417)
 	elseif lvl >= 86 then
-		Mogushan()
+		DT:Mogushan(527, 528)
+		GameTooltip:AddLine(" ")
+		DT:HoF(529, 530)
+		GameTooltip:AddLine(" ")
+		DT:ToES(526)
 	end
 	--LFR lockout end
 	end