Пример #1
0
        /// <summary>
        /// Size = 267 bytes
        /// </summary>
        /// <returns>login information</returns>
        public byte[] GetLoginInfo()
        {
            PangyaBinaryWriter Reply;

            Reply = new PangyaBinaryWriter();
            try
            {
                Reply.WriteUInt16(GameID);
                Reply.WriteStr(UserInfo.GetLogin, 22);
                Reply.WriteStr(UserInfo.GetNickname, 22);
                Reply.WriteStr(GuildInfo.Name, 17);
                Reply.WriteStr(GuildInfo.Image, 16);
                Reply.WriteUInt64(UserInfo.GetCapability);
                Reply.WriteUInt32(ConnectionID);
                Reply.WriteZero(12);
                Reply.WriteUInt64(GuildInfo.ID);
                Reply.WriteUInt16(UserInfo.GetSex);
                Reply.Write(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF });
                Reply.WriteZero(16);
                Reply.WriteZero(128);
                Reply.WriteUInt32(UserInfo.GetUID);
                return(Reply.GetBytes());
            }
            finally
            {
                Reply.Dispose();
            }
        }
Пример #2
0
 public byte[] GetGameInfo()
 {
     using (var Reply = new PangyaBinaryWriter())
     {
         Reply.WriteStr(UserInfo.GetNickname, 22);
         Reply.WriteStr(GuildInfo.Name, 17);                                                               //bytes 39
         Reply.WriteByte(GameInfo.GameSlot);                                                               //40 bytes
         Reply.WriteUInt32(UserInfo.Visible);                                                              //44 bytes
         Reply.WriteUInt32(Inventory.GetTitleTypeID());
         Reply.WriteUInt32(Inventory.GetCharTypeID());                                                     //52 bytes
         Reply.WriteStruct(Inventory.ItemDecoration);                                                      //72 bytes
         Reply.WriteByte(GameInfo.Role);                                                                   //77 bytes
         Reply.WriteByte(Compare.IfCompare <byte>(GameInfo.GameReady, 0x02, 0x00));                        //78 bytes
         Reply.WriteByte(UserInfo.GetLevel);                                                               // 79 bytes == GetLevel
         Reply.WriteByte(0);                                                                               // 80 bytes
         Reply.WriteByte(0x0A);                                                                            // 81 bytes
         Reply.WriteUInt32(GuildInfo.ID);                                                                  // 85 bytes
         Reply.WriteStr(Compare.IfCompare(GuildInfo.Image.Length <= 0, "guildmark", GuildInfo.Image), 12); //94 bytes
         Reply.WriteUInt32(UserInfo.GetUID);                                                               //101 bytes
         Reply.Write(GameInfo.Action.ToArray());                                                           //123 bytes
         Reply.WriteUInt32(0);                                                                             //ID Shop//127 bytes
         Reply.WriteStr("Shop Name", 35);                                                                  //158 bytes
         Reply.WriteZero(33);                                                                              //191 bytes
         Reply.WriteUInt32(Inventory.GetMascotTypeID());                                                   //195 bytes
         Reply.WriteByte(Compare.IfCompare <byte>(Inventory.IsExist(436207618), 0x1, 0x0));                // Pang Mastery// 196 bytes
         Reply.WriteByte(Compare.IfCompare <byte>(Inventory.IsExist(436207621), 0x1, 0x0));                // Nitro Pang Mastery//197 bytes
         Reply.WriteStr(GetSubLogin, 18);
         Reply.WriteZero(103);                                                                             //329 bytes
         Reply.Write(0);                                                                                   //333 bytes = 0x1400006C
         Reply.Write(0);                                                                                   //337 bytes = 0x42000000
         var Getbytes = Reply.GetBytes();
         return(Getbytes);
     }
 }
Пример #3
0
        /// <summary>
        /// Ref Packet AA 00
        /// </summary>
        /// <param name="Lists"></param>
        /// <param name="Pangs"></param>
        /// <param name="Cookies"></param>
        /// <returns></returns>
        public static byte[] ShowBoxNewItem(List <object> Lists, uint Pangs, uint Cookies)
        {
            var result = new PangyaBinaryWriter();

            try
            {
                result.Write(new byte[] { 0xAA, 0x00 });
                result.WriteUInt16((ushort)Lists.Count);
                foreach (var APoint in Lists)
                {
                    result.WriteUInt32(((ItemData)APoint).TypeID);
                    result.WriteUInt32(((ItemData)APoint).ItemIndex);
                    result.WriteZero(3);
                    result.WriteUInt16((UInt16)((ItemData)APoint).ItemQuantity);
                    result.WriteZero(25);
                }
                result.WriteUInt64(Pangs);
                result.WriteUInt64(Cookies);
                return(result.GetBytes());
            }
            finally
            {
                result.Dispose();
            }
        }
Пример #4
0
        public byte[] GetLobbyInfo()
        {
            PangyaBinaryWriter Reply;

            Reply = new PangyaBinaryWriter();
            try
            {
                Reply.WriteUInt32(UserInfo.GetUID);
                Reply.WriteUInt32(ConnectionID);
                Reply.WriteUInt16(GameID);                     // Room Number
                Reply.WriteStr(UserInfo.GetNickname, 22);
                Reply.WriteByte(UserInfo.UserStatistic.Level); // Level
                Reply.WriteUInt32(UserInfo.Visible);           // GM
                Reply.WriteUInt32(Inventory.GetTitleTypeID()); //964689929); // Title TypeID
                Reply.Write(1000);                             // Unknown
                Reply.WriteByte(UserInfo.GetSex);              // Add $10 for wings  + $10 + $20
                Reply.WriteUInt32(GuildInfo.ID);               // Guild ID
                Reply.WriteStr(GuildInfo.Image, 12);           // Guild Images 9 Length
                Reply.WriteByte(0);                            // IS VIP ?
                Reply.WriteZero(6);
                Reply.WriteStr(GetSubLogin, 18);
                Reply.WriteZero(109);
                return(Reply.GetBytes());
            }
            finally
            {
                Reply.Dispose();
            }
        }
Пример #5
0
        public void SendGuildData()
        {
            PangyaBinaryWriter Packet;


            Packet = new PangyaBinaryWriter();
            try
            {
                Packet.Write(new byte[] { 0xBF, 0x01 });
                Packet.WriteUInt32(1);
                Packet.WriteUInt32(GuildInfo.ID); // Guild ID
                Packet.WriteStr(GuildInfo.Name, 17);
                Packet.WriteZero(9);
                Packet.WriteUInt32(GuildInfo.TotalMember);
                Packet.WriteStr(GuildInfo.Image, 9);
                Packet.WriteZero(3);
                Packet.WriteStr(GuildInfo.Notice, 0x65);
                Packet.WriteStr(GuildInfo.Introducing, 101);
                Packet.WriteUInt32(GuildInfo.Position);
                Packet.WriteUInt32(GuildInfo.LeaderUID);
                Packet.WriteStr(GuildInfo.LeaderNickname, 22);
                Send(Packet.GetBytes());
            }
            finally
            {
                Packet.Dispose();
            }
        }
        public void PlayerShowMailPopUp(GPlayer PL)
        {
            var _db = new PangyaEntities();
            PangyaBinaryWriter Reply;

            Reply = new PangyaBinaryWriter();

            var QueryList = _db.ProcGetMail((int)PL.GetUID, 1, 5, 1).ToList();

            Reply.Write(new byte[] { 0x10, 0x02 });
            Reply.Write(0);
            Reply.Write(QueryList.Count);//count
            foreach (var mail in QueryList)
            {
                var type = Convert.ToUInt32(mail.SETTYPEID > 0 ? mail.SETTYPEID : mail.TYPEID);

                Reply.WriteInt32(mail.Mail_Index);      //Mail_Index
                Reply.WriteStr(mail.Sender, 10);        //Sender
                Reply.WriteZero(123);
                Reply.Write(mail.Mail_Item_Count ?? 0); //Mail_Total COunt
                Reply.Write(uint.MaxValue);             //FF FF FF FF
                Reply.WriteUInt32(type);                //typeID
                Reply.Write((byte)0);                   //time
                Reply.WriteInt32(mail.QTY ?? 0);        //quantidade
                Reply.WriteZero(20);
                Reply.WriteUInt32(uint.MaxValue);       //FF FF FF FF
                Reply.WriteUInt32(0);
                Reply.WriteStr(IsUCCNull(mail.UCC_UNIQUE), 14);
            }
            PL.SendResponse(Reply.GetBytes());
        }
Пример #7
0
 public byte[] GetItems()
 {
     using (var result = new PangyaBinaryWriter())
     {
         result.Write(ItemIndex);
         result.Write(ItemTypeID);
         result.Write(ItemHourLeft);
         if ((TITEMGROUP)ItemGroup == TITEMGROUP.ITEM_TYPE_CLUB)
         {
             result.Write(ItemC0Slot);
             result.Write(ItemC1Slot);
             result.Write(ItemC2Slot);
             result.Write(ItemC3Slot);
             result.Write(ItemC4Slot);//22
             result.Write((byte)0);
             result.Write(ItemFlag ?? 0);
             result.Write(UnixTimeConvert(ItemRegDate)); //UNIXTIME campo RegDate
             result.Write(UnixTimeConvert(ItemEndDate)); //UNIXTIME campo EndDate
             result.Write((byte)2);
             result.WriteStr(IsUCCNull(ItemUCCName), 16);
             result.WriteZero(25);
             result.WriteStr(IsUCCNull(ItemUCCUnique), 9);//chave do SD
             result.Write(ItemUCCStatus ?? 0);
             result.Write(ItemUCCCopyCount ?? 0);
             result.WriteStr(IsUCCNull(ItemUCCDrawer), 16);
             result.WriteZero(70);                                            //70
             result.Write(Convert.ToUInt32(ItemClubPoint ?? 0));              //74
             result.Write(Convert.ToUInt32(ItemClubSlotCancelledCount ?? 0)); // 78
             result.Write((long)ItemClubWorkCount);                           //86
         }
         else
         {
             result.Write(ItemC0);
             result.Write(ItemC1);
             result.Write(ItemC2);
             result.Write(ItemC3);
             result.Write(ItemC4);
             result.Write((byte)0);
             result.Write(ItemFlag ?? 0);
             result.Write(UnixTimeConvert(ItemRegDate)); //UNIXTIME campo RegDate
             result.Write(UnixTimeConvert(ItemEndDate)); //UNIXTIME campo EndDate
             result.Write((byte)2);
             result.WriteStr(IsUCCNull(ItemUCCName), 16);
             result.WriteZero(25);
             result.WriteStr(IsUCCNull(ItemUCCUnique), 9);//chave do SD
             result.Write(ItemUCCStatus ?? 0);
             result.Write(ItemUCCCopyCount ?? 0);
             result.WriteStr(IsUCCNull(ItemUCCDrawer), 16);
             result.WriteZero(86);
         }
         return(result.GetBytes());
     }
 }
Пример #8
0
        public byte[] GetCardInfo()
        {
            PangyaBinaryWriter Reply;

            Reply = new PangyaBinaryWriter();
            Reply.WriteUInt32(CardIndex);
            Reply.WriteUInt32(CardTypeID);
            Reply.WriteZero(12);
            Reply.WriteUInt32(CardQuantity);
            Reply.WriteZero(32);
            Reply.WriteUInt16(1);
            return(Reply.GetBytes());
        }
Пример #9
0
 public static byte[] ShowUserGift(int UID, string Username, string Nickname)
 {
     using (var response = new PangyaBinaryWriter())
     {
         response.Write(new byte[] { 0xA1, 0x00, 0x00 });
         response.WriteInt32(UID);
         response.WriteStr(Username, 22);
         response.WriteStr(Nickname, 22);
         response.WriteZero(93);
         response.WriteStr(Username + "@NT", 19);
         response.WriteZero(109);
         response.WriteInt32(UID);
         return(response.GetBytes());
     }
 }
Пример #10
0
        public override byte[] GameInformation()
        {
            var response = new PangyaBinaryWriter();

            response.WriteStr(fGameData.Name, 64); //ok
            response.Write(fGameData.Password.Length > 0 ? false : true);
            response.Write(Started == true ? (byte)0 : (byte)1);
            response.Write(Await);//Orange
            response.Write(fGameData.MaxPlayer);
            response.Write((byte)Players.Count);
            response.Write(GameKey, 17);//ultimo byte é zero
            response.Write(fGameData.Time30S);
            response.Write(fGameData.HoleTotal);
            response.Write((byte)GameType);//GameType
            response.Write((ushort)ID);
            response.Write(fGameData.Mode);
            response.Write(fGameData.Map);
            response.Write(fGameData.VSTime);
            response.Write(fGameData.GameTime);
            response.Write(0);
            response.Write(Idle);
            response.Write(fGameData.GMEvent);              //GM Event 0(false), ON 1(true)
            response.WriteZero(76);                         //GUILD DATA
            response.Write(100);                            // rate pang
            response.Write(100);                            // rate chuva
            response.Write(Owner);
            response.Write((byte)0xFF);                     //is practice
            response.Write(fGameData.Artifact);             //artefato
            response.Write(fGameData.NaturalMode);          //natural mode
            response.Write(fGameData.GPTypeID);             //Grand Prix 1
            response.Write(fGameData.GPTypeIDA);            //Grand Prix 2
            response.Write(fGameData.GPTime);               //Grand Time
            response.Write(Iff <uint>(fGameData.GP, 1, 0)); // grand prix active
            return(response.GetBytes());
        }
Пример #11
0
 public byte[] GetGameInfo()
 {
     using (var packet = new PangyaBinaryWriter())
     {
         packet.Write(new byte[] { 0x86, 0x00 });
         packet.Write(Started == true ? 0 : 1);
         packet.Write(fGameData.HoleTotal);
         if (fGameData.VSTime > 0)
         {
             packet.Write(fGameData.VSTime);
         }
         else
         {
             packet.Write(fGameData.GameTime);//fGameData.VSTime
         }
         packet.Write((byte)fGameData.Map);
         packet.Write((byte)GameType);
         packet.WriteByte((byte)fGameData.Mode);
         packet.Write(Trophy);
         packet.Write(0);
         packet.Write(0);
         packet.WriteZero(6);      //unknown
         packet.WriteUInt32(1000); //1000
         return(packet.GetBytes());
     }
 }
Пример #12
0
 public byte[] GetMascotInfo()
 {
     using (var Packet = new PangyaBinaryWriter())
     {
         Packet.WriteUInt32(MascotIndex);
         Packet.WriteUInt32(MascotTypeID);
         Packet.WriteZero(5);
         Packet.WriteStr(MascotMessage, 16);
         Packet.WriteZero(14);
         Packet.WriteUInt16(MascotIsValid);
         Packet.WriteTime((MascotEndDate));
         Packet.WriteByte(0);
         var result = Packet.GetBytes();
         return(result);
     }
 }
Пример #13
0
        public byte[] CreateChar(PlayerCharacterData CharData, byte[] CardMap)
        {
            PangyaBinaryWriter Packet;

            Packet = new PangyaBinaryWriter();
            try
            {
                Packet.Write(CharData.TypeID);
                Packet.Write(CharData.Index);
                Packet.Write(CharData.HairColour);
                Packet.Write(CharData.GiftFlag);
                for (var Index = 0; Index < 24; Index++)
                {
                    Packet.Write(CharData.EquipTypeID[Index]);
                }
                for (var Index = 0; Index < 24; Index++)
                {
                    Packet.Write(CharData.EquipIndex[Index]);
                }
                Packet.WriteZero(216);
                Packet.Write(CharData.AuxPart);  // anel da esquerda
                Packet.Write(CharData.AuxPart2); // anel da direita
                Packet.Write(CharData.AuxPart3);
                Packet.Write(CharData.AuxPart4);
                Packet.Write(CharData.AuxPart5);
                Packet.WriteUInt32(CharData.FCutinIndex); // CUTIN IDX
                Packet.WriteZero(12);
                Packet.WriteByte(CharData.Power);
                Packet.WriteByte(CharData.Control);
                Packet.WriteByte(CharData.Impact);
                Packet.WriteByte(CharData.Spin);
                Packet.WriteByte(CharData.Curve);
                Packet.WriteInt32(CharData.MasteryPoint);
                Packet.Write(CardMap, 40);
                Packet.WriteUInt32(0);
                Packet.WriteUInt32(0);
                return(Packet.GetBytes());
            }
            finally
            {
                Packet.Dispose();
            }
        }
Пример #14
0
        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();
            }
        }
Пример #15
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");
        }
Пример #16
0
        internal byte[] CardEquipInfo()
        {
            PangyaBinaryWriter result;

            result = new PangyaBinaryWriter();
            var P = IffEntry.Card.GetSPCL(CARD_TYPEID);

            result.WriteUInt32(0);
            result.WriteUInt32(CARD_TYPEID);
            result.WriteUInt32(CHAR_TYPEID);
            result.WriteUInt32(CID);
            if (P != null)
            {
                result.WriteUInt32(P.First().Key);
                result.WriteUInt32(P.First().Value);
            }
            else
            {
                result.WriteUInt32(0);
                result.WriteUInt32(0);
            }
            result.WriteUInt32(SLOT);
            if (CID == 0)
            {
                result.WriteZero(0x10);
                result.WriteZero(0x10);
            }
            else
            {
                result.Write(GetFixTime(REGDATE),0x10);
                result.Write(GetFixTime(ENDDATE),0x10);
            }
            result.WriteUInt32(GetType(CARD_TYPEID));
            result.WriteByte(1);
            return(result.GetBytes());
        }
Пример #17
0
        public void PlayerSendAchievement(GPlayer player, List <TAchievement>
                                          Achievements, List <TAchievementQuest> AchievementQuests, Dictionary <uint, TAchievementCounter> AchievemetCounters)
        {
            PangyaBinaryWriter Packet     = new PangyaBinaryWriter();
            PangyaBinaryWriter Packet2    = new PangyaBinaryWriter();
            UInt32             Count      = 0;
            UInt32             CounterQty = 0;

            Packet.Write(new byte[] { 0x2D, 0x02 });
            Packet.WriteUInt32(0);
            Packet.WriteInt32(player.Achievements.Count);
            Packet.WriteInt32(player.Achievements.Count);
            foreach (var Achievement in Achievements)
            {
                Packet.WriteUInt32(Achievement.TypeID);
                Packet.WriteUInt32(Achievement.ID);
                foreach (var Quest in AchievementQuests)
                {
                    if (Achievement.ID == Quest.AchievementIndex)
                    {
                        Count += 1;

                        if (AchievemetCounters.TryGetValue(Quest.CounterIndex, out TAchievementCounter Counter))
                        {
                            CounterQty = Counter.Quantity;
                        }
                        else
                        {
                            CounterQty = 0;
                        }
                        Packet2.WriteUInt32(Quest.AchievementTypeID);
                        Packet2.WriteUInt32(CounterQty);
                        Packet2.WriteUInt32(Quest.SuccessDate);
                    }
                }
            }
            Packet.WriteUInt32(Count);
            Packet.WriteZero(8);
            Packet.Write(Packet2.GetBytes());

            player.SendResponse(Packet.GetBytes());

            player.SendResponse(new byte[] { 0x2C, 0x02, 0x00, 0x00, 0x00, 0x00 });

            Packet.Dispose();
            Packet2.Dispose();
        }
Пример #18
0
 byte[] MessangerServerList()
 {
     using (var result = new PangyaBinaryWriter())
     {
         result.Write(new byte[] { 0x09, 0x00 });
         result.WriteByte((byte)_db.ProcGetMessengerServer().Count());//count servers
         foreach (var server in _db.ProcGetMessengerServer())
         {
             result.WriteStr(server.Name, 40);
             result.WriteInt32(server.ServerID);
             result.WriteInt32(server.MaxUser);
             result.WriteInt32(server.UsersOnline);
             result.WriteStr(server.IP, 18);
             result.WriteInt32(server.Port);
             result.WriteInt32(4096);
             result.WriteZero(14);
         }
         return(result.GetBytes());
     }
 }
Пример #19
0
 public byte[] GetExpirationNotice()
 {
     using (var Packet = new PangyaBinaryWriter())
     {
         if (CaddieType == 2 && CaddieDay == 0 || CaddieDay >= 65435)
         {
             Packet.WriteUInt32(1);
             Packet.WriteUInt32(CaddieIdx);
             Packet.WriteUInt32(CaddieTypeId);
             Packet.WriteUInt32(CaddieSkin);
             Packet.WriteByte(CaddieLevel);
             Packet.WriteUInt32(CaddieExp);
             Packet.WriteByte(CaddieType);
             Packet.WriteUInt16(CaddieDay);
             Packet.WriteUInt16(CaddieSkinDay);
             Packet.WriteZero(0);
             Packet.WriteUInt16(CaddieAutoPay);
         }
         return(Packet.GetBytes());
     }
 }
Пример #20
0
 public static byte[] ShowTutorialPlayer(ushort Code, uint MissionID, bool IsLogin = true)
 {
     using (var Response = new PangyaBinaryWriter())
     {
         Response.Write(new byte[] { 0x1F, 0x01 });
         if (IsLogin)
         {
             Response.WriteUInt16(Code);
             Response.Write(MissionID);
             Response.WriteByte(0);
             Response.WriteUInt32(Code);
             Response.WriteZero(8);
         }
         else
         {
             Response.WriteByte(Code);
             Response.Write((byte)1);
             Response.Write(MissionID);
         }
         return(Response.GetBytes());
     }
 }
Пример #21
0
        public byte[] GetBuildServerInfo()
        {
            var _db        = new PangyaEntities();
            var GameServer = _db.ProcGetGameServer().ToList();

            using (var Response = new PangyaBinaryWriter())
            {
                Response.Write(new byte[] { 0x9F, 0x00 });
                if (GameServer.Count > 0)
                {
                    Response.WriteByte(GameServer.Count);
                    foreach (var server in GameServer)
                    {
                        Response.WriteStr(server.Name, 40);
                        Response.WriteUInt32((uint)server.ServerID);    //server UID
                        Response.WriteUInt32((uint)server.MaxUser);     //suporte maximo de jogadores no servidor simultaneamente(minimo é 1000)
                        Response.WriteUInt32((uint)server.UsersOnline); //Total de jogadores no servidor atualmente ou simultaneamente(limitador)
                        Response.WriteStr(server.IP, 18);
                        Response.WriteUInt32((uint)server.Port);
                        Response.WriteUInt32((uint)server.Property); //manto 16
                        Response.WriteUInt32(0);                     //Angelic Number Count
                        Response.WriteUInt16((ushort)server.ImgEvent);
                        Response.WriteUInt16(126);
                        Response.WriteUInt16(160);
                        Response.WriteUInt16(100);//rate pang?
                        Response.WriteUInt16(server.ImgNo);
                    }
                    Response.Write(Build(false));
                }
                else
                {
                    Response.WriteZero(4);
                }
                return(Response.GetBytes());
            }
        }
Пример #22
0
 public static byte[] ShowListFriends(List <Player> players)
 {
     using (var Response = new PangyaBinaryWriter())
     {
         Response.Write(new byte[] { 0x30, 0x00, 0x02, 0x01, 0x01 });
         Response.Write((ushort)players.Count); //count
         Response.Write((ushort)players.Count); //count
         foreach (MPlayer player in players)
         {
             Response.WriteStr(player.GetNickname, 22);
             Response.WriteStr("FRIEND", 22);//out apelido
             Response.Write(player.GetUID);
             Response.Write(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF });
             Response.Write(0);
             Response.Write(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF });
             Response.WriteZero(12);
             Response.Write(new byte[] { 0xFF, 0xFF, 0xe3, 0x00, 0x00, 0x00 }); //troca por => 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
             Response.Write(player.ServerInfo.GameServerID);                    // porta que player se conectou
             Response.WriteStr(player.ServerInfo.LobbyName, 64);
             Response.Write(new byte[] { 0x05, 0xFF, 0x0E, 0x0C, 0x01 });
         }
         return(Response.GetBytes());
     }
 }
        public byte[] GetInfoData()
        {
            PangyaBinaryWriter result;

            result = new PangyaBinaryWriter();
            result.WriteByte(IfCompare <Byte>(Types <= 0, 0x2, Types));
            result.WriteUInt32(TypeID);
            result.WriteUInt32(Index);
            result.WriteUInt32(IfCompare <UInt32>(DayEnd > DateTime.Now, 1, 0));
            // ## if the item has a period time
            if ((DayEnd > DateTime.Now))
            {
                result.WriteUInt32((uint)UnixTimeConvert(DayStart));
                result.WriteUInt32((uint)UnixTimeConvert(DayEnd));
                result.WriteUInt32((uint)(DayEnd - DayStart).TotalDays);
            }
            else
            {
                result.WriteUInt32(PreviousQuan);
                result.WriteUInt32(NewQuan);
                result.WriteUInt32(NewQuan - PreviousQuan);
            }
            if ((Types == 0xC9))
            {
                result.WriteUInt16(C0_SLOT);
                result.WriteUInt16(C1_SLOT);
                result.WriteUInt16(C2_SLOT);
                result.WriteUInt16(C3_SLOT);
                result.WriteUInt16(C4_SLOT);
            }
            else if ((DayEnd > DayStart))
            {
                result.WriteZero(0x8);
                result.WriteUInt16((ushort)(DayEnd - DayStart).TotalDays);
            }
            else
            {
                result.WriteZero(0xA);
            }
            result.WriteUInt16((ushort)UCC.Length);
            result.WriteStr(UCC, 0x8);
            if (UCC.Length >= 8)
            {
                result.WriteUInt32(UCCStatus);
                result.WriteUInt16(UCCCopyCount);
                result.WriteZero(0x7);
            }
            else if ((Types == 0xCB))
            {
                result.WriteUInt32(CardTypeID);
                result.WriteByte(CharSlot);
            }
            else if ((Types == 0xCC))
            {
                result.WriteUInt32(0);
                result.WriteByte(0);
                result.WriteUInt16(C0_SLOT);
                result.WriteUInt16(C1_SLOT);
                result.WriteUInt16(C2_SLOT);
                result.WriteUInt16(C3_SLOT);
                result.WriteUInt16(C4_SLOT);
                result.WriteUInt32(ClubPoint);
                result.WriteByte(IfCompare <Byte>(WorkshopCount > 0, 0, 0xFF));
                result.WriteUInt32(WorkshopCount);
                result.WriteUInt32(CancelledCount);
            }
            else
            {
                result.WriteUInt32(0);
                result.WriteByte(0);
            }
            return(result.GetBytes());
        }
Пример #24
0
        public void PlayerChangeEquipment(GPlayer player, Packet Reader)
        {
            PangyaBinaryWriter Reply;
            bool Status;

            if (!Reader.ReadByte(out byte action))
            {
                return;
            }

            Status = false;
            Reply  = new PangyaBinaryWriter();
            try
            {
                Reply.Write(new byte[] { 0x6B, 0x00, 0x04 });
                Reply.WriteByte(action);
                switch (action)
                {
                case 0:      // ## save char equip
                {
                    var invchar = (CharacterData)Reader.Read(new CharacterData());

                    var character = player.Inventory.GetCharacter(invchar.TypeID);
                    if (character == null)
                    {
                        WriteConsole.WriteLine("[PLAYER_CHANGE_EQUIPCHAR]: Error Ao Tentar Setar EquipChar", ConsoleColor.Red);
                        player.Close();
                        return;
                    }
                    character.EquipTypeID = invchar.EquipTypeID;
                    character.EquipIndex  = invchar.EquipIndex;
                    character.AuxPart     = invchar.AuxPart;
                    character.AuxPart2    = invchar.AuxPart2;
                    character.AuxPart3    = invchar.AuxPart3;
                    character.AuxPart4    = invchar.AuxPart4;
                    character.AuxPart5    = invchar.AuxPart5;
                    character.FCutinIndex = invchar.FCutinIndex;
                    character.Power       = invchar.Power;
                    character.Control     = invchar.Control;
                    character.Impact      = invchar.Impact;
                    character.Spin        = invchar.Spin;
                    character.Curve       = invchar.Curve;
                    player.Inventory.ItemCharacter.UpdateCharacter(character);
                    Status = true;
                    Reply.Write(player.Inventory.GetCharData(invchar.Index));
                }
                break;

                case 1:      // ## change caddie
                {
                    Reader.ReadUInt32(out uint CaddiIndex);
                    if (!player.Inventory.SetCaddieIndex(CaddiIndex))
                    {
                        WriteConsole.WriteLine("[PLAYER_CHANGE_CADDIE]: Error Ao Tentar Setar CaddieIndex", ConsoleColor.Red);
                        player.Close();
                    }
                    Status = true;
                    Reply.WriteUInt32(CaddiIndex);
                }
                break;

                case 2:     // ## item for play
                {
                    ItemSlotData ItemSlots;

                    ItemSlots = (ItemSlotData)Reader.Read(new ItemSlotData());
                    player.Inventory.ItemSlot.SetItemSlot(ItemSlots);
                    Status = true;
                    Reply.Write(player.Inventory.ItemSlot.GetItemSlot());
                }
                break;

                case 3:     // ## Change Ball And Club
                {
                    Reader.ReadUInt32(out uint BallTypeID);
                    Reader.ReadUInt32(out uint ClubIndex);

                    if (!player.Inventory.SetGolfEQP(BallTypeID, ClubIndex))
                    {
                        WriteConsole.WriteLine("[PLAYER_CHANGE_EQUIP]: Error Ao Tentar Setar GolfEquip", ConsoleColor.Red);
                        player.Close();
                    }
                    Status = true;
                    Reply.Write(player.Inventory.GetGolfEQP());
                }
                break;

                case 4:     // ## Change Decoration
                {
                    var Decoration = (ItemDecorationData)Reader.Read(new ItemDecorationData());

                    if (!player.Inventory.SetDecoration(Decoration.BackGroundTypeID, Decoration.FrameTypeID, Decoration.StickerTypeID, Decoration.SlotTypeID, Decoration.UnknownTypeID, Decoration.TitleTypeID))
                    {
                        WriteConsole.WriteLine("[PLAYER_CHANGE_DEC]: Error Ao Tentar Setar Decoration", ConsoleColor.Red);
                        player.Close();
                        return;
                    }
                    Status = true;
                    Reply.Write(player.Inventory.GetDecorationData());
                }
                break;

                case 5:      // ## change char
                {
                    Reader.ReadUInt32(out uint CharacterIndex);

                    if (!player.Inventory.SetCharIndex(CharacterIndex))
                    {
                        WriteConsole.WriteLine("[PLAYER_CHANGE_CHAR]: Error Ao Tentar Setar CharIndex", ConsoleColor.Red);
                        player.Close();
                    }
                    Status = true;
                    Reply.WriteUInt32(CharacterIndex);
                }
                break;

                case 8:     // ## change mascot
                {
                    Reader.ReadUInt32(out uint MascotIndex);

                    if (!player.Inventory.SetMascotIndex(MascotIndex))
                    {
                        WriteConsole.WriteLine("[PLAYER_CHANGE_MASCOT]: Error Ao Tentar Setar MascotIndex");
                        player.Close();
                        return;
                    }
                    Status = true;

                    Reply.Write(player.Inventory.GetMascotData());
                }
                break;

                case 9:    // #Cutin
                {
                    var CharacterIndex = Reader.ReadUInt32();
                    var CutinIndex     = Reader.ReadUInt32();
                    if (!player.Inventory.SetCutInIndex(CharacterIndex, CutinIndex))
                    {
                        WriteConsole.WriteLine("[PLAYER_CHANGE_CHARCUTIN]: Error Ao Tentar Setar Cutin", ConsoleColor.Red);
                        player.Close();
                    }
                    Status = true;
                    Reply.Write(CharacterIndex);
                    Reply.Write(CutinIndex);
                    Reply.WriteZero(12);        //12 byte vazios
                }
                break;

                default:
                    WriteConsole.WriteLine("Action_Unkown: {0}, Array: {1}", new object[] { action, BitConverter.ToString(Reader.GetRemainingData) });
                    break;
                }
                if (Status)
                {
                    player.SendResponse(Reply.GetBytes());
                }
            }
            catch
            {
            }
        }
Пример #25
0
        public void PlayerGetMailList(GPlayer PL, Packet packet, bool IsDel = false)
        {
            var _db = new PangyaEntities();
            PangyaBinaryWriter Reply;


            if (!packet.ReadInt32(out int PageSelect))
            {
                return;
            }
            Reply = new PangyaBinaryWriter();


            var QueryList = _db.ProcGetMail((int)PL.GetUID, PageSelect, 20, 2).ToList();

            try
            {
                if (IsDel)
                {
                    Reply.Write(new byte[] { 0x15, 0x02 });
                }
                else
                {
                    Reply.Write(new byte[] { 0x11, 0x02 });
                }
                Reply.Write(0);
                Reply.Write(PageSelect);//count
                if (QueryList.Count > 1)
                {
                    Reply.Write(QueryList.FirstOrDefault().PAGE_TOTAL ?? 0);
                }
                else
                {
                    Reply.Write(1);
                }
                Reply.Write(QueryList.Count);
                foreach (var mail in QueryList)
                {
                    var type = Convert.ToUInt32(mail.SETTYPEID > 0 ? mail.SETTYPEID : mail.TYPEID);
                    Reply.Write(mail.Mail_Index);                   //Mail_Index
                    Reply.WriteStr(mail.Sender, 16);                //Sender
                    Reply.WriteZero(116);
                    Reply.Write((byte)mail.IsRead);                 //)
                    Reply.Write(mail.Mail_Item_Count ?? 0);         //Mail_Total COunt
                    Reply.Write(4294967295);
                    Reply.Write(type);                              //typeID
                    Reply.Write(Convert.ToByte(mail.IsTimer ?? 0)); //time
                    Reply.Write(mail.QTY ?? 0);
                    Reply.Write(Convert.ToUInt32(mail.DAY ?? 0));
                    Reply.WriteZero(16);
                    Reply.Write(4294967295);
                    Reply.Write(0);
                    Reply.WriteStr(IsUCCNull(mail.UCC_UNIQUE), 14);
                }
                PL.SendResponse(Reply.GetBytes());
            }
            catch
            {
                PL.Close();
            }
        }