コード例 #1
0
 /// <summary>
 ///     Adds the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="premiumTimeLeft">The premium time left.</param>
 /// <param name="vocation">The vocation.</param>
 /// <param name="spells">The spells.</param>
 public static void Add(NetworkMessage message, TimeSpan premiumTimeLeft, IVocation vocation, ICollection <ISpell> spells)
 {
     message.AddPacketType(GamePacketType.SelfBasicData);
     message.AddBoolean(premiumTimeLeft > TimeSpan.Zero);
     message.AddTimeSpan(premiumTimeLeft);
     message.AddByte(vocation.Id);
     AddSpells(message, spells);
 }
コード例 #2
0
ファイル: CreaturePacket.cs プロジェクト: Codinablack/Tibia
        /// <summary>
        ///     Adds the creature.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="characterSpawn">The character spawn.</param>
        /// <param name="creatureSpawn">The creature spawn.</param>
        /// <param name="known">if set to <c>true</c> [known].</param>
        /// <param name="removeKnown">The remove known.</param>
        public static void AddCreature(NetworkMessage message, ICharacterSpawn characterSpawn, ICreatureSpawn creatureSpawn, bool known, uint removeKnown)
        {
            // TODO: This method MUST be called "Add" for consistency
            if (known)
            {
                // TODO: MAGIC NUMBER DETECTED!
                message.AddUInt16(0x62); // known
                message.AddUInt32(creatureSpawn.Id);
            }
            else
            {
                // TODO: MAGIC NUMBER DETECTED!
                message.AddUInt16(0x61); // unknown
                message.AddUInt32(removeKnown);
                message.AddUInt32(creatureSpawn.Id);
                message.AddCreatureType(creatureSpawn.Creature.CreatureType);
                message.AddString(creatureSpawn.Creature.Name);
            }

            message.AddPercent(creatureSpawn.Health.ToPercent());
            message.AddDirection(creatureSpawn.Direction);
            message.AddAppearance(creatureSpawn.Outfit, creatureSpawn.Mount);
            message.AddByte(creatureSpawn.LightInfo.Level);
            message.AddByte(creatureSpawn.LightInfo.Color);
            message.AddUInt16(creatureSpawn.Speed.WalkSpeed);
            message.AddSkullType(creatureSpawn.Skull.Type);
            message.AddPartyShield(characterSpawn.GetPartyShield(creatureSpawn as CharacterSpawn));

            if (!known)
            {
                message.AddWarIcon(creatureSpawn.WarIcon);
            }

            CreatureType creatureType = creatureSpawn.Creature.CreatureType;

            if (creatureType == CreatureType.Monster && creatureSpawn is ISummon summon)
            {
                creatureType = summon.Master == characterSpawn ? CreatureType.SummonOwn : CreatureType.SummonOthers;
            }

            message.AddCreatureType(creatureType);
            message.AddSpeechBubble(creatureSpawn.Creature.SpeechBubble);

            // TODO: Implement marked/unmarked??
            message.AddByte(0xFF);

            // TODO: Implement helpers
            //if (otherPlayer)
            //{
            //    msg.add<uint16_t>(otherPlayer->getHelpers());
            //}
            //else
            //{
            // TODO: MAGIC NUMBER DETECTED!
            message.AddUInt16(0x00);
            //}
            message.AddBoolean(creatureSpawn is ISolidBlock);
        }
コード例 #3
0
 /// <summary>
 ///     Adds the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="friend">The friend.</param>
 public static void Add(NetworkMessage message, IFriend friend)
 {
     message.AddPacketType(GamePacketType.FriendEntry);
     message.AddUInt32(friend.Character.Id);
     message.AddString(friend.Character.Name);
     message.AddString(friend.Description);
     message.AddUInt32(friend.Icon);
     message.AddBoolean(friend.NotifyOnLogin);
     message.AddSessionStatus(friend.Character.Status);
 }
コード例 #4
0
 /// <summary>
 ///     Adds the worlds.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="worlds">The worlds.</param>
 private static void AddWorlds(NetworkMessage message, ICollection <World> worlds)
 {
     message.AddByte((byte)worlds.Count);
     foreach (World world in worlds)
     {
         message.AddByte(world.Id);
         message.AddString(world.Name);
         message.AddString(world.IpAddress);
         message.AddUInt16((ushort)world.Port);
         message.AddBoolean(world.IsPreview);
     }
 }
コード例 #5
0
        /// <summary>
        ///     Adds the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="creatureSpawn">The creature spawn.</param>
        public static void Add(NetworkMessage message, ICreatureSpawn creatureSpawn)
        {
            message.AddPacketType(GamePacketType.TileArtifactTransform);
            message.AddVector3(creatureSpawn.Tile.Position);
            message.AddByte(creatureSpawn.StackPosition);

            // TODO: Find out what this value means
            message.AddUInt16(0x63);
            message.AddUInt32(creatureSpawn.Id);
            message.AddDirection(creatureSpawn.Direction);

            // TODO: characterSpawn.CanWalkThrough(creatureSpawn)
            message.AddBoolean(false);
        }
コード例 #6
0
ファイル: SelfAppearPacket.cs プロジェクト: Codinablack/Tibia
        /// <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);
        }