Exemple #1
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);
        }
Exemple #2
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);
        }
Exemple #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);
        }
Exemple #4
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);
        }
Exemple #5
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);
        }
Exemple #6
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);
        }
Exemple #7
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);
            }
        }
Exemple #8
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);
            }
        }
Exemple #9
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);
        }
Exemple #10
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);
            }
        }
Exemple #11
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);
            }
        }