WoWInterface SVN idExperience

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 2 to Rev 3
    Reverse comparison

Rev 2 → Rev 3

trunk/Addon.lua
1,5 → 1,5
--[[----------------------------------------------------------------------------
Copyright (c) 2007, Tom Wieland
Copyright (c) 2008, Tom Wieland
All rights reserved.
 
Redistribution and use in source and binary forms, with or without
27,7 → 27,8
POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------]]
 
local lib = LibStub('idLibrary-1.1')
local _G = _G
local frame = CreateFrame('Frame')
 
local TL, TC, TR = 'TOPLEFT', 'TOP', 'TOPRIGHT'
local ML, MC, MR = 'LEFT', 'CENTER', 'RIGHT'
38,20 → 39,20
local RepetitionsNeeded
local ExperienceRested
 
local function getExperienceLeft()
local function getExperienceLeft ()
return UnitXPMax('player') - UnitXP('player')
end
 
local function print()
local function print ()
local rested = GetXPExhaustion()
if rested then
UIErrorsFrame:AddMessage(('%s / %s = %s (%s %s%%)'):format(ExperienceLeft, ExperienceGain, RepetitionsNeeded, rested, math.floor(rested*100/ExperienceLeft)))
ChatFrame1:AddMessage(('%s / %s = %s (%s %s%%)'):format(ExperienceLeft, ExperienceGain, RepetitionsNeeded, rested, math.floor(rested*100/ExperienceLeft)))
else
UIErrorsFrame:AddMessage(ExperienceLeft..' / '..ExperienceGain..' = '..RepetitionsNeeded)
ChatFrame1:AddMessage(ExperienceLeft..' / '..ExperienceGain..' = '..RepetitionsNeeded)
end
end
 
local function PLAYER_XP_UPGRADE ()
local function PLAYER_XP_UPDATE ()
ExperienceGain = ExperienceLeft - getExperienceLeft()
ExperienceLeft = getExperienceLeft()
RepetitionsNeeded = math.ceil(ExperienceLeft / ExperienceGain)
64,20 → 65,33
RepetitionsNeeded = 0
end
 
local function initialize(name)
local function ADDON_LOADED (name)
if name ~= 'idExperience' then return end
ExperienceLeft = getExperienceLeft()
ExperienceGain = 0
RepetitionsNeeded = 0
end
 
local function enable()
local function PLAYER_LOGIN ()
SlashCmdList['ZEXPERIENCE_PRINTXP'] = print
SLASH_ZEXPERIENCE_PRINTXP1 = '/xp'
end
 
local function OnEvent (frame, event, ...)
if event == 'ADDON_LOADED' then
ADDON_LOADED(...)
elseif event == 'PLAYER_LOGIN' then
PLAYER_LOGIN(...)
elseif event == 'PLAYER_XP_UPDATE' then
PLAYER_XP_UPDATE(...)
elseif event == 'PLAYER_LEVEL_UP' then
PLAYER_LEVEL_UP(...)
end
end
 
lib:RegisterEvent('idExperience-Initialize', 'ADDON_LOADED', initialize)
lib:RegisterEvent('idExperience-Enable', 'PLAYER_LOGIN', enable)
lib:RegisterEvent('idExperience', 'PLAYER_XP_UPDATE', PLAYER_XP_UPDATE)
lib:RegisterEvent('idExperience', 'PLAYER_LEVEL_UP', PLAYER_LEVEL_UP)
frame:SetScript('OnEvent', OnEvent)
frame:RegisterEvent('ADDON_LOADED')
frame:RegisterEvent('PLAYER_LOGIN')
frame:RegisterEvent('PLAYER_XP_UPDATE')
frame:RegisterEvent('PLAYER_LEVEL_UP')
 
trunk/idExperience.toc
1,9 → 1,4
## Interface: 20300
## Title: Industrial: Experience
## Credits: Industrial
## Notes: Experience and kills left display
 
Libraries\LibStub.lua
Libraries\idLibrary-1.1.lua
 
Addon.lua
## Interface: 20401
## Notes: Experience and kills left display
 
Addon.lua