1
Fork 0
mirror of https://bitbucket.org/Ioncannon/project-meteor-server.git synced 2025-04-21 04:07:48 +00:00
project-meteor-server/FFXIVClassic Map Server/utils/ActorPropertyPacketUtil.cs

52 lines
1.8 KiB
C#
Raw Normal View History

using FFXIVClassic_Map_Server.packets;
using System.Collections.Generic;
using FFXIVClassic_Map_Server.packets.send.actor;
using FFXIVClassic_Map_Server.Actors;
namespace FFXIVClassic_Map_Server.utils
{
class ActorPropertyPacketUtil
{
private Actor forActor;
private uint playerActorId;
private List<SubPacket> subPackets = new List<SubPacket>();
private SetActorPropetyPacket currentActorPropertyPacket;
private string currentTarget;
public ActorPropertyPacketUtil(string firstTarget, Actor forActor, uint playerActorId)
{
currentActorPropertyPacket = new SetActorPropetyPacket(firstTarget);
this.forActor = forActor;
this.playerActorId = playerActorId;
this.currentTarget = firstTarget;
}
public void AddProperty(string property)
{
if (!currentActorPropertyPacket.AddProperty(forActor, property))
{
currentActorPropertyPacket.SetIsMore(true);
currentActorPropertyPacket.AddTarget();
subPackets.Add(currentActorPropertyPacket.BuildPacket(playerActorId, forActor.actorId));
currentActorPropertyPacket = new SetActorPropetyPacket(currentTarget);
}
}
public void NewTarget(string target)
{
currentActorPropertyPacket.AddTarget();
currentTarget = target;
currentActorPropertyPacket.SetTarget(target);
}
public List<SubPacket> Done()
{
currentActorPropertyPacket.AddTarget();
currentActorPropertyPacket.SetIsMore(false);
subPackets.Add(currentActorPropertyPacket.BuildPacket(playerActorId, forActor.actorId));
return subPackets;
}
}
}