コード例 #1
0
ファイル: WarpToMapHandler.cs プロジェクト: remy22/MapleGame
        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);
        }
コード例 #2
0
        public void Handle(MaplePacketLib.PacketReader packet)
        {
            Player player = new Player();
            player.Id = packet.ReadInt();
            player.Level = packet.ReadByte();
            player.Name = packet.ReadMapleString();

            MainGame.Instance.Field.Players.Add(player.Id, player);
        }
コード例 #3
0
        public void Handle(MaplePacketLib.PacketReader packet)
        {
            byte result = packet.ReadByte();

            if (result != 0)
            {
                Logger.Write(LogLevel.Error, "Unable to login: {0}", result);
            }
            else
            {
                Logger.Write(LogLevel.Info, "Login successful");

                var p = new MaplePacketLib.PacketWriter((short)SendOps.CHARLIST_REQUEST, 9);
                p.WriteByte(2);
                p.WriteByte(0); //scania
                p.WriteByte(0); //channel
                p.WriteInt(System.Environment.TickCount); //hwid?

                MainGame.Instance.Socket.Send(p);
            }
        }
コード例 #4
0
ファイル: CharListHandler.cs プロジェクト: remy22/MapleGame
        public void Handle(MaplePacketLib.PacketReader packet)
        {
            packet.Skip(1);
            byte chars = packet.ReadByte();

            if (chars == 0)
            {
                Logger.Write(LogLevel.Warning, "No characters on account");
                return;
            }

            int charId = packet.ReadInt();

            var p = new MaplePacketLib.PacketWriter((short)SendOps.CHAR_SELECT_WITH_PIC);
            p.WriteMapleString("000000");
            p.WriteInt(charId);
            p.WriteMapleString("nope");
            p.WriteMapleString("nope");

            MainGame.Instance.Socket.Send(p);
        }
コード例 #5
0
ファイル: MovePlayerHandler.cs プロジェクト: remy22/MapleGame
        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);
            }
        }