Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions TotemTimers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ function TotemTimers( msg )
if( arg[2] ) then
for j = 2, 5 do
if( arg[j] ) then
arg[j] = string.upper(string.sub(arg[j],1,1)) .. string.lower(string.sub(arg[j],2));
if( TotemTimers_ValidElement(arg[j]) ) then
TTData[TT_ORDER][j-1] = arg[j];
local element = TotemTimers_GetValidElement(arg[j]);
if( element ) then
TTData[TT_ORDER][j-1] = element;
else
TotemTimers_PrintUsage(TT_SLASH[TT_ORDER]);
break;
end
else
TTData[TT_ORDER][j-1] = nil;
Expand Down Expand Up @@ -148,19 +149,22 @@ function TotemTimers_PrintUsage(usage)

end

function TotemTimers_ValidElement(element)
function TotemTimers_GetValidElement(element)
if(element) then
if( element == TT_EARTH or
element == TT_FIRE or
element == TT_AIR or
element == TT_WATER ) then
return 1;
element = string.lower(element);
if (element == string.lower(TT_EARTH)) then
return TT_EARTH;
elseif (element == string.lower(TT_FIRE)) then
return TT_FIRE;
elseif (element == string.lower(TT_AIR)) then
return TT_AIR;
elseif (element == string.lower(TT_WATER)) then
return TT_WATER;
end

end
return nil;

end

function TotemTimers_SetOrientation()
if(TTData[TT_ARRANGE] == TT_VERTICAL) then
TotemTimer2:ClearAllPoints();
Expand Down