コード例 #1
0
        //Up to Platinum
        /// <summary>
        /// Converts Copper Pieces to Platinum Pieces, kepping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="cp">the source CopperPiece object. Will be mutated to include the remainder of non-converted value.</param>
        /// <returns>the new PlatinumPiece object, containing an equivalent value of the source CopperPiece object, sans the incompatible remainder of the conversion.</returns>
        public static PlatinumPiece ToPlatinumPieces(this CopperPiece cp)
        {
            var pp = (int)Math.Floor(cp.Count / 1000.0);

            cp.Count = cp.Count % 1000;
            return(new PlatinumPiece(pp));
        }
コード例 #2
0
        //Up to Electrum
        /// <summary>
        /// Converts Copper Pieces to Electrum Pieces, keeping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="cp">the source CopperPiece object. Will be mutated to include the remainder of non-converted value.</param>
        /// <returns>the new ElectrumPiece object, containing an equivalent value of the source CopperPiece object, sans the incompatible remainder of the conversion.</returns>
        public static ElectrumPiece ToElectrumPieces(this CopperPiece cp)
        {
            var ep = (int)Math.Floor(cp.Count / 50.0);

            cp.Count = cp.Count % 50;
            return(new ElectrumPiece(ep));
        }
コード例 #3
0
        //Up to Gold
        /// <summary>
        /// Converts Copper Pieces to Gold Pieces, kegping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="cp">the source CopperPiece object. Will be mutated to include the remainder of non-converted value.</param>
        /// <returns>the new GoldPiece object, containing an equivalent value of the source CopperPiece object, sans the incompatible remainder of the conversion.</returns>
        public static GoldPiece ToGoldPieces(this CopperPiece cp)
        {
            var gp = (int)Math.Floor(cp.Count / 100.0);

            cp.Count = cp.Count % 100;
            return(new GoldPiece(gp));
        }
コード例 #4
0
        //Up to Silver
        /// <summary>
        /// Converts Copper Pieces to Silver Pieces, keeping the remainder in the original CopperPiece object
        /// </summary>
        /// <param name="cp">the source CopperPiece object. Will be mutated to include the remainder of non-converted value.</param>
        /// <returns>the new SilverPiece object, containing an equivalent value of the source CopperPiece object, sans the incompatible remainder of the conversion.</returns>
        public static SilverPiece ToSilverPieces(this CopperPiece cp)
        {
            var sp = (int)Math.Floor(cp.Count / 10.0);

            cp.Count = cp.Count % 10;
            return(new SilverPiece(sp));
        }