Beispiel #1
0
        /// <summary>
        /// Tries to parse the GrhIndex from a string.
        /// </summary>
        /// <param name="parser">The Parser to use.</param>
        /// <param name="value">The string to parse.</param>
        /// <param name="outValue">If this method returns true, contains the parsed GrhIndex.</param>
        /// <returns>True if the parsing was successfully; otherwise false.</returns>
        public static bool TryParse(this Parser parser, string value, out GrhIndex outValue)
        {
            ushort tmp;
            var    ret = parser.TryParse(value, out tmp);

            outValue = new GrhIndex(tmp);
            return(ret);
        }
Beispiel #2
0
/// <summary>
/// Initializes a new instance of the <see cref="ItemTemplateTable"/> class.
/// </summary>
/// <param name="actionDisplayID">The initial value for the corresponding property.</param>
/// <param name="description">The initial value for the corresponding property.</param>
/// <param name="equippedBody">The initial value for the corresponding property.</param>
/// <param name="graphic">The initial value for the corresponding property.</param>
/// <param name="height">The initial value for the corresponding property.</param>
/// <param name="hP">The initial value for the corresponding property.</param>
/// <param name="iD">The initial value for the corresponding property.</param>
/// <param name="mP">The initial value for the corresponding property.</param>
/// <param name="name">The initial value for the corresponding property.</param>
/// <param name="range">The initial value for the corresponding property.</param>
/// <param name="statAgi">The initial value for the corresponding property.</param>
/// <param name="statDefence">The initial value for the corresponding property.</param>
/// <param name="statInt">The initial value for the corresponding property.</param>
/// <param name="statMaxhit">The initial value for the corresponding property.</param>
/// <param name="statMaxhp">The initial value for the corresponding property.</param>
/// <param name="statMaxmp">The initial value for the corresponding property.</param>
/// <param name="statMinhit">The initial value for the corresponding property.</param>
/// <param name="statReqAgi">The initial value for the corresponding property.</param>
/// <param name="statReqInt">The initial value for the corresponding property.</param>
/// <param name="statReqStr">The initial value for the corresponding property.</param>
/// <param name="statStr">The initial value for the corresponding property.</param>
/// <param name="type">The initial value for the corresponding property.</param>
/// <param name="value">The initial value for the corresponding property.</param>
/// <param name="weaponType">The initial value for the corresponding property.</param>
/// <param name="width">The initial value for the corresponding property.</param>
        public ItemTemplateTable(System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID> @actionDisplayID, System.String @description, System.String @equippedBody, NetGore.GrhIndex @graphic, System.Byte @height, DemoGame.SPValueType @hP, DemoGame.ItemTemplateID @iD, DemoGame.SPValueType @mP, System.String @name, System.UInt16 @range, System.Int16 @statAgi, System.Int16 @statDefence, System.Int16 @statInt, System.Int16 @statMaxhit, System.Int16 @statMaxhp, System.Int16 @statMaxmp, System.Int16 @statMinhit, System.Int16 @statReqAgi, System.Int16 @statReqInt, System.Int16 @statReqStr, System.Int16 @statStr, DemoGame.ItemType @type, System.Int32 @value, DemoGame.WeaponType @weaponType, System.Byte @width)
        {
            this.ActionDisplayID = (System.Nullable <NetGore.Features.ActionDisplays.ActionDisplayID>)@actionDisplayID;
            this.Description     = (System.String)@description;
            this.EquippedBody    = (System.String)@equippedBody;
            this.Graphic         = (NetGore.GrhIndex)@graphic;
            this.Height          = (System.Byte)@height;
            this.HP    = (DemoGame.SPValueType)@hP;
            this.ID    = (DemoGame.ItemTemplateID)@iD;
            this.MP    = (DemoGame.SPValueType)@mP;
            this.Name  = (System.String)@name;
            this.Range = (System.UInt16)@range;
            this.SetStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)@statAgi);
            this.SetStat((DemoGame.StatType)DemoGame.StatType.Defence, (System.Int32)@statDefence);
            this.SetStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)@statInt);
            this.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHit, (System.Int32)@statMaxhit);
            this.SetStat((DemoGame.StatType)DemoGame.StatType.MaxHP, (System.Int32)@statMaxhp);
            this.SetStat((DemoGame.StatType)DemoGame.StatType.MaxMP, (System.Int32)@statMaxmp);
            this.SetStat((DemoGame.StatType)DemoGame.StatType.MinHit, (System.Int32)@statMinhit);
            this.SetReqStat((DemoGame.StatType)DemoGame.StatType.Agi, (System.Int32)@statReqAgi);
            this.SetReqStat((DemoGame.StatType)DemoGame.StatType.Int, (System.Int32)@statReqInt);
            this.SetReqStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)@statReqStr);
            this.SetStat((DemoGame.StatType)DemoGame.StatType.Str, (System.Int32)@statStr);
            this.Type       = (DemoGame.ItemType)@type;
            this.Value      = (System.Int32)@value;
            this.WeaponType = (DemoGame.WeaponType)@weaponType;
            this.Width      = (System.Byte)@width;
        }
Beispiel #3
0
 /// <summary>
 /// Writes a GrhIndex to a IValueWriter.
 /// </summary>
 /// <param name="valueWriter">IValueWriter to write to.</param>
 /// <param name="name">Unique name of the GrhIndex that will be used to distinguish it
 /// from other values when reading.</param>
 /// <param name="value">GrhIndex to write.</param>
 public static void Write(this IValueWriter valueWriter, string name, GrhIndex value)
 {
     value.Write(valueWriter, name);
 }
Beispiel #4
0
 /// <summary>
 /// Writes a GrhIndex to a BitStream.
 /// </summary>
 /// <param name="bitStream">BitStream to write to.</param>
 /// <param name="value">GrhIndex to write.</param>
 public static void Write(this BitStream bitStream, GrhIndex value)
 {
     value.Write(bitStream);
 }
Beispiel #5
0
 /// <summary>
 /// Reads the GrhIndex from an IValueReader.
 /// </summary>
 /// <param name="valueReader">IValueReader to read the GrhIndex from.</param>
 /// <param name="name">The unique name of the value to read.</param>
 /// <returns>The GrhIndex read from the IValueReader.</returns>
 public static GrhIndex ReadGrhIndex(this IValueReader valueReader, string name)
 {
     return(GrhIndex.Read(valueReader, name));
 }
Beispiel #6
0
 /// <summary>
 /// Reads the GrhIndex from a BitStream.
 /// </summary>
 /// <param name="bitStream">BitStream to read the GrhIndex from.</param>
 /// <returns>The GrhIndex read from the BitStream.</returns>
 public static GrhIndex ReadGrhIndex(this BitStream bitStream)
 {
     return(GrhIndex.Read(bitStream));
 }
Beispiel #7
0
 /// <summary>
 /// Reads the GrhIndex from an <see cref="IDataRecord"/>.
 /// </summary>
 /// <param name="r"><see cref="IDataRecord"/> to read the GrhIndex from.</param>
 /// <param name="name">The name of the field to read the value from.</param>
 /// <returns>The GrhIndex read from the <see cref="IDataRecord"/>.</returns>
 public static GrhIndex GetGrhIndex(this IDataRecord r, string name)
 {
     return(GrhIndex.Read(r, name));
 }
Beispiel #8
0
 /// <summary>
 /// Reads the GrhIndex from an <see cref="IDataRecord"/>.
 /// </summary>
 /// <param name="r"><see cref="IDataRecord"/> to read the GrhIndex from.</param>
 /// <param name="i">The field index to read.</param>
 /// <returns>The GrhIndex read from the <see cref="IDataRecord"/>.</returns>
 public static GrhIndex GetGrhIndex(this IDataRecord r, int i)
 {
     return(GrhIndex.Read(r, i));
 }
Beispiel #9
0
        /// <summary>
        /// Tries to get the value in the <paramref name="dict"/> entry at the given <paramref name="key"/> as type GrhIndex.
        /// </summary>
        /// <typeparam name="T">The key Type.</typeparam>
        /// <param name="dict">The IDictionary.</param>
        /// <param name="key">The key for the value to get.</param>
        /// <param name="defaultValue">The value to use if the value at the <paramref name="key"/> could not be parsed.</param>
        /// <returns>The value at the given <paramref name="key"/> parsed as an int, or the
        /// <paramref name="defaultValue"/> if the <paramref name="key"/> did not exist in the <paramref name="dict"/>
        /// or the value at the given <paramref name="key"/> could not be parsed.</returns>
        public static GrhIndex AsGrhIndex <T>(this IDictionary <T, string> dict, T key, GrhIndex defaultValue)
        {
            string value;

            if (!dict.TryGetValue(key, out value))
            {
                return(defaultValue);
            }

            GrhIndex parsed;

            if (!Parser.Invariant.TryParse(value, out parsed))
            {
                return(defaultValue);
            }

            return(parsed);
        }