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

            response.Write(new byte[] { 0x4A, 0x00, 0xFF, 0xFF });
            response.Write((byte)4);//GameType
            response.Write(fGameData.Map);
            response.Write(fGameData.HoleTotal);
            response.Write(fGameData.Mode);
            if (fGameData.HoleNumber > 0)
            {
                response.Write(fGameData.HoleNumber);
                response.Write(fGameData.LockHole == 7 ? 7 : 0);
            }
            response.Write(fGameData.NaturalMode);
            response.Write(fGameData.MaxPlayer);
            response.Write(fGameData.Time30S);
            response.Write(Idle);  //Room Idle
            response.Write(fGameData.VSTime);
            response.Write(fGameData.GameTime);
            response.Write(0); // trophy typeid
            response.Write(fGameData.Password.Length == 0);
            if (fGameData.Password.Length > 0)
            {
                response.WritePStr(fGameData.Password);
            }
            response.WritePStr(fGameData.Name);
            return(response.GetBytes());
        }
Пример #2
0
        public static bool SendAuth(AuthPacket packet)
        {
            if (_server.AuthServer != null)
            {
                _server.AuthServer.Send(packet);
                return(true);
            }
            else
            {
                switch (packet.ID)
                {
                case AuthPacketEnum.SERVER_RELEASE_CHAT:
                {
                    bool   Type        = packet.Message.IsGM;
                    string GetNickName = packet.Message.GetNickName;
                    string GetMessage  = packet.Message.GetMessage;
                    if (Type)
                    {
                        PacketCreator.ChatText(GetNickName, GetMessage, Type);
                    }
                }
                break;

                case AuthPacketEnum.SERVER_RELEASE_TICKET:
                {
                    string GetNickName = packet.Message.GetNickName;
                    string GetMessage  = packet.Message.GetMessage;
                    using (var result = new PangyaBinaryWriter())
                    {
                        result.Write(new byte[] { 0xC9, 0x00 });
                        result.WritePStr(GetNickName);
                        result.WritePStr(GetMessage);
                        _server.SendToAll(result.GetBytes());
                    }
                }
                break;

                case AuthPacketEnum.SERVER_RELEASE_BOXRANDOM:
                {
                    string GetMessage = packet.Message.GetMessage;
                    _server.Notice(GetMessage);
                }
                break;

                case AuthPacketEnum.SERVER_RELEASE_NOTICE:
                {
                    string GetNickname = packet.Message.GetNickname;
                    string Messages    = packet.Message.mensagem;

                    PacketCreator.ShowGMNotice(Messages, GetNickname);
                }
                break;
                }
                return(false);
            }
        }
Пример #3
0
        public static byte[] ChatText(string nickname, string Chat, bool GM)
        {
            var response = new PangyaBinaryWriter();

            response.Write(new byte[] { 0x40, 0x00 });
            response.WriteByte(Compare.IfCompare <byte>(GM, 0x80, 0)); //Tipo de chat
            response.WritePStr(nickname);
            response.WritePStr(Chat);
            return(response.GetBytes());
        }
Пример #4
0
        public void SendNotice(string notice)
        {
            var response = new PangyaBinaryWriter();

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

            SendResponse(response);
        }
Пример #5
0
        private void Handle()
        {
            var response = new PangyaBinaryWriter();

            response.Write(new byte[] { 0x40, 0x00 });
            response.Write((byte)(Player.Member_Old.Capabilities == 4 || Player.Member_Old.Capabilities == 15 ? 0x80 : 0)); //Tipo de chat
            response.WritePStr(PacketResult.Nickname);
            response.WritePStr(PacketResult.Message);

            Player.Channel.Lobby.SendToAll(response.GetBytes());
        }
Пример #6
0
 public static byte[] ShowChatText(uint UID, string NickName, string Message)
 {
     using (var Response = new PangyaBinaryWriter())
     {
         Response.Write(new byte[] { 0x30, 0x00, 0x13, 0x01 });
         Response.Write(UID);
         Response.WritePStr(NickName);
         Response.WritePStr(Message);
         return(Response.GetBytes());
     }
 }
        public void PlayerReadMail(GPlayer PL, Packet packet)
        {
            var _db = new PangyaEntities();
            PangyaBinaryWriter Reply;


            if (!packet.ReadUInt32(out uint MailIndex))
            {
                return;
            }

            Reply = new PangyaBinaryWriter();

            var QueryList = _db.ProcReadMail((int)PL.GetUID, (int)MailIndex).ToList();

            try
            {
                if (QueryList.Count > 0)
                {
                    Reply.Write(new byte[] { 0x12, 0x02 });
                    Reply.Write((uint)0);
                    Reply.Write(QueryList.First().Mail_Index);             //Select Page
                    Reply.WritePStr(QueryList.First().Sender);             //Sender
                    Reply.WritePStr(QueryList.First().RegDate.ToString()); //IsRead
                    Reply.WritePStr(QueryList.First().Msg);
                    Reply.Write((byte)1);
                    Reply.Write(QueryList.Count);//FF FF FF FF
                    foreach (var data in QueryList)
                    {
                        Reply.Write(uint.MaxValue);
                        Reply.Write(data.TYPEID);                       //typeID
                        Reply.Write(Convert.ToByte(data.IsTime));
                        Reply.Write(data.QTY ?? 0);                     //quantidade
                        Reply.Write(Convert.ToUInt32(data.DAY ?? 0));   //dias
                        Reply.WriteZero(16);
                        Reply.Write(4294967295);                        //FF FF FF FF
                        Reply.Write(0);
                        Reply.WriteStr(IsUCCNull(data.UCC_UNIQUE), 14); //UCC_UNIQUE
                    }
                    PL.SendResponse(Reply.GetBytes());
                }
                else
                {
                    Reply.Write(new byte[] { 0x12, 0x02 });
                    Reply.Write((uint)2);
                    PL.SendResponse(Reply.GetBytes());
                }
            }
            catch
            {
                PL.Close();
            }
        }
Пример #8
0
 public static byte[] ShowEditShopName(string ShopName, uint UID, string Nickname)
 {
     using (var Response = new PangyaBinaryWriter())
     {
         Response.Write(new byte[] { 0xE8, 0x00 });
         Response.Write(1);
         Response.WritePStr(ShopName);
         Response.Write(UID);//meu uid
         Response.WritePStr(Nickname);
         return(Response.GetBytes());
     }
 }
Пример #9
0
        public void PlayerSendWhisper(GPlayer player, string Nickname, string Messages)
        {
            PangyaBinaryWriter Response;
            GPlayer            Client;


            Response = new PangyaBinaryWriter();

            try
            {
                Client = (GPlayer)player.Server.GetPlayerByNickname(Nickname);


                if (Client == null)
                {
                    Response.Write(new byte[] { 0x40, 0x00 });
                    Response.WriteByte(5); //Status
                    Response.WritePStr(Nickname);
                    player.SendResponse(Response);
                    return;
                }
                if (!Client.InLobby)
                {
                    Response.Write(new byte[] { 0x40, 0x00 });
                    Response.WriteByte(4); //Status
                    Response.WritePStr(Nickname);
                    player.SendResponse(Response);
                    return;
                }

                Response = new PangyaBinaryWriter();
                Response.Write(new byte[] { 0x84, 0x00 });
                Response.WriteByte(0); //atingir player
                Response.WritePStr(player.GetNickname);
                Response.WritePStr(Messages);
                Client.SendResponse(Response);

                Response = new PangyaBinaryWriter();
                Response.Write(new byte[] { 0x84, 0x00 });
                Response.WriteByte(1);//atingir player
                Response.WritePStr(Nickname);
                Response.WritePStr(Messages);
                player.SendResponse(Response);
            }
            finally
            {
                if (Response != null)
                {
                    Response.Dispose();
                }
            }
        }
Пример #10
0
        public void TickerMessage(string nickname, string message)
        {
            var response = new PangyaBinaryWriter(new MemoryStream());

            response.Write(new byte[] { 0xC9, 0x00 });
            response.WritePStr(nickname);
            response.WritePStr(message);
            response.WriteZero(1);

            SendToAll(response.GetBytes());

            Console.WriteLine("Ticker enviado com sucesso");
        }
Пример #11
0
 public static byte[] ShowGMNotice(string Msg, string Nickname = "Staff")
 {
     using (var response = new PangyaBinaryWriter())
     {
         if (Nickname.Length <= 0 || Msg.Length <= 0)
         {
             return(response.GetBytes());
         }
         response.Write(new byte[] { 0x40, 0x00, 0x07 });
         response.WritePStr(Nickname);
         response.WritePStr(Msg);
         return(response.GetBytes());
     }
 }
Пример #12
0
 public static byte[] ShowMessageGlobal(string message)
 {
     using (var response = new PangyaBinaryWriter())
     {
         response.Write(new byte[] { 0x42, 0x00 });
         response.WritePStr(message);
         return(response.GetBytes());
     }
 }
Пример #13
0
        public void Notice(string message)
        {
            var response = new PangyaBinaryWriter(new MemoryStream());

            response.Write(new byte[] { 0x42, 0x00 });
            response.WritePStr("Aviso: " + message);
            SendToAll(response.GetBytes());
            Console.WriteLine("BroadCast enviado com sucesso");
        }
Пример #14
0
 public static byte[] ShowShopClose(string Nickname, uint UID)
 {
     using (var Response = new PangyaBinaryWriter())
     {
         Response.Write(new byte[] { 0xE4, 0x00 });
         Response.WriteUInt32(1);
         Response.WritePStr(Nickname);
         Response.Write(UID);
         return(Response.GetBytes());
     }
 }
Пример #15
0
 public static byte[] ShowChangeFriendSubNick(uint UID, string NickName)
 {
     using (var Response = new PangyaBinaryWriter())
     {
         Response.Write(new byte[] { 0x30, 0x00, 0x19, 0x01 });
         Response.Write(0);
         Response.Write(UID);
         Response.WritePStr(NickName);
         return(Response.GetBytes());
     }
 }
Пример #16
0
 public static byte[] ShowShopItemBuyResult(string NickName, uint ShopID, ShopItem itens)
 {
     using (var Response = new PangyaBinaryWriter())
     {
         Response.Write(new byte[] { 0xED, 0x00 });
         Response.WritePStr(NickName);
         Response.Write(ShopID);
         Response.WriteStruct(itens);
         return(Response.GetBytes());
     }
 }
Пример #17
0
        public void ServerMessage(string message)
        {
            var response = new PangyaBinaryWriter(new MemoryStream());

            response.Write(new byte[] { 0x43, 0x00 });
            response.WritePStr(message);

            SendToAll(response.GetBytes());

            Console.WriteLine("Mensagem enviada com sucesso");
        }
Пример #18
0
        public void HandleStaffSendNotice(string Nickname, string Msg)
        {
            var response = new PangyaBinaryWriter();

            try
            {
                if (Nickname.Length <= 0 || Msg.Length <= 0)
                {
                    return;
                }

                response.Write(new byte[] { 0x40, 0x00, 0x07 });
                response.WritePStr(Nickname);
                response.WritePStr(Msg);
                this.SendToAll(response.GetBytes());
            }
            finally
            {
                response.Dispose();
            }
        }
Пример #19
0
 public static byte[] ShowShopEnter(GPlayer PL)
 {
     using (var res = new PangyaBinaryWriter())
     {
         res.Write(new byte[] { 0xE6, 0x00 });
         res.WriteUInt32(1);
         res.WriteStr(PL.GetNickname, 22);
         res.WritePStr(PL.GameInfo.GameShop.Name);
         res.WriteUInt32(PL.GameInfo.GameShop.ShopOwnerID); // shop owner id
         res.WriteUInt32(PL.GameInfo.GameShop.ItemsCount);  // Number of items
         res.Write(PL.GameInfo.GameShop.GetData());
         return(res.GetBytes());
     }
 }
Пример #20
0
        public static byte[] ShowNameScore(string Nick, int Score, uint Pang)
        {
            var result = new PangyaBinaryWriter();

            result.Write(new byte[] { 0x40, 0x00 });
            result.WriteByte(0x11);
            result.WritePStr(Nick);
            result.WriteUInt16(0);
            result.WriteInt32(Score); //Score
            result.WriteUInt64(Pang); //Pangs
            result.WriteByte(0);

            return(result.GetBytes());
        }
Пример #21
0
 public static byte[] ShowFindFriend(bool IsExist, string NickName, uint UID)
 {
     using (var Response = new PangyaBinaryWriter())
     {
         Response.Write(new byte[] { 0x30, 0x00, 0x17, 0x01 });
         if (IsExist)
         {
             Response.Write(0);
             Response.WritePStr(NickName);
             Response.Write(UID);
         }
         else
         {
             Response.Write(2);
         }
         return(Response.GetBytes());
     }
 }
Пример #22
0
        public static byte[] ShowChangeNickName(int Code = 0, string nickname = "")
        {
            var response = new PangyaBinaryWriter();

            try
            {
                response.Write(new byte[] { 0x50, 0x00 });
                response.WriteInt32(Code);
                if (Code == 0)
                {
                    response.WritePStr(nickname);
                }
                return(response.GetBytes());
            }
            finally
            {
                response.Dispose();
            }
        }
        private void Handle()
        {
            bool guildNameDisponivel = new GuildRepository().GuildNameAvaliable(PacketResult.GuildName);

            var response = new PangyaBinaryWriter();

            response.Write(new byte[] { 0xB6, 0x01 });

            if (guildNameDisponivel)
            {
                response.Write(1);
                response.WritePStr(PacketResult.GuildName);
            }
            else
            {
                response.Write(54510);
            }

            Player.SendResponse(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);
        }
Пример #25
0
        protected override void OnAuthServerPacketReceive(AuthClient client, AuthPacket packet)
        {
            if (packet.ID != AuthPacketEnum.SERVER_KEEPALIVE)
            {
                WriteConsole.WriteLine("[SYNC_RECEIVED_PACKET]:  " + packet.ID);
            }
            switch (packet.ID)
            {
            case AuthPacketEnum.SERVER_KEEPALIVE:     //KeepAlive
            {
            }
            break;

            case AuthPacketEnum.SERVER_CONNECT:
            {
            }
            break;

            case AuthPacketEnum.SERVER_RELEASE_CHAT:
            {
                string GetNickName = packet.Message.PlayerNick;
                string GetMessage  = packet.Message.PlayerMessage;
                GameTools.PacketCreator.ChatText(GetNickName, GetMessage, true);
            }
            break;

            case AuthPacketEnum.RECEIVES_USER_UID:
                break;

            case AuthPacketEnum.SEND_DISCONNECT_PLAYER:
            {
                uint UID = packet.Message.ID;

                var player = GetPlayerByUID(UID);

                if (player != null)
                {
                    DisconnectPlayer(player);
                }
            }
            break;

            case AuthPacketEnum.SERVER_RELEASE_TICKET:
            {
                string GetNickName = packet.Message.GetNickName;
                string GetMessage  = packet.Message.GetMessage;
                using (var result = new PangyaBinaryWriter())
                {
                    result.Write(new byte[] { 0xC9, 0x00 });
                    result.WritePStr(GetNickName);
                    result.WritePStr(GetMessage);
                    SendToAll(result.GetBytes());
                }
            }
            break;

            case AuthPacketEnum.SERVER_RELEASE_BOXRANDOM:
            {
                string GetMessage = packet.Message.GetMessage;
                Notice(GetMessage);
            }
            break;

            case AuthPacketEnum.SERVER_RELEASE_NOTICE_GM:
            {
                string Nick    = packet.Message.GetNick;
                string message = packet.Message.mensagem;
                HandleStaffSendNotice(Nick, message);
            }
            break;

            case AuthPacketEnum.SERVER_RELEASE_NOTICE:
            {
                string message = packet.Message.mensagem;
                using (var result = new PangyaBinaryWriter())
                {
                    result.Write(new byte[] { 0x42, 0x00 });
                    result.WritePStr("Aviso: " + message);
                    SendToAll(result.GetBytes());
                }
            }
            break;

            case AuthPacketEnum.PLAYER_LOGIN_RESULT:
            {
                LoginResultEnum loginresult = packet.Message.Type;

                if (loginresult == LoginResultEnum.Error || loginresult == LoginResultEnum.Exception)
                {
                    WriteConsole.WriteLine("[CLIENT_ERROR]: Sorry", ConsoleColor.Red);
                    return;
                }
            }
            break;

            case AuthPacketEnum.SERVER_COMMAND:
                break;

            default:
                WriteConsole.WriteLine("[AUTH_PACKET]:  " + packet.ID);
                break;
            }
        }
        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;
            }
        }