Might have mentioned this before, but here's another feature I am ready to start using along side Stats and other data.
I'd like to start tracking when a character was first created, when it logs in to when it logs out (/played and how long current session), and last updated/saved. I think we do the latter already with an ON UPDATE statement. I was thinking the total time played could be a Player Stat that we update on the stat cycle... but current session length is something we do not yet have, and that's what I'm after - because I am interested in the step that follows, auto-disconnect on idle - which will come at a later time as a custom option.
Anyway, any coders intrigued by this request? Let me know what you need DB-side to support the data.
Session Time (/played)
Moderator: Team Members
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
- Scatman
- Retired
- Posts: 1688
- Joined: Wed Apr 16, 2008 5:44 am
- EQ2Emu Server: Scatman's Word
- Characters: Scatman
- Location: New Jersey
Re: Session Time (/played)
I can do anything that isn't packet based because I have no idea how LE does that stuff
As long as we talk it over with the boss man and what not I can implement it .
Edit:
We already track creation date right? So I can do support for session times too.
Edit:
We already track creation date right? So I can do support for session times too.
-
LethalEncounter
- Team: Zombie
- Posts: 2717
- Joined: Wed Jul 25, 2007 10:10 pm
Re: Session Time (/played)
Feel free to implement whatever you need. I can always go back and tweak it if I find a more efficient way to do it 
- John Adams
- Retired
- Posts: 9684
- Joined: Thu Jul 26, 2007 6:27 am
- EQ2Emu Server: EQ2Emulator Test Center
- Characters: John
- Location: Arizona
- Contact:
Re: Session Time (/played)
We currently have 4 columns in the `characters` table that relate to time:
unix_timestamp (which I hate, and we HAVE to rename as it is a MySQL function name)
This field gets updated from Client::DetermineCharacterUpdates(), called from Client::Save() - so I think this is on the 5 minute "save character data" cycle.
created_date (which I hate, because it is a textual representation of date/time, which is more efficient if it is int(10))
Only updated on character creation in WorldDatabase::SaveCharacter(). If you guys let me convert this to an int(10), this is the only place for a code change.
last_played (which I hate, because it is a textual representation of date/time, which is more efficient if it is int(10))
This is not controlled by code at all, and is normally unused on every database - but on TessEQ2 I made this field get updated to current_timestamp every time the record gets edited (ON UPDATE). Again, I'd rather this be int(10) and requires no code changes to change the data type - however, extending the usage of this field, we should probably make this get updated on login ONLY. Thus, we'd have our session start value.
Unless LE has a strong argument against it, I prefer all "date/time" fields be int(10), stored as UNIX_TIMESTAMP. I think he implemented it as date/time for human readability, cuz I cannot think of any other reason to store a date as a string
For Total Time Played, Scat, I think we just add a Player Stat and feed it to the stat updater (yes?).
What do you think?
unix_timestamp (which I hate, and we HAVE to rename as it is a MySQL function name)
This field gets updated from Client::DetermineCharacterUpdates(), called from Client::Save() - so I think this is on the 5 minute "save character data" cycle.
created_date (which I hate, because it is a textual representation of date/time, which is more efficient if it is int(10))
Only updated on character creation in WorldDatabase::SaveCharacter(). If you guys let me convert this to an int(10), this is the only place for a code change.
last_played (which I hate, because it is a textual representation of date/time, which is more efficient if it is int(10))
This is not controlled by code at all, and is normally unused on every database - but on TessEQ2 I made this field get updated to current_timestamp every time the record gets edited (ON UPDATE). Again, I'd rather this be int(10) and requires no code changes to change the data type - however, extending the usage of this field, we should probably make this get updated on login ONLY. Thus, we'd have our session start value.
- session_time = now() - last_played
Unless LE has a strong argument against it, I prefer all "date/time" fields be int(10), stored as UNIX_TIMESTAMP. I think he implemented it as date/time for human readability, cuz I cannot think of any other reason to store a date as a string
For Total Time Played, Scat, I think we just add a Player Stat and feed it to the stat updater (yes?).
What do you think?
Who is online
Users browsing this forum: No registered users and 1 guest