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