Ultima modifica:
NosTale.Packets -> Paquets -> ClientPackets
add Character.cs ( GameObject ) - search : public string BubbleMessage { get; set; }
search: LastBazaarModeration = DateTime.Now;
Add : isortpackethandler.cs -> Librairies\OpenNos.Handler\PacketHandler
a little thank ?
- IsortPacket.cs
Codice:
////<auto-generated <- Codemaid exclusion for now (PacketIndex Order is important for maintenance)
using OpenNos.Core;
using OpenNos.Domain;
namespace NosTale.Packets.Packets.ClientPackets
{
[PacketHeader("isort")]
public class isortPacket : PacketDefinition
{
#region Properties
[PacketIndex(0)]
public InventoryType Type { get; set; }
#endregion
}
}
add Character.cs ( GameObject ) - search : public string BubbleMessage { get; set; }
Codice:
public DateTime LastISort { get; set; }
search: LastBazaarModeration = DateTime.Now;
Codice:
ADD -> LastISort = DateTime.Now;
Add : isortpackethandler.cs -> Librairies\OpenNos.Handler\PacketHandler
Codice:
using NosTale.Packets.Packets.ClientPackets;
using OpenNos.Core;
using OpenNos.Domain;
using OpenNos.GameObject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenNos.Handler.PacketHandler.Basic
{
public class ISortPacketHandler : IPacketHandler
{
#region Members
private readonly ClientSession Session;
#endregion
#region Instantiation
public ISortPacketHandler(ClientSession session) => Session = session;
#endregion
#region Methods
public void Sort(isortPacket e)
{
if (!CheckInvType(e.Type))
{
SendErrorMsg(Session);
return;
}
// Like Official server
var time = Session.Character.LastISort.AddSeconds(5);
if (DateTime.Now <= time)
{
SendErrorMsg(Session);
return;
}
SortInv(Session, e.Type);
}
private bool CheckInvType(InventoryType type)
{
var AllowedEnum = new List<InventoryType>
{
InventoryType.Equipment,
InventoryType.Main,
InventoryType.Etc,
InventoryType.Specialist,
InventoryType.Costume,
InventoryType.Main,
InventoryType.Warehouse,
InventoryType.PetWarehouse
};
if (!AllowedEnum.Contains(type))
{
return false;
}
return true;
}
private void SendErrorMsg(ClientSession e)
{
e.SendPacket("msgi 3 1808 0 0 0 0 0");
}
private void SortInv(ClientSession e, InventoryType type)
{
e.Character.LastISort = DateTime.Now;
e.Character.Inventory.Reorder(e, type);
}
#endregion
}
}
a little thank ?