Пример #1
0
        public byte[] GetBytes()
        {
            var Packet = new PangyaBinaryWriter();

            Packet.WriteUInt32(Index);
            Packet.WriteUInt32(TypeID);
            Packet.WriteUInt16(0);
            Packet.WriteSingle(PosX);
            Packet.WriteSingle(PosY);
            Packet.WriteSingle(PosZ);
            Packet.WriteSingle(PosR);
            Packet.WriteByte(0);

            return(Packet.GetBytes());
        }
Пример #2
0
        public static byte[] ShowPlayerRotate(uint ConID, float Angle)
        {
            var result = new PangyaBinaryWriter();

            result.Write(new byte[] { 0x56, 0x00 });
            result.WriteUInt32(ConID);
            result.WriteSingle(Angle);
            return(result.GetBytes());
        }
Пример #3
0
        /// <summary>
        /// return 239 bytes
        /// </summary>
        /// <returns></returns>
        public byte[] Statistic()
        {
            PangyaBinaryWriter result;

            result = new PangyaBinaryWriter();

            result.WriteUInt32(UserInfo.UserStatistic.Drive);
            result.WriteUInt32(UserInfo.UserStatistic.Putt);
            result.WriteUInt32(UserInfo.UserStatistic.PlayTime);
            result.WriteUInt32(UserInfo.UserStatistic.ShotTime);
            result.WriteSingle(UserInfo.UserStatistic.LongestDistance);
            result.WriteUInt32(UserInfo.UserStatistic.Pangya);
            result.WriteUInt32(UserInfo.UserStatistic.TimeOut);
            result.WriteUInt32(UserInfo.UserStatistic.OB);
            result.WriteUInt32(UserInfo.UserStatistic.DistanceTotal);
            result.WriteUInt32(UserInfo.UserStatistic.Hole);
            result.Write(new byte[] {
                0x00, 0x00, 0x00, 0x00, //team hole
                0x00, 0x00, 0x00, 0x00, //HIO
                0x1F, 0x00,             //bunker?
                0x00, 0x00, 0x00, 0x00, //fairway
                0x00, 0x00, 0x00, 0x00, //albatoss
                0x3E, 0x00, 0x00, 0x00, //hole in
                0x50, 0xC2, 0x70, 0x40, //puttin
                0x13, 0xC4, 0x4E, 0x41, //longestputt
            });
            //result.WriteUInt32(UserInfo.UserStatistic.TeamHole);
            //result.WriteUInt32(UserInfo.UserStatistic.HIO);
            //result.WriteUInt16(UserInfo.UserStatistic.Bunker);
            //result.WriteUInt32(UserInfo.UserStatistic.Fairway);
            //result.WriteUInt32(UserInfo.UserStatistic.Albratoss);
            //result.WriteUInt32(UserInfo.UserStatistic.Holein);
            //result.WriteUInt32(UserInfo.UserStatistic.Puttin);
            //result.WriteSingle(UserInfo.UserStatistic.LongestPutt);
            //result.WriteSingle(UserInfo.UserStatistic.LongestChip);
            result.WriteUInt32(UserInfo.UserStatistic.EXP);
            UserInfo.UserStatistic.Level = 70;
            result.WriteByte(UserInfo.UserStatistic.Level);
            result.WriteUInt64(UserInfo.UserStatistic.Pang);//pangs inicias
            result.WriteUInt32(UserInfo.UserStatistic.TotalScore);
            result.WriteByte(UserInfo.UserStatistic.Score[0]);
            result.WriteByte(UserInfo.UserStatistic.Score[1]);
            result.WriteByte(UserInfo.UserStatistic.Score[2]);
            result.WriteByte(UserInfo.UserStatistic.Score[3]);
            result.WriteByte(UserInfo.UserStatistic.Score[4]);
            result.Write(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE8, 0x03, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00,
                                      0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

                                      0x00, 0x00, 0x00, 0x00,

                                      0x00, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00,
                                      0x00, 0x00, 0x00, 0x00 });

            result.WriteByte(UserInfo.UserStatistic.Unknown1[0]);
            result.WriteByte(UserInfo.UserStatistic.Unknown1[1]);
            result.WriteByte(UserInfo.UserStatistic.Unknown1[2]);
            result.WriteByte(UserInfo.UserStatistic.Unknown1[3]);
            result.WriteByte(UserInfo.UserStatistic.Unknown1[4]);
            result.WriteByte(UserInfo.UserStatistic.Unknown); //Unknow3[5]
            result.WriteUInt32(UserInfo.UserStatistic.GameCountSeason);
            result.WriteByte(UserInfo.UserStatistic.Unknown2[0]);
            result.WriteByte(UserInfo.UserStatistic.Unknown2[1]);
            result.WriteByte(UserInfo.UserStatistic.Unknown2[2]);
            result.WriteByte(UserInfo.UserStatistic.Unknown2[3]);
            result.WriteByte(UserInfo.UserStatistic.Unknown2[4]);
            result.WriteByte(UserInfo.UserStatistic.Unknown2[5]);
            result.WriteByte(UserInfo.UserStatistic.Unknown2[6]);
            result.WriteByte(UserInfo.UserStatistic.Unknown2[7]);
            var response = result.GetBytes();

            return(response);
        }
        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);
        }