Ejemplo n.º 1
0
        /// <summary>
        /// Create a new message for the specified player.
        /// </summary>
        /// <param name="aPlayer">The player.</param>
        public MsgUserInfo(Player aPlayer)
            : base((UInt16)(64 + aPlayer.Name.Length + aPlayer.Mate.Length))
        {
            UniqId = aPlayer.UniqId;
            Look   = aPlayer.Look;
            Hair   = aPlayer.Hair;
            // Length -> unused
            // Fat -> unused
            Money = aPlayer.Money;
            Exp   = aPlayer.Exp;
            // 12 unknown bytes
            Force          = aPlayer.Strength;
            Dexterity      = aPlayer.Agility;
            Health         = aPlayer.Vitality;
            Soul           = aPlayer.Spirit;
            AddPoints      = aPlayer.AddPoints;
            CurHP          = (UInt16)aPlayer.CurHP;
            CurMP          = aPlayer.CurMP;
            PkPoints       = aPlayer.PkPoints;
            Level          = (Byte)aPlayer.Level;
            Profession     = aPlayer.Profession;
            AutoAllot      = aPlayer.AutoAllot;
            Metempsychosis = aPlayer.Metempsychosis;
            ShowName       = true;

            __StrPacker = new StringPacker(this, 61);
            __StrPacker.AddString(aPlayer.Name);
            __StrPacker.AddString(aPlayer.Mate);
        }
Ejemplo n.º 2
0
        public MsgTalk(String aSpeaker, String aHearer, String aWords, Channel aChannel, Color aColor)
            : base((UInt16)(21 + aSpeaker.Length + aHearer.Length + aWords.Length))
        {
            if (aSpeaker.Length > MAX_NAME_SIZE)
            {
                throw new ArgumentException("The name of the speaker is too long.");
            }

            if (aHearer.Length > MAX_NAME_SIZE)
            {
                throw new ArgumentException("The name of the hearer is too long.");
            }

            if (aWords.Length > MAX_WORDS_SIZE)
            {
                throw new ArgumentException("The words are too long.");
            }

            Color     = aColor;
            Channel   = aChannel;
            Style     = (UInt16)WordsStyle.None;
            Timestamp = Environment.TickCount;

            __StrPacker = new StringPacker(this, 16);
            __StrPacker.AddString(aSpeaker);
            __StrPacker.AddString(aHearer);
            __StrPacker.AddString(""); // Emotion
            __StrPacker.AddString(aWords);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create a new message for the specified player.
        /// </summary>
        /// <param name="aPlayer">The player.</param>
        public MsgPlayer(Player aPlayer)
            : base((UInt16)(55 + aPlayer.Name.Length))
        {
            Syndicate.Member synMember = null;
            if (aPlayer.Syndicate != null)
            {
                synMember = aPlayer.Syndicate.GetMemberInfo(aPlayer.UniqId);
            }

            Id       = aPlayer.UniqId;
            Lookface = aPlayer.Look;
            Status   = aPlayer.Statuses;
            if (synMember != null)
            {
                SynId   = aPlayer.Syndicate.Id;
                SynRank = (Byte)synMember.Rank;
            }
            HeadType       = aPlayer.GetHeadTypeID();
            ArmorType      = aPlayer.GetArmorTypeID();
            WeaponRType    = aPlayer.GetRightHandTypeID();
            WeaponLType    = aPlayer.GetLeftHandTypeID();
            Life           = (UInt16)aPlayer.CurHP;
            Level          = aPlayer.Level;
            PosX           = aPlayer.X;
            PosY           = aPlayer.Y;
            Hair           = aPlayer.Hair;
            Direction      = aPlayer.Direction;
            Pose           = (Byte)aPlayer.Action;
            Metempsychosis = aPlayer.Metempsychosis;

            __StrPacker = new StringPacker(this, 53);
            __StrPacker.AddString(aPlayer.Name);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a message object from the specified buffer.
 /// </summary>
 /// <param name="aBuf">The buffer containing the message.</param>
 /// <param name="aIndex">The index where the message is starting in the buffer.</param>
 /// <param name="aLength">The length of the message.</param>
 internal MsgName(Byte[] aBuf, int aIndex, int aLength)
     : base(aBuf, aIndex, aLength)
 {
     __Data      = BitConverter.ToUInt32(mBuf, 4);
     __Type      = (NameAct)mBuf[8];
     __StrPacker = new StringPacker(this, 9);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Create a message object from the specified buffer.
 /// </summary>
 /// <param name="aBuf">The buffer containing the message.</param>
 /// <param name="aIndex">The index where the message is starting in the buffer.</param>
 /// <param name="aLength">The length of the message.</param>
 internal MsgMessageBoard(Byte[] aBuf, int aIndex, int aLength)
     : base(aBuf, aIndex, aLength)
 {
     __Index     = BitConverter.ToUInt16(mBuf, 4);
     __Channel   = (Channel)BitConverter.ToUInt16(mBuf, 6);
     __Action    = (Action)mBuf[8];
     __StrPacker = new StringPacker(this, 9);
 }
Ejemplo n.º 6
0
        public MsgName(Int32 aData, String aParam, NameAct aType)
            : base((UInt16)(12 + aParam.Length))
        {
            Data = (UInt32)aData;
            Type = aType;

            __StrPacker = new StringPacker(this, 9);
            __StrPacker.AddString(aParam);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Create a message object from the specified buffer.
 /// </summary>
 /// <param name="aBuf">The buffer containing the message.</param>
 /// <param name="aIndex">The index where the message is starting in the buffer.</param>
 /// <param name="aLength">The length of the message.</param>
 internal MsgDialog(Byte[] aBuf, int aIndex, int aLength)
     : base(aBuf, aIndex, aLength)
 {
     __TaskId    = BitConverter.ToInt32(mBuf, 4);
     __Data      = BitConverter.ToUInt16(mBuf, 8);
     __IdxTask   = mBuf[10];
     __Action    = (Action)mBuf[11];
     __StrPacker = new StringPacker(this, 12);
 }
Ejemplo n.º 8
0
        public MsgName(UInt16 aPosX, UInt16 aPosY, String aParam, NameAct aType)
            : base((UInt16)(12 + aParam.Length))
        {
            PosX = aPosX;
            PosY = aPosY;
            Type = aType;

            __StrPacker = new StringPacker(this, 9);
            __StrPacker.AddString(aParam);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Create a message object from the specified buffer.
        /// </summary>
        /// <param name="aBuf">The buffer containing the message.</param>
        /// <param name="aIndex">The index where the message is starting in the buffer.</param>
        /// <param name="aLength">The length of the message.</param>
        internal MsgTalk(Byte[] aBuf, int aIndex, int aLength)
            : base(aBuf, aIndex, aLength)
        {
            __Color     = (Color)BitConverter.ToUInt32(mBuf, 4);
            __Channel   = (Channel)BitConverter.ToUInt16(mBuf, 8);
            __Style     = BitConverter.ToUInt16(mBuf, 10);
            __Timestamp = BitConverter.ToInt32(mBuf, 12);

            __StrPacker = new StringPacker(this, 16);
        }
Ejemplo n.º 10
0
        public MsgDialog(Byte aIdxTask, Action aAction)
            : base(14)
        {
            TaskId  = 0;
            Data    = 9;
            IdxTask = aIdxTask;
            _Action = aAction;

            __StrPacker = new StringPacker(this, 12);
        }
Ejemplo n.º 11
0
        public MsgDialog(UInt16 aPosX, UInt16 aPosY, UInt16 aPic, Byte aIdxTask, Action aAction)
            : base(14)
        {
            PosX    = aPosX;
            PosY    = aPosY;
            Data    = aPic;
            IdxTask = aIdxTask;
            _Action = aAction;

            __StrPacker = new StringPacker(this, 12);
        }
Ejemplo n.º 12
0
        public MsgDialog(String aText, UInt16 aData, Byte aIdxTask, Action aAction)
            : base((UInt16)(14 + aText.Length))
        {
            TaskId  = 0;
            Data    = aData;
            IdxTask = aIdxTask;
            _Action = aAction;

            __StrPacker = new StringPacker(this, 12);
            __StrPacker.AddString(aText);
        }
Ejemplo n.º 13
0
        public MsgName(UInt32 aData, String[] aParams, NameAct aType)
            : base((UInt16)(12 + aParams.Select(p => p.Length + 1).Sum()))
        {
            Data = aData;
            Type = aType;

            __StrPacker = new StringPacker(this, 9);
            foreach (String param in aParams)
            {
                __StrPacker.AddString(param);
            }
        }
Ejemplo n.º 14
0
        public MsgMessageBoard(UInt16 aIndex, Channel aChannel, String[] aParams, Action aAction)
            : base((UInt16)(10 + aParams.Select(p => p.Length + 1).Sum()))
        {
            Index   = aIndex;
            Channel = aChannel;
            _Action = aAction;

            __StrPacker = new StringPacker(this, 9);
            foreach (String param in aParams)
            {
                __StrPacker.AddString(param);
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Create a new message for the specified monster.
        /// </summary>
        /// <param name="aMonster">The monster.</param>
        public MsgPlayer(Monster aMonster)
            : base((UInt16)(55 + aMonster.Name.Length))
        {
            Id        = aMonster.UniqId;
            Lookface  = aMonster.Look;
            Status    = aMonster.Statuses;
            Life      = (UInt16)aMonster.CurHP;
            Level     = aMonster.Level;
            PosX      = aMonster.X;
            PosY      = aMonster.Y;
            Direction = aMonster.Direction;
            Pose      = (Byte)aMonster.Action;

            __StrPacker = new StringPacker(this, 53);
            __StrPacker.AddString(aMonster.Name);
        }
Ejemplo n.º 16
0
        public MsgNpcInfo(NPC aNpc, Boolean aSendName)
            : base((UInt16)(20 + (aSendName ? aNpc.Name.Length : 0)))
        {
            Id    = aNpc.UniqId;
            CellX = aNpc.X;
            CellY = aNpc.Y;
            Look  = (UInt16)aNpc.Look;
            Type  = aNpc.Type;
            Sort  = aNpc.Sort;

            __StrPacker = new StringPacker(this, 18);
            if (aSendName)
            {
                __StrPacker.AddString(aNpc.Name);
            }
        }
Ejemplo n.º 17
0
        public MsgNpcInfoEx(TerrainNPC aNpc, Boolean aSendName)
            : base((UInt16)(28 + (aSendName ? aNpc.Name.Length : 0)))
        {
            Id      = aNpc.UniqId;
            MaxLife = (UInt32)aNpc.MaxHP;
            Life    = (UInt32)aNpc.CurHP;
            CellX   = aNpc.X;
            CellY   = aNpc.Y;
            Look    = (UInt16)aNpc.Look;
            Type    = aNpc.Type;
            Sort    = aNpc.Sort;

            __StrPacker = new StringPacker(this, 26);
            if (aSendName)
            {
                __StrPacker.AddString(aNpc.Name);
            }
        }