コード例 #1
0
        public void MoveSouth()
        {
            var builder   = new PacketBuilder(Packets.SendToClient.CreaturePositionUpdate);
            var oldPos    = _player.Position;
            var oldZIndex = _player.ZIndex;

            builder.AddPosition(oldPos);
            builder.AddU8(oldZIndex); // old stack position (z-index)
            _player.MoveDown();
            var newPos = _player.Position;

            builder.AddPosition(newPos);
            builder.Send(_player);

            builder.AddPacketId(Packets.SendToClient.MoveDown);
            /* add rest of map description */
            _player.Packets.Map.AddMapDescriptionToBuilder(builder,
                                                           (ushort)(oldPos.X - 8),
                                                           (ushort)(newPos.Y + 7),
                                                           newPos.Z,
                                                           GameClient.Width, 1, true);

            builder.Send(_player);

            var newZIndex = IoC.Game.GetCreatureZIndex(_player, _player.Position);

            IoC.Game.CreatureMoved(_player, oldPos, newPos, newZIndex);
        }
コード例 #2
0
        public void Sorry(string message)
        {
            var builder = new PacketBuilder();

            builder.AddPacketId(Packets.SendToClient.SorryMessageBox);
            builder.AddString(message);
            builder.Send(_player.Connection);
        }
コード例 #3
0
        public static void SendSorryMessageBox(this Socket connection, string message)
        {
            var builder = new PacketBuilder();

            builder.AddPacketId(Packets.SendToClient.SorryMessageBox);
            builder.AddString(message);
            builder.Send(connection);
        }
コード例 #4
0
        public void CreatureAppear(Creature creature)
        {
            var builder = new PacketBuilder();

            builder.AddPacketId(Packets.SendToClient.ItemOrCreatureAppearOnTile);
            builder.AddPosition(creature.Position);
            builder.AddCreature(_player, creature);
            builder.Send(_player);
        }
コード例 #5
0
        public void CreatureDisappear(Creature creature)
        {
            var builder = new PacketBuilder();

            builder.AddPacketId(Packets.SendToClient.ItemOrCreatureDisappear);
            builder.AddPosition(creature.Position);
            builder.AddU8(creature.ZIndex);
            builder.Send(_player);
        }
コード例 #6
0
        public void ItemAppear(Position pos, Item item)
        {
            var builder = new PacketBuilder();

            builder.AddPacketId(Packets.SendToClient.ItemOrCreatureAppearOnTile);
            builder.AddPosition(pos);
            builder.AddItem(item);
            builder.Send(_player);
        }
コード例 #7
0
        //     if (!tile.skip)
        //     {
        //         if (skip >= 0)
        //         {
        //             builder.AddU8((byte) skip);
        //             builder.AddU8(0xFF);
        //         }
        //
        //         skip = 0;
        //         var count = 0;
        //         if (tile.t.GroundId > 0)
        //         {
        //             builder.AddU16(tile.t.GroundId);
        //             count++;
        //         }
        //
        //         if (tile.t.Items?.Count > 0)
        //         {
        //             foreach (var t in tile.t.Items)
        //             {
        //                 if (count > 9)
        //                     break;
        //                 builder.AddItem(t);
        //                 count++;
        //             }
        //         }
        //
        //         var creatures = Game.Instance.GetCreaturesOnTile(currentTile);
        //
        //         if (creatures == null) continue;
        //         foreach (var creature in creatures)
        //         {
        //             if (count > 9)
        //                 break;
        //             builder.AddCreature(_player, creature);
        //             count++;
        //         }
        //     }
        //     else
        //     {
        //         skip++;
        //         if (skip != 0xFF) continue;
        //         builder.AddU8(0xFF);
        //         builder.AddU8(0xFF);
        //         skip = -1;
        //     }
        // }


        public void CreatureMoved(Position oldPos, Position newPos, byte newZIndex)
        {
            var builder = new PacketBuilder();

            builder.AddPacketId(Packets.SendToClient.CreaturePositionUpdate);
            builder.AddPosition(oldPos);
            builder.AddU8(newZIndex); // not 100% sure if it should be new or old z-index
            builder.AddPosition(newPos);
            builder.Send(_player);
        }
コード例 #8
0
        public void CreatureTurn(Creature creature)
        {
            var builder = new PacketBuilder();

            builder.AddPacketId(Packets.SendToClient.CreatureTurn);
            builder.AddPosition(creature.Position);
            builder.AddU8(creature.ZIndex);
            builder.AddU16(0x63);
            builder.AddU32(creature.Id);
            builder.AddU8((byte)creature.Direction);
            builder.Send(_player);
        }
コード例 #9
0
 public void AddFullMapToBuilder(PacketBuilder builder)
 {
     builder.AddPacketId(Packets.SendToClient.FullScreenMap);
     /* add player position */
     builder.AddPosition(_player.Position);
     /* add rest of map description */
     // AddMapDescriptionToBuilder(builder, 0, 0, GameClient.Width - 1, GameClient.Height - 1);
     AddMapDescriptionToBuilder(builder,
                                (ushort)(_player.Position.X - 8),
                                (ushort)(_player.Position.Y - 6),
                                _player.Position.Z,
                                GameClient.Width,
                                GameClient.Height, false);
 }
コード例 #10
0
        public void LoginSuccess()
        {
            _player.ZIndex = IoC.Game.GetCreatureZIndexLogin(_player, _player.Position);
            var builder = new PacketBuilder();

            builder.AddPacketId(Packets.SendToClient.LoginSuccess);
            builder.AddU32(_player.Id);
            builder.AddU16(GameClient.Beat);
            Map.AddFullMapToBuilder(builder);
            builder.Send(_player);

            WorldLight();
            Stats();
            Skills();
            StatusIcons();
            Equipment();
            Effects.Login(_player);

            PlayerAppear();
        }
コード例 #11
0
        public void MoveEast()
        {
            var builder   = new PacketBuilder(Packets.SendToClient.CreaturePositionUpdate);
            var oldPos    = _player.Position;
            var oldZIndex = _player.ZIndex;

            builder.AddPosition(oldPos);
            builder.AddU8(oldZIndex); // old stack position (z-index)
            _player.MoveRight();
            var newPos = _player.Position;

            builder.AddPosition(newPos);
            builder.AddPacketId(Packets.SendToClient.MoveRight);
            /* add rest of map description */
            _player.Packets.Map.AddMapDescriptionToBuilder(builder,
                                                           (ushort)(newPos.X + 9),
                                                           (ushort)(newPos.Y - 6),
                                                           newPos.Z, 1, GameClient.Height, true);

            builder.Send(_player);
            IoC.Game.CreatureMoved(_player, oldPos, newPos, oldZIndex);
        }