• 0

    posted a message on Omen3
    Quote from Dridzt
    I don't think that's doing what you believe it does.
    Without having looked at the code in depth I remember Xinhuan saying that tps is calculated from a configurable length sliding time window.

    I think you're just getting it to output the last "partial" average not the endfight-startfight/fighttime average.


    You are right. It tells you your TPS when the fight ends.

    Edit: Oh btw when I was first playing with it, I had it tell me every TPS value during a fight. It got spammy quick. :) So I just settled on my final TPS when a fight is over.
    Posted in: Raid AddOns
  • 0

    posted a message on Omen3
    I was wondering if an additional option could be added to Omen? I have always wondered what my TPS was after a fight was over. There use to be an addOn that would tell me pre 3.0.2. However, it would be nice to get the values from Omen. So I added some code to Omen.lua that tells me my TPS when a fight ends. Here is the code:

    function Omen:UpdateTPS()
    	if testMode then
    		for i = 1, #bars do
    			bars[i].Text3:SetText(1300 - 50*i)
    		end
    		return
    	end
    	-- Remove data that is too old
    	local TPSWindow = db.Bar.TPSWindow
    	local startTime = GetTime() - TPSWindow
    	while threatStoreTime[2] and startTime > threatStoreTime[2] do
    		delTable(tremove(threatStore, 1))
    		tremove(threatStoreTime, 1)
    	end
    	-- Now check that we still have enough data
    	local dataSize = #threatStoreTime
    	if dataSize == 0 or startTime <= threatStoreTime[1] then
    		-- We do not have enough data, TPSWindow seconds has not passed
    		for i = 1, #bars do
    			bars[i].Text3:SetText("??")
    		end
    		return
    	end
    	-- Check for special case with just 1 data point past TPSWindow seconds
    	if dataSize == 1 then
    		-- Threat generated is 0
    		for i = 1, #bars do
    			bars[i].Text3:SetText("0")
    		end
    		return
    	end
    	-- We have at least 2 data points
    	for i = 1, #bars do
    		if not bars[i]:IsShown() then return end
    		local guid = bars[i].guid
    		local baseThreat = threatStore[1][guid]
    		local secondThreat = threatStore[2][guid]
    		local finalThreat = threatStore[dataSize][guid]
    		if baseThreat and secondThreat and finalThreat then
    			-- Calculate TPS
    			local ratio = (startTime - threatStoreTime[1]) / (threatStoreTime[2] - threatStoreTime[1])
    			local startThreat = (secondThreat - baseThreat) * ratio + baseThreat
    			bars[i].Text3:SetFormattedText("%d", (finalThreat - startThreat) / TPSWindow / 100)
    
    			--code i added to write to the chat window
    			if UnitGUID("player") then
    				if guid == UnitGUID("player") then
    					chatTPS = string.format("%d", (finalThreat - startThreat) / TPSWindow / 100)
    				end
    			end
    			--end of my modification
    		else
    			-- We don't have enough data for this unit
    			bars[i].Text3:SetText("??")
    		end
    	end
    end


    function Omen:ClearAll()
    	for i = 0, #bars do
    		bars[i]:Hide()
    	end
    	self.TitleText:SetText(self.defaultTitle)
    	if db.Autocollapse then
    		self.Anchor:SetHeight(self.Title:GetHeight())
    		self.BarList:Hide()
    		if db.CollapseHide and not self.Anchor.IsMovingOrSizing then
    			self.Anchor:Hide()
    		end
    	end
    	-- Store last scanned mob GUID
    	lastWarn.mobGUID = nil
    	lastWarn.threatpercent = 0
    	-- Remove TPS data
    	if chatTPS ~= 0 then
    		DEFAULT_CHAT_FRAME:AddMessage("|cFFFFFF00 TPS is " .. chatTPS)
    	end
    	delTable(threatStore)
    	threatStore = newTable()
    	clearTable(threatStoreTime)
    	threatTable = nil
    	chatTPS = 0
    end


    chatTPS is just a local variable I added at the top of the .lua file. Thanks in advance.
    Posted in: Raid AddOns
  • To post a comment, please or register a new account.