Пример #1
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());
        }
Пример #2
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();
            }
        }
Пример #3
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();
            }
        }
        public byte[] GetTran()
        {
            PangyaBinaryWriter    result;
            PlayerTransactionData Tran;

            result = new PangyaBinaryWriter();

            result.Write(new byte[] { 0x16, 0x02 });
            result.WriteInt32((new Random()).Next());//number random
            result.WriteUInt32(this.Count);
            foreach (PlayerTransactionData TranObj in this)
            {
                if (!(TranObj is PlayerTransactionData))
                {
                    continue;
                }
                Tran = TranObj;
                result.Write(Tran.GetInfoData());
            }
            this.Clear();
            return(result.GetBytes());
        }
Пример #5
0
 byte[] GameServerList()
 {
     using (var result = new PangyaBinaryWriter())
     {
         result.Write(new byte[] { 0x02, 0x00 });
         result.WriteByte((byte)_db.ProcGetGameServer().Count());//count servers
         foreach (var data in _db.ProcGetGameServer())
         {
             result.WriteStr(data.Name, 40);
             result.WriteInt32(data.ServerID); //serverID
             result.WriteInt32(data.MaxUser);  //max user
             result.WriteInt32(data.UsersOnline);
             result.WriteStr(data.IP, 18);
             result.WriteInt32(data.Port);              //port
             result.WriteInt32(data.Property);
             result.WriteUInt32(0);                     // Angelic Number
             result.WriteUInt16((ushort)data.ImgEvent); //Flag event
             result.WriteUInt16(0);
             result.WriteInt32(100);
             result.WriteUInt16(data.ImgNo);//Icon Server
         }
         return(result.GetBytes());
     }
 }
Пример #6
0
        public static void PlayNormalPapel(GPlayer player)
        {
            var                rnd = new Random();
            byte               Count, IQuantity;
            uint               Stuff;
            AddData            ItemData;
            PangyaBinaryWriter packet;


            packet = new PangyaBinaryWriter();
            try
            {
                ItemData = new AddData();
                Stuff    = 0;
                foreach (var Supply in RandomWeight.FSupplies)
                {
                    ItemData = player.Inventory.Remove(Supply.TypeId, Supply.DelQuantity);
                    if (ItemData.Status)
                    {
                        Stuff = ItemData.ItemIndex;
                        break;
                    }
                }

                if (!ItemData.Status)
                {
                    if (!player.RemovePang(900))
                    {
                        player.SendResponse(new byte[] { 0x1B, 0x02, 0x7A, 0x73, 0x28, 0x00 });
                        return;
                    }
                    Stuff = 0;
                }

                if (rnd.Next(0, 21) + 1 >= 20)
                {
                    // 3 4 5
                    Count = (byte)rnd.Next(3, 6);
                }
                else
                {
                    Count = (byte)rnd.Next(2, 4);
                }
                // 2 3
                packet.WriteUInt32(Stuff);
                packet.WriteUInt32(Count);
                for (var I = 1; I <= Count; I++)
                {
                    var Reward = RandomWeight.GetItems();

                    if (Reward == null)
                    {
                        player.SendResponse(new byte[] { 0x6C, 0x02, 0x7A, 0x73, 0x28, 0x00 });
                        WriteConsole.WriteLine($" Error");
                        break;
                    }

                    if (new Random(0x64).Next() <= 20)
                    {
                        var QNT = rnd.Next((int)Reward.MaxQuantity) + 1;
                        IQuantity = (byte)QNT;
                    }
                    else
                    {
                        IQuantity = 1;
                    }
                    var Item = new AddItem
                    {
                        ItemIffId   = Reward.TypeId,
                        Quantity    = IQuantity,
                        Transaction = true,
                        Day         = 0
                    };
                    ItemData = player.AddItem(Item);

                    packet.WriteInt32(rnd.Next(3));
                    packet.WriteUInt32(ItemData.ItemTypeID);
                    packet.WriteUInt32(ItemData.ItemIndex);
                    packet.WriteUInt32(IQuantity);
                    packet.WriteUInt32(Reward.RareType);
                }
                packet.WriteUInt64(player.GetPang);
                packet.WriteUInt64(player.GetCookie);

                player.SendTransaction();

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

                RandomWeight.Restore();

                //{ **Achievement * * }
                //{ **Add Papel Counter ** }
                //player.AddAchivementQuest(1816133706, 1);
                //player.SendAchievement();
            }
            finally
            {
                packet.Dispose();
            }
        }
Пример #7
0
        public static void PlayBigPapel(GPlayer player)
        {
            var                rnd = new Random();
            byte               Count, IQuantity;
            AddData            ItemData;
            PangyaBinaryWriter packet;


            packet = new PangyaBinaryWriter();
            try
            {
                ItemData = new AddData();
                if (!player.RemovePang(10000))
                {
                    player.SendResponse(new byte[] { 0x6C, 0x02, 0x7A, 0x73, 0x28, 0x00 });
                    WriteConsole.WriteLine($" {player.GetLogin} esta sem pangs");
                    return;
                }

                player.SendPang();


                Count = (byte)rnd.Next(4, 10);

                packet.WriteUInt32(Count);

                for (var I = 1; I <= Count; I++)
                {
                    var Reward = RandomWeight.GetItems();
                    if (rnd.Next(0x64) <= 20)
                    {
                        // 3 4 5
                        IQuantity = (byte)rnd.Next(3, 6);
                    }
                    else
                    { // 5 6 7 8 9
                        IQuantity = (byte)rnd.Next(5, 10);
                    }

                    if ((Reward.RareType == 1) || (Reward.RareType == 2))
                    {
                        IQuantity = 1;
                    }
                    var Item = new AddItem
                    {
                        ItemIffId   = Reward.TypeId,
                        Quantity    = IQuantity,
                        Transaction = true,
                        Day         = 0
                    };

                    ItemData = player.AddItem(Item);
                    packet.WriteInt32(rnd.Next(3));
                    packet.WriteUInt32(ItemData.ItemTypeID);
                    packet.WriteUInt32(ItemData.ItemIndex);
                    packet.WriteUInt32(IQuantity);
                    packet.WriteUInt32(Reward.RareType);
                }
                packet.WriteUInt64(player.GetPang);
                packet.WriteUInt64(player.GetCookie);

                player.SendTransaction();

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

                RandomWeight.Restore();
            }
            finally
            {
                packet.Dispose();
            }
        }