I've been working on this code, and not getting much success to add 5 days to unlock the item, I ask your help to finish the code ... thank you very much!
Create an ItemLocking.cs in PacketHandling/ItemPacket... and paste a code bellow...
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NewestCOServer.PacketHandling
{
public class ItemLocking
{
public static void Handle(Main.GameClient GC, byte[] Data)
{
uint ItemUID = BitConverter.ToUInt32(Data, 4);
Game.Item I = GC.MyChar.FindInvItem(ItemUID);
byte TheType = Data[8];
switch (TheType)
{
case 0: //Item Lock
{
GC.MyChar.RemoveItem1(ItemUID);
I.Locked = true;
//GC.AddSend(Packets.ItemLock(ItemUID, TheType, 1, 0));
GC.MyChar.AddItem(I);
if (I.Locked == false) { GC.AddSend(Packets.ItemLock(ItemUID, 1, 3, I.LockedDays)); }
return;
}
case 1: //Item re-Lock
{
GC.MyChar.RemoveItem1(ItemUID);
DateTime datetounlock = DateTime.Now;
datetounlock = datetounlock.AddDays(5);
I.LockedDays = Convert.ToUInt32(datetounlock.ToString("yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture));
I.Locked = false;
GC.MyChar.AddItem(I);
if (I.Locked == false) { GC.AddSend(Packets.ItemLock(ItemUID, 1, 3, I.LockedDays)); }
break;
}
}
}
}
}
and go to PacketHandler.cs and search for
Code:
case 10005:
{
PacketHandling.WalkRun.Handle(GC, Data);
break;
}
and paste bellow...
Code:
case 2048:
{
PacketHandling.ItemLock.Handle(GC, Data);
break;
}
Thanks, we will finalize this code ...