Ejemplo n.º 1
0
        public void Handle(MaplePacketLib.PacketReader packet)
        {
            int channel = packet.ReadInt();

            bool init = packet.ReadBool();

            if (init)
            {
                packet.Skip(15);
                packet.Skip(9);
                MainGame.Instance.Player.ReadStats(packet);
                packet.Skip(1); //buddy list capacity

                if (packet.ReadBool())
                {
                    packet.Skip(packet.ReadShort());
                }

                MainGame.Instance.Player.ReadInventory(packet);
            }
            else
            {
                packet.Skip(3);
                packet.ReadByte();
                int dest = packet.ReadInt();
                byte spaw = packet.ReadByte();
                MainGame.Instance.Player.CurHP = packet.ReadShort();
            }

            string msg = string.Concat("Loading map ", MainGame.Instance.Player.Map);
            Logger.Initializer(msg, MainGame.Instance.LoadMap);
        }
Ejemplo n.º 2
0
        public void Handle(MaplePacketLib.PacketReader packet)
        {
            packet.Skip(2);
            string ip = string.Join(".",packet.ReadBytes(4));
            short port = packet.ReadShort();
            MainGame.Instance.Player.Id = packet.ReadInt();

            MainGame.Instance.Socket.Disconnect();

            MainGame.Instance.LoginServer = false;
            MainGame.Instance.Socket.Connect(ip, port);
        }
Ejemplo n.º 3
0
        public void Handle(MaplePacketLib.PacketReader packet)
        {
            int cid = packet.ReadInt();

            Player player = MainGame.Instance.Field .Players.Get(cid);

            if (player == null)
                return;

            packet.Skip(4);

            int loop = packet.ReadByte();

            for (int i = 0; i < loop; i++)
            {
                byte command = packet.ReadByte();
                MovementSegment segment = new MovementSegment();

                switch (command)
                {
                    case 0:
                    case 5:
                    case 17:
                        {
                            segment.X = packet.ReadShort();
                            segment.Y = packet.ReadShort();
                            packet.Skip(7);
                            segment.Duration = packet.ReadShort();

                        }
                        break;
                    case 1:
                    case 2:
                    case 6: // fj
                    case 12:
                    case 13: // Shot-jump-back thing
                    case 16: //Float
                        {
                            player.X = packet.ReadShort();
                            player.Y = packet.ReadShort();
                            packet.Skip(1);
                            segment.Duration = packet.ReadShort();
                        }
                        break;
                    case 3:
                    case 4: // tele... -.-
                    case 7: // assaulter
                    case 8: // assassinate
                    case 9: // rush
                    case 14:  // Before Jump Down - fixes item/mobs dissappears
                        {
                            packet.Skip(9);
                        }
                        break;
                    case 10:// Change Equip
                        {
                            packet.Skip(1);
                        }
                        break;
                    case 11: //Chair
                        {
                            player.X = packet.ReadShort();
                            player.Y = packet.ReadShort();
                            packet.Skip(3);
                            segment.Duration = packet.ReadShort();
                        }
                        break;
                    case 15:
                        {
                            player.X = packet.ReadShort();
                            player.Y = packet.ReadShort();
                            packet.Skip(9);
                            segment.Duration = packet.ReadShort();
                        }
                        break;
                    case 21:
                        {
                            packet.Skip(3);
                        }
                        break;
                    default:
                        return;
                }

                player.Segments.Enqueue(segment);
            }
        }