using ODMO.Commons.Models.Character;
using ODMO.Commons.Writers;
namespace ODMO.Commons.Packets.GameServer
{
public class TamerRelationsPacket : PacketWriter
{
private const int PacketNumber = 2404;
///
/// Loads the tamer's relationships (friends and foes).
///
/// The tamer's friends.
/// The tamer's foes.
public TamerRelationsPacket(IList friends, IList foes)
{
Type(PacketNumber);
WriteShort((short)friends.Count);
foreach (var friend in friends)
{
WriteByte(Convert.ToByte(friend.Connected));
WriteString(friend.Friend?.Name ?? "Friend");
if(string.IsNullOrEmpty(friend.Annotation))
WriteByte(0);
else
WriteString(friend.Annotation);
}
WriteShort((short)foes.Count);
foreach (var foe in foes)
{
WriteString(foe.Name);
if (string.IsNullOrEmpty(foe.Annotation))
WriteByte(0);
else
WriteString(foe.Annotation);
}
}
}
}