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 }); }