Exemple #1
0
        /// <summary>
        ///     Adds the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="characterSpawn">The character spawn.</param>
        public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn)
        {
            message.AddPacketType(GamePacketType.SelfStats);
            message.AddUInt16((ushort)characterSpawn.Health.Current);
            message.AddUInt16((ushort)characterSpawn.Health.Maximum);
            message.AddUInt32(characterSpawn.FreeCapacity);
            message.AddUInt32(characterSpawn.Capacity);
            message.AddUInt64(characterSpawn.Level.Experience);
            message.AddUInt16((ushort)characterSpawn.Level.Current);
            message.AddPercent(characterSpawn.Level.ToPercent());

            // TODO: Experience bonus
            message.AddDouble(0, 3);

            message.AddUInt16((ushort)characterSpawn.Mana.Current);
            message.AddUInt16((ushort)characterSpawn.Mana.Maximum);

            message.AddByte(characterSpawn.MagicLevel.Base);
            message.AddByte(characterSpawn.MagicLevel.Current);
            message.AddPercent(characterSpawn.MagicLevel.ToPercent());

            message.AddByte(characterSpawn.Soul);
            message.AddUInt16(characterSpawn.Stamina);

            // TODO: Improve protocol to provide BonusSpeed in this packet
            message.AddUInt16(characterSpawn.Speed.WalkSpeed);

            // TODO: var condition = characterSpawn.getCondition(ConditionType.CONDITION_REGENERATION);
            message.AddUInt16(/*(ushort)(condition != null ? condition.getTicks() / 1000 : */ 0x00 /*)*/);

            message.AddUInt16((ushort)(characterSpawn.OfflineTraining.Elapsed.Ticks / 60 / 1000));
        }
        /// <summary>
        ///     Adds the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="characterSpawn">The character spawn.</param>
        /// <param name="canReportBugs">if set to <c>true</c> [can report bugs].</param>
        public static void Add(NetworkMessage message, ICharacterSpawn characterSpawn, bool canReportBugs)
        {
            message.AddPacketType(GamePacketType.SelfAppear);
            message.AddUInt32(characterSpawn.Id);

            // TODO: Beat duration (50)
            message.AddUInt16(0x32);

            // TODO: Remove base speeds
            message.AddDouble(857.36, 3);
            message.AddDouble(261.29, 3);
            message.AddDouble(-4795.01, 3);
            message.AddBoolean(canReportBugs);

            // TODO: Can change pvp framing option
            message.AddByte(0x00);

            // TODO: Expert mode button enabled
            message.AddByte(0x00);
        }