On my shard a characters "Age" shows below his name. This is done by an edit to player mobile.
The age was based on the creation of the account, however now I would like it to be based off of his in-game playing time.
This is the old code.
I tried many things including this
obviously wrong
and got a little inspiration from this
Any help would be great.
The age was based on the creation of the account, however now I would like it to be based off of his in-game playing time.
This is the old code.
Code:
//START
Account acct = this.Account as Account;
if (acct != null && this.AccessLevel <= AccessLevel.Player)
{
TimeSpan totalTime = (DateTime.UtcNow - acct.Created);
list.Add(1060658, String.Format("Age\t{0} Days", totalTime.Days.ToString())); // ~1_val~: ~2_val~
}
//END
I tried many things including this
Code:
//START
if (PlayerMobile != null && this.AccessLevel <= AccessLevel.Player)
{
GameTime totalGameTime = (DateTime.UtcNow - PlayerMobile.SessionStart);
list.Add(1060658, String.Format("Age\t{0} Days", totalGameTime.Days.ToString())); // ~1_val~: ~2_val~
}
//END
obviously wrong
and got a little inspiration from this
Code:
PlayerMobile pm = e.Mobile as PlayerMobile;
if (pm != null)
{
pm.m_GameTime += (DateTime.UtcNow - pm.m_SessionStart);
if (pm.m_Quest != null)
{
pm.m_Quest.StopTimer();
}
#region Mondain's Legacy
QuestHelper.StopTimer(pm);
#endregion
pm.m_SpeechLog = null;
pm.LastOnline = DateTime.UtcNow;
pm.AutoStablePets();
}
Any help would be great.