r82186 - trunk/RamRacingRecords

7 views
Skip to first unread message

svnco...@wowace.com

unread,
Sep 29, 2008, 10:04:06 AM9/29/08
to wowace-gar...@googlegroups.com
Author: tifi
Date: Mon Sep 29 10:04:02 2008
New Revision: 82186

Log:
RamRacingRecords: Bugfix: Initialize GUI as hidden.

Modified:
trunk/RamRacingRecords/RamRacingRecords.lua
trunk/RamRacingRecords/RamRacingRecords.xml

Modified: trunk/RamRacingRecords/RamRacingRecords.lua
==============================================================================
--- trunk/RamRacingRecords/RamRacingRecords.lua (original)
+++ trunk/RamRacingRecords/RamRacingRecords.lua Mon Sep 29 10:04:02 2008
@@ -19,6 +19,7 @@

local ramBuff
local motivation = 0
+local motivationPrev = 0
local speedTexture
local numFatigue

@@ -171,8 +172,17 @@
end
end

+function rrr:GetBestRaceTime()
+ -- Find the best race.
+ local bestRaceTime = math.huge
+ for i,race in ipairs(self.db.global.races) do
+ bestRaceTime = math.min(bestRaceTime, race.raceTime)
+ end
+ return bestRaceTime
+end
+
--[[
-/script rrr:RamBuffChanged('swift')
+/script rrr:RamBuffChanged(GetSpellInfo(43880))
/script rrr:Pickup()
/script rrr:Delivery()
/script rrr:RamBuffChanged()
@@ -195,6 +205,8 @@
ramBuff = newRamBuff
end

+-----------------------------------------------------------------------------------------------------
+-- Ram Racing
function rrr:Start()
raceStart = GetTime()
lapStart = raceStart
@@ -208,42 +220,6 @@
self:Flash()
end

-do
- local oldx, oldy
- --local aspectratio = 3/4
- local mapx, mapy = 768, 500--aspectratio*667
- function rrr.OnUpdate(frame, elapsed)
- motivation = math.max(motivation - elapsed, 0)
- RRRNumReins:SetFormattedText('%.0f',10*motivation)
- if motivation>17 then
- -- Red
- RRRNumReins:SetTextColor(1,0,0)
- elseif 12<motivation and motivation<=14 then
- -- Yellow
- RRRNumReins:SetTextColor(1,1,0)
- else
- -- Green
- RRRNumReins:SetTextColor(0,1,0.3)
- end
- local x, y = GetPlayerMapPosition('player')
- x, y = mapx*x, mapy*y
- if oldx then
- local dx, dy = x-oldx, y-oldy
- local dist = math.sqrt(dx*dx + dy*dy)
- local speed = 10*(dist/elapsed)
- RRRSpeedometer:SetFormattedText('%02d', speed)
- end
- oldx, oldy = x, y
- end
-end
-
-rrrm=21
-function rrr:Giddyup()
- --if motivation+2<=21 then motivation = motivation+2 end
- motivation = math.min(motivation + 2, rrrm)
- self.OnUpdate(RRRFrame, 0)
-end
-
function rrr:Pickup()
if not ramBuff then return end
local now = GetTime()
@@ -284,15 +260,6 @@
tinsert(currentRace.lapTime, lapTime)
end

-function rrr:GetBestRaceTime()
- -- Find the best race.
- local bestRaceTime = math.huge
- for i,race in ipairs(self.db.global.races) do
- bestRaceTime = math.min(bestRaceTime, race.raceTime)
- end
- return bestRaceTime
-end
-
function rrr:Finish()
if deliveryCount <= 3 then
self:Print("That didn't count as a race.")
@@ -339,6 +306,8 @@
currentRace = nil
end

+-----------------------------------------------------------------------------------------------------
+-- Ram Riding GUI
function rrr:SetFatigue(fatigueapps)
if not fatigueapps then
RRRNumFatigue:SetText('-')
@@ -354,6 +323,75 @@
numFatigue = fatigueapps
end

+function rrr:SetSpeed(speed)
+ do
+ local map = {[RedSpeedTexture] = 3, [YellowSpeedTexture] = 2, [GreenSpeedTexture] = 1}
+ local old, new = speedTexture and map[speedTexture] or 0, speed and map[speed] or 0
+ --self:Printf("speed change %d -> %d at %d (reins at %d).", old, new, 10*motivation, 10*motivationPrev)
+ if old==3 and new==2 then
+ local max32 = 22.5 -- Screws things up if we use reins shortly before the buff change.
+ local min32 = 11.5
+ if motivation > max32 then
+ motivation = max32
+ --self:Printf("setting motivation = %d",10*max32)
+ elseif
+ motivation < min32 then
+ motivation = min32
+ --self:Printf("setting motivation = %d",10*min32)
+ end
+ elseif old==2 and new == 3 then
+ end
+ end
+ speedTexture = speed
+ if speed == RedSpeedTexture then
+ RRRSpeed:SetTexture(1,0,0)
+ elseif speed == YellowSpeedTexture then
+ RRRSpeed:SetTexture(1,1,0)
+ elseif speed == GreenSpeedTexture then
+ RRRSpeed:SetTexture(0,1,0)
+ else
+ RRRSpeed:SetTexture(.8,.8,.8)
+ end
+end
+
+rrrm=21
+rrrm2=21
+function rrr:Giddyup()
+ motivationPrev = motivation
+ --if motivation+2<=rrrm then motivation = motivation+2 end
+ motivation = math.min(motivation + 2, rrrm)
+ self.OnUpdate(RRRFrame, 0)
+end
+
+do
+ local oldx, oldy
+ --local aspectratio = 3/4
+ local mapx, mapy = 768, 500--aspectratio*667
+ function rrr.OnUpdate(frame, elapsed)
+ motivation = math.max(motivation - elapsed, 0)
+ RRRNumReins:SetFormattedText('%.0f',10*motivation)
+ if motivation>17 then
+ -- Red
+ RRRNumReins:SetTextColor(1,0,0)
+ elseif 12<motivation and motivation<=14 then
+ -- Yellow
+ RRRNumReins:SetTextColor(1,1,0)
+ else
+ -- Green
+ RRRNumReins:SetTextColor(0,1,0.3)
+ end
+ local x, y = GetPlayerMapPosition('player')
+ x, y = mapx*x, mapy*y
+ if oldx then
+ local dx, dy = x-oldx, y-oldy
+ local dist = math.sqrt(dx*dx + dy*dy)
+ local speed = 10*(dist/elapsed)
+ RRRSpeedometer:SetFormattedText('%02d', speed)
+ end
+ oldx, oldy = x, y
+ end
+end
+
function rrr:PLAYER_AURAS_CHANGED()
local newRamBuff
local fatigueapps
@@ -376,6 +414,7 @@
end
end
if numFatigue ~= fatigueapps then
+ motivation = math.min(motivation, rrrm2)
self:SetFatigue(fatigueapps)
end
if ramBuff ~= newRamBuff then
@@ -383,16 +422,7 @@
if newRamBuff and newRamBuff~=RamsteinsSwiftWorkRam then self:Printf("newRamBuff = %s.", newRamBuff) end
end
if speedTexture ~= speed then
- speedTexture = speed
- if speed == RedSpeedTexture then
- RRRSpeed:SetTexture(1,0,0)
- elseif speed == YellowSpeedTexture then
- RRRSpeed:SetTexture(1,1,0)
- elseif speed == GreenSpeedTexture then
- RRRSpeed:SetTexture(0,1,0)
- else
- RRRSpeed:SetTexture(.8,.8,.8)
- end
+ self:SetSpeed(speed)
end
end

Modified: trunk/RamRacingRecords/RamRacingRecords.xml
==============================================================================
--- trunk/RamRacingRecords/RamRacingRecords.xml (original)
+++ trunk/RamRacingRecords/RamRacingRecords.xml Mon Sep 29 10:04:02 2008
@@ -1,5 +1,5 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\..\FrameXML\UI.xsd">
- <Frame name="RRRFrame" toplevel="true" movable="true" parent="UIParent" enableMouse="true" hidden="false">
+ <Frame name="RRRFrame" toplevel="true" movable="true" parent="UIParent" enableMouse="true" hidden="true">
<Size>
<AbsDimension x="40" y="40"/>
</Size>

Reply all
Reply to author
Forward
0 new messages