public void PlayerCardSpecial(GPlayer PL, Packet packet)
        {
            Dictionary <bool, PlayerCardEquipData> CP;
            AddData  Remove;
            DateTime?GetDate = DateTime.Now;


            if (!packet.ReadUInt32(out uint TypeID))
            {
                return;
            }
            var C = Items.GetCardSPCL(TypeID);

            if (false == C.Keys.FirstOrDefault() || (!(GetCardType(TypeID) == CARDTYPE.tSpecial)))
            {
                return;
            }

            Remove = PL.Inventory.Remove(TypeID, 1, false);


            if (!Remove.Status)
            {
                return;
            }

            switch (C.Values.ToList().FirstOrDefault().Base.TypeID)
            {
            case 0x7C800000:
            case 0x7C800022:
            case 0x7C800034:
            {
                PL.AddExp(C.FirstOrDefault().Value.EffectQty);
            }
            break;

            case 0x7C80001F:
                PL.AddPang(C.FirstOrDefault().Value.Effect);
                break;

            default:
                CP = PL.Inventory.ItemCharacter.Card.UpdateCard(PL.GetUID, 0, 0, TypeID, 0, 1, (byte)C.FirstOrDefault().Value.Time);
                if (!CP.Keys.FirstOrDefault())
                {
                    return;
                }
                GetDate = CP.Values.FirstOrDefault().ENDDATE;
                break;
            }

            PL.Response.Write(new byte[] { 0x60, 0x01 });
            PL.Response.WriteUInt32(0);
            PL.Response.WriteUInt32(Remove.ItemIndex);
            PL.Response.WriteUInt32(Remove.ItemTypeID);
            PL.Response.WriteZero(0xC);
            PL.Response.Write(1);
            PL.Response.Write(GetFixTime(DateTime.Now));
            PL.Response.Write(GetFixTime(GetDate));
            PL.Response.WriteZero(2);
            PL.SendResponse();


            switch (C.Values.ToList().FirstOrDefault().Base.TypeID)
            {
            case 0x7C800000:
            case 0x7C800022:
            case 0x7C800034:
            {
                PL.SendExp();
            }
            break;

            case 0x7C80001F:
                PL.SendPang();
                break;
            }
        }
        public void PlayerUseClubPowder(GPlayer player, Packet packet)
        {
            var                   SupplyTypeID = packet.ReadUInt32();
            var                   ClubIndex    = packet.ReadUInt32();
            PlayerItemData        ClubInfo;
            AddData               RemoveItem;
            PlayerTransactionData Tran;

            void SendCode(byte[] Code)
            {
                player.Response.Write(new byte[] { 0x47, 0x02 });
                player.Response.Write(Code);
                player.SendResponse();
            }

            // 47 02 00 1A,436208199=Titan Boo Powder L
            // 4B 02 00 1A,436208203=Titan Boo Powder H
            bool Check()
            {
                bool result;

                result = (SupplyTypeID == 0x1A00024B) || (SupplyTypeID == 0x1A000247);
                return(result);
            }

            if (!Check())
            {
                SendCode(READ_PACKET_ERROR);
                return;
            }
            ClubInfo = player.Inventory.ItemWarehouse.GetClub(ClubIndex, TGET_CLUB.gcIndex);
            if ((ClubInfo == null))
            {
                SendCode(CLUBSET_NOT_FOUND_OR_NOT_EXIST);
                return;
            }
            if (!ClubInfo.ClubSetCanReset())
            {
                SendCode(CLUBSET_CANNOT_CANCEL);
                return;
            }
            RemoveItem = player.Inventory.Remove(SupplyTypeID, 1, true);
            if (!RemoveItem.Status)
            {
                SendCode(REMOVE_ITEM_FAIL);
                return;
            }
            if (SupplyTypeID == 0x1A00024B)
            {
                player.AddPang((uint)Round(Convert.ToDouble(ClubInfo.ItemClubPangLog / 2)));
                player.SendPang();

                ClubInfo.ItemClubPoint += (uint)Round(Convert.ToDouble(ClubInfo.ItemClubPointLog / 2));
            }
            // Reset club point
            ClubInfo.ClubSetReset();
            // ## add transaction
            player.Inventory.ItemTransaction.AddClubSystem(ClubInfo);
            Tran = new PlayerTransactionData
            {
                Types        = 0xC9,
                TypeID       = ClubInfo.ItemTypeID,
                Index        = ClubInfo.ItemIndex,
                PreviousQuan = 0,
                NewQuan      = 0,
                UCC          = ""
            };
            // ## add transaction
            player.Inventory.ItemTransaction.Add(Tran);
            player.SendTransaction();

            player.Response.Write(new byte[] { 0x47, 0x02 });
            player.Response.Write(0);
            player.Response.WriteUInt32(ClubInfo.ItemTypeID);
            player.Response.WriteUInt32(ClubInfo.ItemIndex);
            player.SendResponse();
        }
        public void PlayerPangControlLocker(GPlayer player, Packet packet)
        {
            //120 =você inseriu um valor maior do que o permitido
            //111 = valor de entrada maior do que o que você tem
            //100 falhou
            //101 falied
            void SendCode(uint Code = 0)
            {
                player.Response.Write(new byte[] { 0x71, 0x01, });
                player.Response.Write(Code);
                player.SendResponse();
            }

            var Action = packet.ReadByte();
            var Pang   = packet.ReadUInt64();

            bool Check()
            {
                return(player.GetPang <= 0 || Pang <= 0);
            }

            try
            {
                if (!Check())
                {
                    SendCode(110);
                }
                else
                {
                    SendCode();
                    switch (Action)
                    {
                    case 0:     //puxa pangs
                    {
                        try
                        {
                            if (player.RemoveLockerPang((uint)Pang))
                            {
                                player.AddPang((uint)Pang);
                            }
                        }
                        catch
                        {
                            SendCode(100);
                            return;
                        }
                    }
                    break;

                    case 1:      //guarda pangs
                    {
                        try
                        {
                            if (player.RemovePang((uint)Pang))
                            {
                                player.AddLockerPang((uint)Pang);
                            }
                        }
                        catch
                        {
                            SendCode(100);
                            return;
                        }
                    }
                    break;
                    }

                    //reload pangs(reenvia os pangs na caixa de pangs do client)
                    player.SendPang();

                    //SendPangs in dolfine(envia os pangs na caixa do dolfine)
                    player.SendLockerPang();
                    var _db = new PangyaEntities();
                    _db.ProcSavePersonalLog((int)player.GetUID, Action, (int)player.LockerPang);
                }
            }
            catch
            {
                SendCode(100);
            }
        }
        public void PlayerReleaseItem(GPlayer PL, Packet packet)
        {
            UInt32        FTypeID;
            UInt32        FQuantity;
            UInt32        ItemMailIndex;
            AddData       ItemAddedData;
            AddItem       ItemData;
            StringBuilder SQLString;

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

            var _db = new PangyaEntities();

            var Query = _db.ProcMailItem((int)PL.GetUID, (int)MailIndex).ToList();

            if (!(Query.Count >= 1))
            {
                PL.SendResponse(new byte[] { 0x14, 0x02, 0x98, 0x26, 0x2D, 0x00 });
                return;
            }

            SQLString = new StringBuilder();
            for (int i = 0; i < Query.Count; i++)
            {
                FTypeID   = (uint)Query[i].TYPEID;
                FQuantity = (uint)Query[i].QTY;
                // EXP POCKET
                if (FTypeID == 436207965)
                {
                }
                // PANG POCKET
                if (FTypeID == 436207632)
                {
                    if ((PL.GetPang + FQuantity) > uint.MaxValue)
                    {
                        PL.SendResponse(new byte[] { 0x14, 0x02, 0x98, 0x26, 0x2D, 0x00 });
                        break;
                    }
                }
                // OTHERS ITEM
                if (!PL.Inventory.Available(FTypeID, FQuantity))
                {
                    PL.SendResponse(new byte[] { 0x14, 0x02, 0x98, 0x26, 0x2D, 0x00 });//item invalido
                    break;
                }
            }

            for (int i = 0; i < Query.Count; i++)
            {
                FTypeID       = (uint)Query[i].TYPEID;
                FQuantity     = (uint)Query[i].QTY;
                ItemMailIndex = (uint)Query[i].Mail_Index;
                // EXP POCKET
                if (FTypeID == 436207965)
                {
                    PL.AddExp(FQuantity);
                    SQLString.Append('^');
                    SQLString.Append(ItemMailIndex);
                    SQLString.Append('^');
                    SQLString.Append(436207965);
                    SQLString.Append('^');
                    SQLString.Append(0);
                    SQLString.Append(',');
                }
                else if (FTypeID == 436207632)
                {
                    PL.AddPang(FQuantity);
                    PL.SendPang();
                    SQLString.Append('^');
                    SQLString.Append(ItemMailIndex);
                    SQLString.Append('^');
                    SQLString.Append(436207632);
                    SQLString.Append('^');
                    SQLString.Append(0);
                    SQLString.Append(',');
                }
                else
                {
                    // OTHER ITEM
                    ItemData = new AddItem
                    {
                        ItemIffId   = FTypeID,
                        Quantity    = FQuantity,
                        Transaction = true,
                        Day         = 0
                    };
                    ItemAddedData = PL.AddItem(ItemData);

                    SQLString.Append('^');
                    SQLString.Append(ItemMailIndex);
                    SQLString.Append('^');
                    SQLString.Append(FTypeID);
                    SQLString.Append('^');
                    SQLString.Append(ItemAddedData.ItemIndex);
                    SQLString.Append(',');
                }
                PL.SendTransaction();
                var Table = $"Exec dbo.USP_MAIL_UPDATE @UID = '{(int)PL.GetUID}', @ITEMSTR = '{SQLString.ToString()}'";
                _db.Database.SqlQuery <PangyaEntities>(Table).FirstOrDefault();
            }
            // update mail items
            PL.SendResponse(new byte[] { 0x14, 0x02, 0x00, 0x00, 0x00, 0x00 });
        }