2019-06-18 22:55:32 -04:00
|
|
|
|
/*
|
|
|
|
|
===========================================================================
|
|
|
|
|
Copyright (C) 2015-2019 Project Meteor Dev Team
|
|
|
|
|
|
|
|
|
|
This file is part of Project Meteor Server.
|
|
|
|
|
|
|
|
|
|
Project Meteor Server is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
Project Meteor Server is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
|
|
|
|
===========================================================================
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2016-01-10 02:44:32 -05:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using FFXIVClassic_Map_Server.packets.send.actor;
|
2016-01-20 23:18:10 -05:00
|
|
|
|
using FFXIVClassic_Map_Server.Actors;
|
2016-08-22 10:43:04 -04:00
|
|
|
|
using FFXIVClassic.Common;
|
2016-01-10 02:44:32 -05:00
|
|
|
|
|
|
|
|
|
namespace FFXIVClassic_Map_Server.utils
|
|
|
|
|
{
|
|
|
|
|
class ActorPropertyPacketUtil
|
|
|
|
|
{
|
2016-03-19 18:43:02 -04:00
|
|
|
|
private Actor forActor;
|
|
|
|
|
private List<SubPacket> subPackets = new List<SubPacket>();
|
|
|
|
|
private SetActorPropetyPacket currentActorPropertyPacket;
|
|
|
|
|
private string currentTarget;
|
2016-01-10 02:44:32 -05:00
|
|
|
|
|
2017-06-27 13:52:47 -04:00
|
|
|
|
public ActorPropertyPacketUtil(string firstTarget, Actor forActor)
|
2016-01-10 02:44:32 -05:00
|
|
|
|
{
|
|
|
|
|
currentActorPropertyPacket = new SetActorPropetyPacket(firstTarget);
|
|
|
|
|
this.forActor = forActor;
|
|
|
|
|
this.currentTarget = firstTarget;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 21:29:10 +01:00
|
|
|
|
public void AddProperty(string property)
|
2016-01-10 02:44:32 -05:00
|
|
|
|
{
|
2016-06-14 21:29:10 +01:00
|
|
|
|
if (!currentActorPropertyPacket.AddProperty(forActor, property))
|
2016-01-10 02:44:32 -05:00
|
|
|
|
{
|
2016-06-14 21:29:10 +01:00
|
|
|
|
currentActorPropertyPacket.SetIsMore(true);
|
|
|
|
|
currentActorPropertyPacket.AddTarget();
|
2017-06-27 13:52:47 -04:00
|
|
|
|
subPackets.Add(currentActorPropertyPacket.BuildPacket(forActor.actorId));
|
2016-01-10 02:44:32 -05:00
|
|
|
|
currentActorPropertyPacket = new SetActorPropetyPacket(currentTarget);
|
2017-04-02 12:51:23 -04:00
|
|
|
|
currentActorPropertyPacket.AddProperty(forActor, property);
|
2016-01-10 02:44:32 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-15 00:08:05 +01:00
|
|
|
|
public void NewTarget(string target)
|
2016-03-12 10:01:41 -05:00
|
|
|
|
{
|
2016-06-14 21:29:10 +01:00
|
|
|
|
currentActorPropertyPacket.AddTarget();
|
2016-06-15 00:08:05 +01:00
|
|
|
|
currentTarget = target;
|
|
|
|
|
currentActorPropertyPacket.SetTarget(target);
|
2016-03-12 10:01:41 -05:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 21:29:10 +01:00
|
|
|
|
public List<SubPacket> Done()
|
2016-01-10 02:44:32 -05:00
|
|
|
|
{
|
2016-06-14 21:29:10 +01:00
|
|
|
|
currentActorPropertyPacket.AddTarget();
|
|
|
|
|
currentActorPropertyPacket.SetIsMore(false);
|
2017-06-27 13:52:47 -04:00
|
|
|
|
subPackets.Add(currentActorPropertyPacket.BuildPacket(forActor.actorId));
|
2016-03-12 02:52:34 -05:00
|
|
|
|
return subPackets;
|
2016-01-10 02:44:32 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|