예제 #1
0
        void SynchronizeSelf()
        {
            var hp = Character.HP;
            var mp = Character.MP;

            var updateHP = hp != _lastSentHP;
            var updateMP = mp != _lastSentMP;

            if (updateHP)
            {
                using (var pw = ServerPacket.SetHP(hp))
                {
                    _user.Send(pw, ServerMessageType.GUIUserStats);
                }
            }

            if (updateMP)
            {
                using (var pw = ServerPacket.SetMP(mp))
                {
                    _user.Send(pw, ServerMessageType.GUIUserStats);
                }
            }

            _lastSentHP = hp;
            _lastSentMP = mp;
        }
예제 #2
0
        void SynchronizeSelf()
        {
            var hp = Character.HP;
            var mp = Character.MP;

            var updateHP = hp != _lastSentHP;
            var updateMP = mp != _lastSentMP;

            if (updateHP)
            {
                using (var pw = ServerPacket.SetHP(hp))
                {
                    _user.Send(pw, ServerMessageType.GUIUserStats);
                }
            }

            if (updateMP)
            {
                using (var pw = ServerPacket.SetMP(mp))
                {
                    _user.Send(pw, ServerMessageType.GUIUserStats);
                }
            }

            _lastSentHP = hp;
            _lastSentMP = mp;
        }
예제 #3
0
파일: ItemEntity.cs 프로젝트: wtfcolt/game
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemEntity"/> class.
        /// </summary>
        /// <param name="pos">The pos.</param>
        /// <param name="size">The size.</param>
        /// <param name="templateID">The template ID.</param>
        /// <param name="name">The name.</param>
        /// <param name="desc">The desc.</param>
        /// <param name="type">The type.</param>
        /// <param name="weaponType">Type of the weapon.</param>
        /// <param name="range">The range.</param>
        /// <param name="graphic">The graphic.</param>
        /// <param name="value">The value.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="hp">The hp.</param>
        /// <param name="mp">The mp.</param>
        /// <param name="equippedBody">The equipped body.</param>
        /// <param name="actionDisplayID">The action display ID.</param>
        /// <param name="baseStats">The base stats.</param>
        /// <param name="reqStats">The req stats.</param>
        ItemEntity(Vector2 pos, Vector2 size, ItemTemplateID?templateID, string name, string desc, ItemType type,
                   WeaponType weaponType, ushort range, GrhIndex graphic, int value, byte amount, SPValueType hp, SPValueType mp,
                   string equippedBody, ActionDisplayID?actionDisplayID, IEnumerable <Stat <StatType> > baseStats,
                   IEnumerable <Stat <StatType> > reqStats) : base(pos, size)
        {
            _templateID      = templateID;
            _name            = name;
            _description     = desc;
            _graphicIndex    = graphic;
            _value           = value;
            _amount          = amount;
            _type            = type;
            _weaponType      = weaponType;
            _range           = range;
            _hp              = hp;
            _mp              = mp;
            _equippedBody    = equippedBody;
            _actionDisplayID = actionDisplayID;

            _baseStats = NewItemStats(baseStats, StatCollectionType.Base);
            _reqStats  = NewItemStats(reqStats, StatCollectionType.Requirement);

            Resized -= ItemEntity_Resized;
            Resized += ItemEntity_Resized;
        }
예제 #4
0
        public static PacketWriter SetMP(SPValueType mp)
        {
            var pw = GetWriter();

            SetMP(pw, mp);
            return(pw);
        }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemTable"/> class.
 /// </summary>
 /// <param name="actionDisplayID">The initial value for the corresponding property.</param>
 /// <param name="amount">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="itemTemplateID">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 ItemTable(ActionDisplayID? @actionDisplayID, Byte @amount, String @description, String @equippedBody,
                  GrhIndex @graphic, Byte @height, SPValueType @hP, ItemID @iD, ItemTemplateID? @itemTemplateID,
                  SPValueType @mP, String @name, UInt16 @range, Int16 @statAgi, Int16 @statDefence, Int16 @statInt,
                  Int16 @statMaxhit, Int16 @statMaxhp, Int16 @statMaxmp, Int16 @statMinhit, Int16 @statReqAgi,
                  Int16 @statReqInt, Int16 @statReqStr, Int16 @statStr, ItemType @type, Int32 @value,
                  WeaponType @weaponType, Byte @width)
 {
     ActionDisplayID = @actionDisplayID;
     Amount          = @amount;
     Description     = @description;
     EquippedBody    = @equippedBody;
     Graphic         = @graphic;
     Height          = @height;
     HP             = @hP;
     ID             = @iD;
     ItemTemplateID = @itemTemplateID;
     MP             = @mP;
     Name           = @name;
     Range          = @range;
     SetStat(StatType.Agi, @statAgi);
     SetStat(StatType.Defence, @statDefence);
     SetStat(StatType.Int, @statInt);
     SetStat(StatType.MaxHit, @statMaxhit);
     SetStat(StatType.MaxHP, @statMaxhp);
     SetStat(StatType.MaxMP, @statMaxmp);
     SetStat(StatType.MinHit, @statMinhit);
     SetReqStat(StatType.Agi, @statReqAgi);
     SetReqStat(StatType.Int, @statReqInt);
     SetReqStat(StatType.Str, @statReqStr);
     SetStat(StatType.Str, @statStr);
     Type       = @type;
     Value      = @value;
     WeaponType = @weaponType;
     Width      = @width;
 }
예제 #6
0
        /// <summary>
        /// Creates the <see cref="StyledText"/> lines needed to display the information for an item. Provides a general way to
        /// gather and process the item information so we can work on various different sources that are not compatible with one another
        /// (e.g. <see cref="IItemTable"/> and <see cref="IItemTemplateTable"/>).
        /// </summary>
        /// <param name="name">The name of the item.</param>
        /// <param name="desc">The description.</param>
        /// <param name="value">The value.</param>
        /// <param name="hp">The hp.</param>
        /// <param name="mp">The mp.</param>
        /// <param name="stats">The base stats.</param>
        /// <param name="reqStats">The requirement stats.</param>
        /// <returns>
        /// The <see cref="StyledText"/> lines needed to display the information for the item.
        /// </returns>
        static StyledText[] GetStyledText(string name, string desc, int value, SPValueType hp, SPValueType mp,
                                          IEnumerable <KeyValuePair <StatType, int> > stats,
                                          IEnumerable <KeyValuePair <StatType, int> > reqStats)
        {
            // Create and add name and description
            var ret = new List <StyledText>();

            if (!string.IsNullOrEmpty(name))
            {
                ret.Add(new StyledText(name, _nameColor));
            }

            if (!string.IsNullOrEmpty(desc))
            {
                ret.Add(new StyledText(Environment.NewLine + desc));
            }

            // Value, HP, MP
            CreateValueLine(ret, "Value", value, _generalColor);

            if (hp != 0)
            {
                CreateValueLine(ret, "HP", hp, _bonusColor);
            }
            if (mp != 0)
            {
                CreateValueLine(ret, "MP", mp, _bonusColor);
            }

            // Stat bonuses
            foreach (var stat in stats.Where(x => x.Value != 0))
            {
                CreateValueLine(ret, stat.Key, stat.Value, _bonusColor);
            }

            // Stat requirements
            foreach (var stat in reqStats.Where(x => x.Value != 0))
            {
                CreateValueLine(ret, stat.Key, stat.Value, _reqColor);
            }

            return(ret.ToArray());
        }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterTable"/> class.
 /// </summary>
 /// <param name="aIID">The initial value for the corresponding property.</param>
 /// <param name="bodyID">The initial value for the corresponding property.</param>
 /// <param name="cash">The initial value for the corresponding property.</param>
 /// <param name="characterTemplateID">The initial value for the corresponding property.</param>
 /// <param name="chatDialog">The initial value for the corresponding property.</param>
 /// <param name="exp">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="level">The initial value for the corresponding property.</param>
 /// <param name="loadMapID">The initial value for the corresponding property.</param>
 /// <param name="loadX">The initial value for the corresponding property.</param>
 /// <param name="loadY">The initial value for the corresponding property.</param>
 /// <param name="moveSpeed">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="respawnMapID">The initial value for the corresponding property.</param>
 /// <param name="respawnX">The initial value for the corresponding property.</param>
 /// <param name="respawnY">The initial value for the corresponding property.</param>
 /// <param name="shopID">The initial value for the corresponding property.</param>
 /// <param name="statPoints">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="statStr">The initial value for the corresponding property.</param>
 public CharacterTable(AIID? @aIID, BodyID @bodyID, Int32 @cash, CharacterTemplateID? @characterTemplateID,
                       NPCChatDialogID? @chatDialog, Int32 @exp, SPValueType @hP, CharacterID @iD, Byte @level,
                       MapID @loadMapID, UInt16 @loadX, UInt16 @loadY, UInt16 @moveSpeed, SPValueType @mP, String @name,
                       MapID? @respawnMapID, Single @respawnX, Single @respawnY, ShopID? @shopID, Int32 @statPoints,
                       Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit, Int16 @statMaxhp,
                       Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr)
 {
     AIID   = @aIID;
     BodyID = @bodyID;
     Cash   = @cash;
     CharacterTemplateID = @characterTemplateID;
     ChatDialog          = @chatDialog;
     Exp          = @exp;
     HP           = @hP;
     ID           = @iD;
     Level        = @level;
     LoadMapID    = @loadMapID;
     LoadX        = @loadX;
     LoadY        = @loadY;
     MoveSpeed    = @moveSpeed;
     MP           = @mP;
     Name         = @name;
     RespawnMapID = @respawnMapID;
     RespawnX     = @respawnX;
     RespawnY     = @respawnY;
     ShopID       = @shopID;
     StatPoints   = @statPoints;
     SetStat(StatType.Agi, @statAgi);
     SetStat(StatType.Defence, @statDefence);
     SetStat(StatType.Int, @statInt);
     SetStat(StatType.MaxHit, @statMaxhit);
     SetStat(StatType.MaxHP, @statMaxhp);
     SetStat(StatType.MaxMP, @statMaxmp);
     SetStat(StatType.MinHit, @statMinhit);
     SetStat(StatType.Str, @statStr);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ViewNpcCharacterTable"/> class.
 /// </summary>
 /// <param name="aIID">The initial value for the corresponding property.</param>
 /// <param name="bodyID">The initial value for the corresponding property.</param>
 /// <param name="cash">The initial value for the corresponding property.</param>
 /// <param name="characterTemplateID">The initial value for the corresponding property.</param>
 /// <param name="chatDialog">The initial value for the corresponding property.</param>
 /// <param name="exp">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="level">The initial value for the corresponding property.</param>
 /// <param name="loadMapID">The initial value for the corresponding property.</param>
 /// <param name="loadX">The initial value for the corresponding property.</param>
 /// <param name="loadY">The initial value for the corresponding property.</param>
 /// <param name="moveSpeed">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="respawnMapID">The initial value for the corresponding property.</param>
 /// <param name="respawnX">The initial value for the corresponding property.</param>
 /// <param name="respawnY">The initial value for the corresponding property.</param>
 /// <param name="shopID">The initial value for the corresponding property.</param>
 /// <param name="statPoints">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="statStr">The initial value for the corresponding property.</param>
 public ViewNpcCharacterTable(AIID? @aIID, BodyID @bodyID, Int32 @cash, CharacterTemplateID? @characterTemplateID,
                              NPCChatDialogID? @chatDialog, Int32 @exp, SPValueType @hP, Int32 @iD, Byte @level,
                              MapID @loadMapID, UInt16 @loadX, UInt16 @loadY, UInt16 @moveSpeed, SPValueType @mP,
                              String @name, MapID? @respawnMapID, Single @respawnX, Single @respawnY, ShopID? @shopID,
                              Int32 @statPoints, Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit,
                              Int16 @statMaxhp, Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr)
 {
     AIID   = @aIID;
     BodyID = @bodyID;
     Cash   = @cash;
     CharacterTemplateID = @characterTemplateID;
     ChatDialog          = @chatDialog;
     Exp          = @exp;
     HP           = @hP;
     ID           = @iD;
     Level        = @level;
     LoadMapID    = @loadMapID;
     LoadX        = @loadX;
     LoadY        = @loadY;
     MoveSpeed    = @moveSpeed;
     MP           = @mP;
     Name         = @name;
     RespawnMapID = @respawnMapID;
     RespawnX     = @respawnX;
     RespawnY     = @respawnY;
     ShopID       = @shopID;
     StatPoints   = @statPoints;
     StatAgi      = @statAgi;
     StatDefence  = @statDefence;
     StatInt      = @statInt;
     StatMaxhit   = @statMaxhit;
     StatMaxhp    = @statMaxhp;
     StatMaxmp    = @statMaxmp;
     StatMinhit   = @statMinhit;
     StatStr      = @statStr;
 }
예제 #9
0
 public static void SetMP(PacketWriter pw, SPValueType mp)
 {
     pw.Write(ServerPacketID.SetMP);
     pw.Write(mp);
 }
예제 #10
0
 public static void SetHP(PacketWriter pw, SPValueType hp)
 {
     pw.Write(ServerPacketID.SetHP);
     pw.Write(hp);
 }
 /// <summary>
 /// Writes a <see cref="SPValueType"/> to a <see cref="IValueWriter"/>.
 /// </summary>
 /// <param name="valueWriter"><see cref="IValueWriter"/> to write to.</param>
 /// <param name="name">Unique name of the <see cref="SPValueType"/> that will be used to distinguish it
 /// from other values when reading.</param>
 /// <param name="value"><see cref="SPValueType"/> to write.</param>
 public static void Write(this IValueWriter valueWriter, string name, SPValueType value)
 {
     value.Write(valueWriter, name);
 }
 /// <summary>
 /// Writes a <see cref="SPValueType"/> to a <see cref="BitStream"/>.
 /// </summary>
 /// <param name="bitStream"><see cref="BitStream"/> to write to.</param>
 /// <param name="value"><see cref="SPValueType"/> to write.</param>
 public static void Write(this BitStream bitStream, SPValueType value)
 {
     value.Write(bitStream);
 }
예제 #13
0
 public static PacketWriter SetMP(SPValueType mp)
 {
     var pw = GetWriter();
     SetMP(pw, mp);
     return pw;
 }
예제 #14
0
 public static void SetMP(PacketWriter pw, SPValueType mp)
 {
     pw.Write(ServerPacketID.SetMP);
     pw.Write(mp);
 }
예제 #15
0
 public static PacketWriter SetHP(SPValueType hp)
 {
     var pw = GetWriter();
     SetHP(pw, hp);
     return pw;
 }
예제 #16
0
 public static void SetHP(PacketWriter pw, SPValueType hp)
 {
     pw.Write(ServerPacketID.SetHP);
     pw.Write(hp);
 }
예제 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemEntity"/> class.
        /// </summary>
        /// <param name="pos">The pos.</param>
        /// <param name="size">The size.</param>
        /// <param name="templateID">The template ID.</param>
        /// <param name="name">The name.</param>
        /// <param name="desc">The desc.</param>
        /// <param name="type">The type.</param>
        /// <param name="weaponType">Type of the weapon.</param>
        /// <param name="range">The range.</param>
        /// <param name="graphic">The graphic.</param>
        /// <param name="value">The value.</param>
        /// <param name="amount">The amount.</param>
        /// <param name="hp">The hp.</param>
        /// <param name="mp">The mp.</param>
        /// <param name="equippedBody">The equipped body.</param>
        /// <param name="actionDisplayID">The action display ID.</param>
        /// <param name="baseStats">The base stats.</param>
        /// <param name="reqStats">The req stats.</param>
        ItemEntity(Vector2 pos, Vector2 size, ItemTemplateID? templateID, string name, string desc, ItemType type,
                   WeaponType weaponType, ushort range, GrhIndex graphic, int value, byte amount, SPValueType hp, SPValueType mp,
                   string equippedBody, ActionDisplayID? actionDisplayID, IEnumerable<Stat<StatType>> baseStats,
                   IEnumerable<Stat<StatType>> reqStats) : base(pos, size)
        {
            _templateID = templateID;
            _name = name;
            _description = desc;
            _graphicIndex = graphic;
            _value = value;
            _amount = amount;
            _type = type;
            _weaponType = weaponType;
            _range = range;
            _hp = hp;
            _mp = mp;
            _equippedBody = equippedBody;
            _actionDisplayID = actionDisplayID;

            _baseStats = NewItemStats(baseStats, StatCollectionType.Base);
            _reqStats = NewItemStats(reqStats, StatCollectionType.Requirement);

            Resized += ItemEntity_Resized;
        }
예제 #18
0
 /// <summary>
 /// When overridden in the derived class, allows for additional handling of the
 /// <see cref="Character.MPChanged"/> event. It is recommended you override this method instead of
 /// using the corresponding event when possible.
 /// </summary>
 /// <param name="oldValue">The old value.</param>
 /// <param name="newValue">The new value.</param>
 protected virtual void OnMPChanged(SPValueType oldValue, SPValueType newValue)
 {
 }
예제 #19
0
        /// <summary>
        /// Creates the <see cref="StyledText"/> lines needed to display the information for an item. Provides a general way to
        /// gather and process the item information so we can work on various different sources that are not compatible with one another
        /// (e.g. <see cref="IItemTable"/> and <see cref="IItemTemplateTable"/>).
        /// </summary>
        /// <param name="name">The name of the item.</param>
        /// <param name="desc">The description.</param>
        /// <param name="value">The value.</param>
        /// <param name="hp">The hp.</param>
        /// <param name="mp">The mp.</param>
        /// <param name="stats">The base stats.</param>
        /// <param name="reqStats">The requirement stats.</param>
        /// <returns>
        /// The <see cref="StyledText"/> lines needed to display the information for the item.
        /// </returns>
        static StyledText[] GetStyledText(string name, string desc, int value, SPValueType hp, SPValueType mp,
                                          IEnumerable<KeyValuePair<StatType, int>> stats,
                                          IEnumerable<KeyValuePair<StatType, int>> reqStats)
        {
            // Create and add name and description
            var ret = new List<StyledText>();

            if (!string.IsNullOrEmpty(name))
                ret.Add(new StyledText(name, _nameColor));

            if (!string.IsNullOrEmpty(desc))
                ret.Add(new StyledText(Environment.NewLine + desc));

            // Value, HP, MP
            CreateValueLine(ret, "Value", value, _generalColor);

            if (hp != 0)
                CreateValueLine(ret, "HP", hp, _bonusColor);
            if (mp != 0)
                CreateValueLine(ret, "MP", mp, _bonusColor);

            // Stat bonuses
            foreach (var stat in stats.Where(x => x.Value != 0))
            {
                CreateValueLine(ret, stat.Key, stat.Value, _bonusColor);
            }

            // Stat requirements
            foreach (var stat in reqStats.Where(x => x.Value != 0))
            {
                CreateValueLine(ret, stat.Key, stat.Value, _reqColor);
            }

            return ret.ToArray();
        }
예제 #20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CharacterTable"/> class.
 /// </summary>
 /// <param name="aIID">The initial value for the corresponding property.</param>
 /// <param name="bodyID">The initial value for the corresponding property.</param>
 /// <param name="cash">The initial value for the corresponding property.</param>
 /// <param name="characterTemplateID">The initial value for the corresponding property.</param>
 /// <param name="chatDialog">The initial value for the corresponding property.</param>
 /// <param name="exp">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="level">The initial value for the corresponding property.</param>
 /// <param name="loadMapID">The initial value for the corresponding property.</param>
 /// <param name="loadX">The initial value for the corresponding property.</param>
 /// <param name="loadY">The initial value for the corresponding property.</param>
 /// <param name="moveSpeed">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="respawnMapID">The initial value for the corresponding property.</param>
 /// <param name="respawnX">The initial value for the corresponding property.</param>
 /// <param name="respawnY">The initial value for the corresponding property.</param>
 /// <param name="shopID">The initial value for the corresponding property.</param>
 /// <param name="statPoints">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="statStr">The initial value for the corresponding property.</param>
 public CharacterTable(AIID? @aIID, BodyID @bodyID, Int32 @cash, CharacterTemplateID? @characterTemplateID,
                       NPCChatDialogID? @chatDialog, Int32 @exp, SPValueType @hP, CharacterID @iD, Byte @level,
                       MapID @loadMapID, UInt16 @loadX, UInt16 @loadY, UInt16 @moveSpeed, SPValueType @mP, String @name,
                       MapID? @respawnMapID, Single @respawnX, Single @respawnY, ShopID? @shopID, Int32 @statPoints,
                       Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit, Int16 @statMaxhp,
                       Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr)
 {
     AIID = @aIID;
     BodyID = @bodyID;
     Cash = @cash;
     CharacterTemplateID = @characterTemplateID;
     ChatDialog = @chatDialog;
     Exp = @exp;
     HP = @hP;
     ID = @iD;
     Level = @level;
     LoadMapID = @loadMapID;
     LoadX = @loadX;
     LoadY = @loadY;
     MoveSpeed = @moveSpeed;
     MP = @mP;
     Name = @name;
     RespawnMapID = @respawnMapID;
     RespawnX = @respawnX;
     RespawnY = @respawnY;
     ShopID = @shopID;
     StatPoints = @statPoints;
     SetStat(StatType.Agi, @statAgi);
     SetStat(StatType.Defence, @statDefence);
     SetStat(StatType.Int, @statInt);
     SetStat(StatType.MaxHit, @statMaxhit);
     SetStat(StatType.MaxHP, @statMaxhp);
     SetStat(StatType.MaxMP, @statMaxmp);
     SetStat(StatType.MinHit, @statMinhit);
     SetStat(StatType.Str, @statStr);
 }
예제 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ItemTable"/> class.
 /// </summary>
 /// <param name="actionDisplayID">The initial value for the corresponding property.</param>
 /// <param name="amount">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="itemTemplateID">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 ItemTable(ActionDisplayID? @actionDisplayID, Byte @amount, String @description, String @equippedBody,
                  GrhIndex @graphic, Byte @height, SPValueType @hP, ItemID @iD, ItemTemplateID? @itemTemplateID,
                  SPValueType @mP, String @name, UInt16 @range, Int16 @statAgi, Int16 @statDefence, Int16 @statInt,
                  Int16 @statMaxhit, Int16 @statMaxhp, Int16 @statMaxmp, Int16 @statMinhit, Int16 @statReqAgi,
                  Int16 @statReqInt, Int16 @statReqStr, Int16 @statStr, ItemType @type, Int32 @value,
                  WeaponType @weaponType, Byte @width)
 {
     ActionDisplayID = @actionDisplayID;
     Amount = @amount;
     Description = @description;
     EquippedBody = @equippedBody;
     Graphic = @graphic;
     Height = @height;
     HP = @hP;
     ID = @iD;
     ItemTemplateID = @itemTemplateID;
     MP = @mP;
     Name = @name;
     Range = @range;
     SetStat(StatType.Agi, @statAgi);
     SetStat(StatType.Defence, @statDefence);
     SetStat(StatType.Int, @statInt);
     SetStat(StatType.MaxHit, @statMaxhit);
     SetStat(StatType.MaxHP, @statMaxhp);
     SetStat(StatType.MaxMP, @statMaxmp);
     SetStat(StatType.MinHit, @statMinhit);
     SetReqStat(StatType.Agi, @statReqAgi);
     SetReqStat(StatType.Int, @statReqInt);
     SetReqStat(StatType.Str, @statReqStr);
     SetStat(StatType.Str, @statStr);
     Type = @type;
     Value = @value;
     WeaponType = @weaponType;
     Width = @width;
 }
예제 #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ViewNpcCharacterTable"/> class.
 /// </summary>
 /// <param name="aIID">The initial value for the corresponding property.</param>
 /// <param name="bodyID">The initial value for the corresponding property.</param>
 /// <param name="cash">The initial value for the corresponding property.</param>
 /// <param name="characterTemplateID">The initial value for the corresponding property.</param>
 /// <param name="chatDialog">The initial value for the corresponding property.</param>
 /// <param name="exp">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="level">The initial value for the corresponding property.</param>
 /// <param name="loadMapID">The initial value for the corresponding property.</param>
 /// <param name="loadX">The initial value for the corresponding property.</param>
 /// <param name="loadY">The initial value for the corresponding property.</param>
 /// <param name="moveSpeed">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="respawnMapID">The initial value for the corresponding property.</param>
 /// <param name="respawnX">The initial value for the corresponding property.</param>
 /// <param name="respawnY">The initial value for the corresponding property.</param>
 /// <param name="shopID">The initial value for the corresponding property.</param>
 /// <param name="statPoints">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="statStr">The initial value for the corresponding property.</param>
 public ViewNpcCharacterTable(AIID? @aIID, BodyID @bodyID, Int32 @cash, CharacterTemplateID? @characterTemplateID,
                              NPCChatDialogID? @chatDialog, Int32 @exp, SPValueType @hP, Int32 @iD, Byte @level,
                              MapID @loadMapID, UInt16 @loadX, UInt16 @loadY, UInt16 @moveSpeed, SPValueType @mP,
                              String @name, MapID? @respawnMapID, Single @respawnX, Single @respawnY, ShopID? @shopID,
                              Int32 @statPoints, Int16 @statAgi, Int16 @statDefence, Int16 @statInt, Int16 @statMaxhit,
                              Int16 @statMaxhp, Int16 @statMaxmp, Int16 @statMinhit, Int16 @statStr)
 {
     AIID = @aIID;
     BodyID = @bodyID;
     Cash = @cash;
     CharacterTemplateID = @characterTemplateID;
     ChatDialog = @chatDialog;
     Exp = @exp;
     HP = @hP;
     ID = @iD;
     Level = @level;
     LoadMapID = @loadMapID;
     LoadX = @loadX;
     LoadY = @loadY;
     MoveSpeed = @moveSpeed;
     MP = @mP;
     Name = @name;
     RespawnMapID = @respawnMapID;
     RespawnX = @respawnX;
     RespawnY = @respawnY;
     ShopID = @shopID;
     StatPoints = @statPoints;
     StatAgi = @statAgi;
     StatDefence = @statDefence;
     StatInt = @statInt;
     StatMaxhit = @statMaxhit;
     StatMaxhp = @statMaxhp;
     StatMaxmp = @statMaxmp;
     StatMinhit = @statMinhit;
     StatStr = @statStr;
 }
예제 #23
0
        void LoadFromQueryValues(ICharacterTable v)
        {
            Name = v.Name;
            _id = v.ID;
            _templateID = v.CharacterTemplateID;
            MoveSpeed = v.MoveSpeed;

            BodyInfo = BodyInfoManager.Instance.GetBody(v.BodyID);

            Teleport(new Vector2(v.LoadX, v.LoadY));
            Resize(BodyInfo.Size);

            ((PersistentCharacterStatusEffects)StatusEffects).Load();

            // Set the character information
            _level = v.Level;
            _exp = v.Exp;
            _cash = v.Cash;
            _hp = v.HP;
            _mp = v.MP;
            RespawnMapID = v.RespawnMapID;
            RespawnPosition = new Vector2(v.RespawnX, v.RespawnY);
            StatPoints = v.StatPoints;

            _knownSkills = new KnownSkillsCollection(this);

            // Create the AI
            if (v.AIID.HasValue)
            {
                if (!SetAI(v.AIID.Value))
                {
                    const string errmsg = "Failed to set Character `{0}`'s AI to ID `{1}`.";
                    if (log.IsErrorEnabled)
                        log.ErrorFormat(errmsg, this, v.AIID.Value);
                    Debug.Fail(string.Format(errmsg, this, v.AIID.Value));
                    RemoveAI();
                }
            }

            // Load the stats
            BaseStats.CopyValuesFrom(v.Stats);

            // Load the Character's items
            Inventory.Load();
            Equipped.Load();

            // Update the mod stats
            UpdateModStats();

            // Additional loading
            HandleAdditionalLoading(v);

            // Set the map
            var m = World.GetMap(v.LoadMapID);
            if (m != null)
                Teleport(m, Position);
            else
                ((IRespawnable)this).Respawn();

            // Mark the Character as loaded
            SetAsLoaded();

            if (log.IsInfoEnabled)
                log.InfoFormat("Loaded Character `{0}`.", Name);
        }