WoW API: NoPlayTime

From AddOn Studio
Jump to navigation Jump to search

WoW API < NoPlayTime

This function is not in any way related to the rested state per character and resting in inns or cities. This function is to limit people from playing the game for too long, acting as a global account API that returns the same value no matter what character you logon.

NoPlayTime();

Arguments
none

Returns
Returns true if you have played more than 5 hours and are in a tired state. This is a global account state that affects all characters. Otherwise it returns nil if you are either only half affected of the tired state or not affected at all. This function is only working in continents like Asia where you have the rested system enabled, US and EU are not under such limitations.

Example

Based on the official function, changed a bit to output the text in the chat rather than the tooltip on your avatar:

if ( PartialPlayTime() ) then
   DEFAULT_CHAT_FRAME:AddMessage(format(PLAYTIME_TIRED, REQUIRED_REST_HOURS - floor(GetBillingTimeRested()/60)));
elseif ( NoPlayTime() ) then
   DEFAULT_CHAT_FRAME:AddMessage(format(PLAYTIME_UNHEALTHY, REQUIRED_REST_HOURS - floor(GetBillingTimeRested()/60)));
else
   DEFAULT_CHAT_FRAME:AddMessage("You are not limited by PartialPlayTime nor NoPlayTime.");
end
Related

Take a look on the PartialPlayTime() API and the GetBillingTimeRested() API.