Sec2hms() public static method

Converts a Timespan of seconds into Hours, Minutes, and Seconds
public static Sec2hms ( int seconds ) : string
seconds int Seconds to convert
return string
        /// <summary>
        /// Covnerts the conditions into a TreeNode
        /// </summary>
        /// <returns></returns>
        public override TreeNode ToTree()
        {
            string Name;
            string P2 = "";

            // Define start of description
            if (Params[0] == "global_stat")
            {
                Name = "Global " + StatsConstants.PythonGlobalVars[Params[1]];
            }
            else
            {
                Name = "Round " + StatsConstants.PythonPlayerVars[Params[1]];
            }

            // If we have 3 params, parse the last paramenter
            if (Params.Count == 3)
            {
                if (StatsConstants.IsTimeStat(Params[1]))
                {
                    P2 = Condition.Sec2hms(Int32.Parse(Params[2]));
                }
                else
                {
                    P2 = String.Format("{0:N0}", Int32.Parse(Params[2]));
                }

                Name += " Equal to or Greater Than " + P2;
            }

            TreeNode Me = new TreeNode(Name);

            Me.Tag = this;
            return(Me);
        }
        /// <summary>
        /// Covnerts the conditions into a TreeNode
        /// </summary>
        /// <returns></returns>
        public override TreeNode ToTree()
        {
            string Name     = "IAR: ";
            string Param    = "";
            string AsOrWith = "with ";

            string[] parts = Params[3].Split('_');

            // If we have a 5th param, convert it to a timestamp for a round time request
            if (Params.Count == 5)
            {
                Name += (Params[2] == "rtime")
                    ? Condition.Sec2hms(Int32.Parse(Params[4])) + " "
                    : String.Format("{0:N0}", Int32.Parse(Params[4])) + " ";
            }

            // Get human readable version of object names
            switch (parts[0])
            {
            case "WEAPON":
                Param = Bf2Constants.WeaponTypes[Params[3]];
                break;

            case "VEHICLE":
                Param = Bf2Constants.VehicleTypes[Params[3]];
                break;

            case "KIT":
                Param    = Bf2Constants.KitTypes[Params[3]];
                AsOrWith = "as ";
                break;
            }

            // Get human readable version of decription
            switch (Params[2])
            {
            case "kills":
                Name += "Kills " + AsOrWith + Param;
                break;

            case "rtime":
                Name += AsOrWith + Param;
                break;

            case "roadKills":
                Name += "RoadKills " + AsOrWith + Param;
                break;

            case "deployed":
                Name += "Deploys with " + Param;
                break;
            }

            TreeNode Me = new TreeNode(Name);

            Me.Tag = this;
            return(Me);
        }
Example #3
0
        /// <summary>
        /// Covnerts the conditions into a TreeNode
        /// </summary>
        /// <returns></returns>
        public override TreeNode ToTree()
        {
            // Achieve award less times then
            string Type  = StatsConstants.PythonGlobalVars[Params[1]];
            string Value = (StatsConstants.IsTimeStat(Params[1]))
                ? Condition.Sec2hms(Int32.Parse(Params[2]))
                : String.Format("{0:N0}", Int32.Parse(Params[2]));

            TreeNode Me = new TreeNode("Achieved " + Value + " Global " + Type + " One or More Times");

            Me.Tag = this;
            return(Me);
        }