WoW API: GetBillingTimeRested

From AddOn Studio
Jump to navigation Jump to search

WoW API < GetBillingTimeRested

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.

GetBillingTimeRested();

Arguments
none

Returns
Returns the seconds that you have left to play as rested. When you reach 3 hours you will get half tired, reducing both the amount of money and experience that you receive by 1/2. If you play for 5 hours or more you won't be able to turn in quests, receive experience or loot. The seconds will decay as you stay logged out. This function is global and connected to your whole account so the tired state will affect all characters. Currently this function is only used in Asia and will return a nil on EU and US realms.

Example

The official function (modified to output in the chat frame) when you have partial play time left:

local time_left = format(PLAYTIME_TIRED, REQUIRED_REST_HOURS - floor(GetBillingTimeRested()/60));
DEFAULT_CHAT_FRAME:AddMessage(time_left);

The official function (modified to output in the chat frame) when you have no play time left at all:

local time_left = format(PLAYTIME_UNHEALTHY, REQUIRED_REST_HOURS - floor(GetBillingTimeRested()/60));
DEFAULT_CHAT_FRAME:AddMessage(time_left);
Related

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