/// SUMMARY (VM) /// Processes the played_time command /// this command will tell the player how long they have been playing the game since they have started /// it gives the amount of time in hh:mm:ss private static void ProcessPlayedTimeCommand(string[] parts) { // This is where the played_time command runs successfully; aka where the only command is "played_time" and there aren't any extra words added afterwards if (parts.Length == 1) { PlayedTime = DateTime.Now - StartTime; //this string below is just converting the PlayedTime format to just hh/mm/ss //otherwise, as I have tested, the PlayedTime will also contain fractions of a second, which is not needed for our purposes //also the fractions of a second printed might confuse the player //added the "(hh:mm:ss)" for the sake of clarification string pt = "You have played for " + PlayedTime.ToString(@"hh\:mm\:ss") + " (hh:mm:ss)."; PrintLinePositive(pt); } //using "PrintLineSpecial" for this specific text color so we can keep consistency //(ex: I wouldn't want to use "PrintLineWarning" because the user hasn't had an error in commands -> they just want their playing time!) else { try { //this is catching the most likely error of the player accidentally typing a command with more than one word: 'played_time' if (parts.Length >= 1) { PrintLinePositive("In order for the 'played_time' command to work, please don't type any extra characters after 'played_time'"); } //Now we're using "PrintLineWarning" because the user has made an error with this "played_time" command //and we just want to correct them so they can use the "played_time" command properly } catch (WorldException e) { //this will catch all other errors (besides the player adding an extra word or two after) PrintLineDanger(e.Message); } } }
void HandlePlayedTime(RequestPlayedTime packet) { PlayedTime playedTime = new PlayedTime(); playedTime.TotalTime = GetPlayer().GetTotalPlayedTime(); playedTime.LevelTime = GetPlayer().GetLevelPlayedTime(); playedTime.TriggerEvent = packet.TriggerScriptEvent; // 0-1 - will not show in chat frame SendPacket(playedTime); }
public override string ToString() { if (Id == 0) { return(Name); } else { return($"{Name.PadRight(34)} {("Playtime: " + PlayedTime.ToString(@"hh\:mm\:ss"))}"); } }
public Overview(IJson json) { Name = json.GetValue("account").GetValue("playerName").ToString(); LastPlayed = json.GetValue("stats").GetValue("lastUpdated").ToString(); PlayedTime = json.GetValue("stats").GetValue("timePlayed").GetValue("displayValue").ToString(); ScoreMin = json.GetValue("stats").GetValue("scorePerMinute").GetValue("displayValue").ToString(); KD = json.GetValue("stats").GetValue("kdRatio").GetValue("displayValue").ToString(); Rank = json.GetValue("stats").GetValue("rank").GetValue("displayValue").ToString(); WinP = json.GetValue("stats").GetValue("wlPercentage").GetValue("displayValue").ToString(); Kill = json.GetValue("stats").GetValue("kills").GetValue("displayValue").ToString(); KPM = json.GetValue("stats").GetValue("killsPerMinute").GetValue("displayValue").ToString(); Wins = json.GetValue("stats").GetValue("wins").GetValue("displayValue").ToString(); Deaths = json.GetValue("stats").GetValue("deaths").GetValue("displayValue").ToString(); Assists = json.GetValue("stats").GetValue("assists").GetValue("displayValue").ToString(); Damage = json.GetValue("stats").GetValue("damage").GetValue("displayValue").ToString(); Heals = json.GetValue("stats").GetValue("heals").GetValue("displayValue").ToString(); Revives = json.GetValue("stats").GetValue("revives").GetValue("displayValue").ToString(); Resupplies = json.GetValue("stats").GetValue("resupplies").GetValue("displayValue").ToString(); PlayedTime = PlayedTime.Replace("d", "天").Replace("h", "时").Replace("m", "分"); LastPlayed = DateTime.Parse(LastPlayed).ToLocalTime().ToString("F"); }