View Full Version : slash play, playing time location in database?
revloc02c
12-31-2012, 12:03 PM
When you type the /play command it tells you how much playing time your character has on the server. Does anyone know where this info is kept in the database?
Derision
12-31-2012, 12:41 PM
It's in the profile blob.
This SQL query calculates the 'time entitled on the account' by summing up the time played in minutes across all characters on an account, so you may be able to adapt it for your needs:
select sum(ascii(substring(profile, 237, 1)) + (ascii(substring(profile, 238, 1)) * 256) +
(ascii(substring(profile, 239, 1)) * 65536) + (ascii(substring(profile, 240, 1)) * 16777216))
from character_ where account_id = %i;
revloc02c
12-31-2012, 01:45 PM
Thanks Derision. I was afraid it was going to be in the blob. But you've removed that problem.
It looks like the number that your query yields is in minutes played.
Thanks again, the query is awesome.
revloc02c
12-31-2012, 02:07 PM
The sum function had me stumped for a bit so I am posting my version for posterity.
select id, account_id, name, zoneid, class, level,
ascii(substring(profile, 237, 1)) + (ascii(substring(profile, 238, 1)) * 256) + (ascii(substring(profile, 239, 1)) * 65536) + (ascii(substring(profile, 240, 1)) * 16777216) AS 'Play Time Minutes'
from character_;
Thanks again Derision.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.