public static bool LoginResult(this LPlayer session, Packet packet)
        {
            if (!packet.ReadPStr(out session.UserInfo.GetLogin))
            {
                return(false);
            }

            if (!packet.ReadPStr(out session.UserInfo.GetPass))
            {
                return(false);
            }

            Console.WriteLine($"Login packet: {session.UserInfo.GetLogin}:{session.UserInfo.GetPass}");
            var count = Directory.GetFiles(@"Packets", "*.*", SearchOption.TopDirectoryOnly).Count();

            if (count >= 7)
            {
                if (File.Exists("Packets\\Login.hex"))
                {
                    var reader = new PangyaBinaryReader(new MemoryStream(File.ReadAllBytes("Packets\\Login.hex")));
                    reader.Skip(3);
                    var GetLogin = reader.ReadPStr();
                    session.UserInfo.GetUID        = reader.ReadUInt32();
                    session.UserInfo.GetCapability = (byte)reader.ReadUInt32();
                    session.UserInfo.GetLevel      = (byte)reader.ReadUInt32();
                    reader.Skip(6);
                    var GetNickname = reader.ReadPStr();
                    if (string.IsNullOrEmpty(GetNickname))
                    {
                        session.Response.Write(new byte[] { 0x01, 0x00 });
                        session.Response.WriteByte((byte)0xD8);//Call Create NickName
                        session.Response.WriteInt32(0);
                        session.SavePacket("PlayerCallCreateNickName");
                        session.SendResponse();
                        return(false);
                    }
                    else
                    {
                        session.UserInfo.GetNickname = GetNickname;
                        return(true);
                    }
                }
            }

            if (string.IsNullOrEmpty(session.UserInfo.GetNickname))
            {
                session.Response.Write(new byte[] { 0x01, 0x00 });
                session.Response.WriteByte((byte)0xD8);//Call Create NickName
                session.Response.WriteInt32(0);
                session.SavePacket("PlayerCallCreateNickName");
                session.SendResponse();
                return(false);
            }
            return(true);
        }
 public override void Load(PangyaBinaryReader reader)
 {
     this.Username = reader.ReadPStr();
     this.UID      = reader.ReadInt32();
     reader.Skip(6);
     this.AuthKeyLogin  = reader.ReadPStr();
     this.ServerVersion = reader.ReadPStr();
     this.Check         = reader.ReadUInt32();
     reader.Skip(4);
     this.AuthKeyGame = reader.ReadPStr();
 }
        public override void Load(PangyaBinaryReader reader)
        {
            Game = new Game()
            {
                Un          = reader.ReadByte(),
                TimeSec     = reader.ReadUInt32(),
                TimeMin     = reader.ReadUInt32(),
                MaxPlayers  = reader.ReadByte(),
                Mode        = (GameTypeEnum)reader.ReadByte(), //ok
                Holes       = reader.ReadByte(),               //
                Course      = (GameMapTypeEnum)reader.ReadByte(),
                HoleOrder   = (GameModeTypeEnum)reader.ReadByte(),
                NaturalMode = reader.ReadUInt32(),

                RoomTitle = reader.ReadPStr(),
                Password  = reader.ReadPStr(),
                Artifact  = reader.ReadUInt32()
            };

            Game.BuildCreateHole();
        }
        private void Handle(PangyaBinaryReader reader)
        {
            var response = new PangyaBinaryWriter();

            switch (PacketResult.Command)
            {
            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Help:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Status:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Visible:
            {
                var visible = reader.ReadByte();
            }
            break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Whisper:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Channel:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.List:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Open:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Open2:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Wind:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Weather:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Notice:
            {
                var notice = reader.ReadPStr();

                response.Write(new byte[] { 0x40, 0x00, 0x07 });
                response.WritePStr(Player.Member_Old.Nickname);
                response.WritePStr(notice);
            }
            break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.GiveItem:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.GoldenBell:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.SetMission:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.MathMap:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.KickPlayer:
                break;

            case Packet_PLAYER_GM_COMMAND.GMCommandTypeEnum.Discon_Uid:
                break;

            default:
                break;
            }
        }
Example #5
0
 public override void Load(PangyaBinaryReader reader)
 {
     GuildName = reader.ReadPStr();
 }
 public override void Load(PangyaBinaryReader reader)
 {
     //Credenciais do usuário
     UserName = reader.ReadPStr();
     Password = reader.ReadPStr();
 }
Example #7
0
 public override void Load(PangyaBinaryReader reader)
 {
     Nickname = reader.ReadPStr();
     Message  = reader.ReadPStr();
 }
Example #8
0
 public override void Load(PangyaBinaryReader reader)
 {
     RoomNumber = reader.ReadUInt16();
     Password   = reader.ReadPStr();
 }
 public override void Load(PangyaBinaryReader reader)
 {
     Username     = reader.ReadPStr();
     UID          = reader.ReadInt32();
     AuthKey_Game = reader.ReadPStr();
 }
        private void Handle(PangyaBinaryReader reader)
        {
            var response = new PangyaBinaryWriter();

            response.Write(new byte[] { 0xC4, 0x00 });
            response.Write(Player.ConnectionId);
            response.Write((byte)PacketResult.Action);

            switch (PacketResult.Action)
            {
            case PlayerActionEnum.PLAYER_ACTION_ROTATION:
            {
                Player.Position.W = reader.ReadSingle();

                response.WriteSingle(Player.Position.W);
            }
            break;

            case PlayerActionEnum.PLAYER_ACTION_UNK:
                break;

            case PlayerActionEnum.PLAYER_ACTION_APPEAR:
            {
                Player.Position.X = reader.ReadSingle();
                Player.Position.Y = reader.ReadSingle();
                Player.Position.Z = reader.ReadSingle();

                response.Write(Player.Position.X);
                response.Write(Player.Position.Y);
                response.Write(Player.Position.Z);
            }
            break;

            case PlayerActionEnum.PLAYER_ACTION_SUB:
            {
                Player.ChatGameInfo.Posture = (PlayerPostureEnum)reader.ReadByte();
                response.Write((int)Player.ChatGameInfo.Posture);
            }
            break;

            case PlayerActionEnum.PLAYER_ACTION_MOVE:
            {
                var x = reader.ReadSingle();
                var y = reader.ReadSingle();
                var z = reader.ReadSingle();

                Player.Position.X += x;
                Player.Position.Y += y;
                Player.Position.Z += z;

                response.WriteSingle(x);
                response.WriteSingle(y);
                response.WriteSingle(z);
            }
            break;

            case PlayerActionEnum.PLAYER_ACTION_ANIMATION:
            {
                Player.ChatGameInfo.Animation = reader.ReadPStrBytes();
                response.WritePStrBytes(Player.ChatGameInfo.Animation);
            }
            break;

            case PlayerActionEnum.PLAYER_ACTION_ANIMATION_2:
            {
                Player.ChatGameInfo.Animation_2 = reader.ReadInt32();

                response.Write(Player.ChatGameInfo.Animation_2);
            }
            break;

            case PlayerActionEnum.PLAYER_ANIMATION_WITH_EFFECTS:
            {
                Player.ChatGameInfo.AnimationWithEffects = reader.ReadPStr();
                response.WritePStr(Player.ChatGameInfo.AnimationWithEffects);
            }
            break;
            }

            string notice = $"POS X: {Player.Position.X} Y: {Player.Position.Y} Z: {Player.Position.Z}";

            Player.SendNotice(notice);

            //Console.WriteLine(Player.Member.Nickname + );
            Player.Game.SendToAll(response);
        }