2016-12-04 10:18:04 -05:00
|
|
|
|
using FFXIVClassic.Common;
|
2016-12-21 09:27:51 -05:00
|
|
|
|
using FFXIVClassic_Map_Server.dataobjects;
|
2016-12-04 09:52:57 -05:00
|
|
|
|
using FFXIVClassic_Map_Server.packets.send.group;
|
2017-01-29 11:07:28 -05:00
|
|
|
|
using FFXIVClassic_Map_Server.packets.send.groups;
|
2016-12-04 09:52:57 -05:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace FFXIVClassic_Map_Server.actors.group
|
|
|
|
|
{
|
|
|
|
|
class Group
|
|
|
|
|
{
|
|
|
|
|
public const uint PlayerPartyGroup = 10001;
|
2016-12-21 09:27:51 -05:00
|
|
|
|
public const uint CompanyGroup = 20002;
|
2016-12-04 09:52:57 -05:00
|
|
|
|
|
|
|
|
|
public const uint GroupInvitationRelationGroup = 50001;
|
|
|
|
|
public const uint TradeRelationGroup = 50002;
|
|
|
|
|
public const uint BazaarBuyItemRelationGroup = 50009;
|
2016-12-21 09:27:51 -05:00
|
|
|
|
|
2016-12-04 09:52:57 -05:00
|
|
|
|
public const uint RetainerGroup = 80001;
|
|
|
|
|
|
2017-01-29 11:07:28 -05:00
|
|
|
|
public const uint MonsterPartyGroup = 10002;
|
|
|
|
|
|
|
|
|
|
public const uint ContentGroup_GuildleveGroup = 30001;
|
|
|
|
|
public const uint ContentGroup_PublicPopGroup = 30002;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup24A = 30003;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup32A = 30004;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup128 = 30005;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup24B = 30006;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup32B = 30007;
|
|
|
|
|
public const uint ContentGroup_RetainerAccessGroup = 30008;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup99999 = 30009;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup512 = 30010;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup64A = 30011;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup64B = 30012;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup64C = 30013;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup64D = 30014;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup64E = 30015;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup64F = 30016;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup64G = 30017;
|
|
|
|
|
public const uint ContentGroup_SimpleContentGroup24C = 30018;
|
|
|
|
|
|
2016-12-21 09:27:51 -05:00
|
|
|
|
public readonly ulong groupIndex;
|
|
|
|
|
|
|
|
|
|
public Group(ulong groupIndex)
|
|
|
|
|
{
|
|
|
|
|
this.groupIndex = groupIndex;
|
|
|
|
|
}
|
2016-12-04 09:52:57 -05:00
|
|
|
|
|
2016-12-21 09:27:51 -05:00
|
|
|
|
public virtual int GetMemberCount()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2016-12-04 09:52:57 -05:00
|
|
|
|
|
2016-12-21 09:27:51 -05:00
|
|
|
|
public virtual uint GetTypeId()
|
2016-12-04 09:52:57 -05:00
|
|
|
|
{
|
2016-12-21 09:27:51 -05:00
|
|
|
|
return 0;
|
2016-12-04 09:52:57 -05:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-21 09:27:51 -05:00
|
|
|
|
public virtual string GetGroupName()
|
2016-12-04 09:52:57 -05:00
|
|
|
|
{
|
2016-12-21 09:27:51 -05:00
|
|
|
|
return "";
|
2016-12-04 09:52:57 -05:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-21 09:27:51 -05:00
|
|
|
|
public virtual int GetGroupLocalizedName()
|
2016-12-04 09:52:57 -05:00
|
|
|
|
{
|
2016-12-21 09:27:51 -05:00
|
|
|
|
return -1;
|
2016-12-04 09:52:57 -05:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-29 11:07:28 -05:00
|
|
|
|
public virtual List<GroupMember> BuildMemberList(uint id)
|
2016-12-04 09:52:57 -05:00
|
|
|
|
{
|
2016-12-21 09:27:51 -05:00
|
|
|
|
return new List<GroupMember>();
|
2016-12-04 09:52:57 -05:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-29 11:07:28 -05:00
|
|
|
|
public void SendGroupPacketsAll(params uint[] ids)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < ids.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
Session session = Server.GetServer().GetSession(ids[i]);
|
|
|
|
|
|
|
|
|
|
if (session != null)
|
|
|
|
|
SendGroupPackets(session);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SendGroupPacketsAll(List<uint> ids)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < ids.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
Session session = Server.GetServer().GetSession(ids[i]);
|
|
|
|
|
|
|
|
|
|
if (session != null)
|
|
|
|
|
SendGroupPackets(session);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SendDeletePackets(params uint[] ids)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < ids.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
Session session = Server.GetServer().GetSession(ids[i]);
|
|
|
|
|
|
|
|
|
|
if (session != null)
|
|
|
|
|
SendDeletePacket(session);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SendDeletePackets(List<uint> ids)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 0; i < ids.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
Session session = Server.GetServer().GetSession(ids[i]);
|
|
|
|
|
|
|
|
|
|
if (session != null)
|
|
|
|
|
SendDeletePacket(session);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-21 09:27:51 -05:00
|
|
|
|
public void SendGroupPackets(Session session)
|
2016-12-04 09:52:57 -05:00
|
|
|
|
{
|
|
|
|
|
ulong time = Utils.MilisUnixTimeStampUTC();
|
2017-01-29 11:07:28 -05:00
|
|
|
|
List<GroupMember> members = BuildMemberList(session.id);
|
2016-12-04 09:52:57 -05:00
|
|
|
|
|
2017-01-29 11:07:28 -05:00
|
|
|
|
session.QueuePacket(GroupHeaderPacket.buildPacket(session.id, session.GetActor().zoneId, time, this), true, false);
|
|
|
|
|
session.QueuePacket(GroupMembersBeginPacket.buildPacket(session.id, session.GetActor().zoneId, time, this), true, false);
|
2016-12-04 09:52:57 -05:00
|
|
|
|
|
|
|
|
|
int currentIndex = 0;
|
|
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
2016-12-21 09:27:51 -05:00
|
|
|
|
if (GetMemberCount() - currentIndex >= 64)
|
2017-01-29 11:07:28 -05:00
|
|
|
|
session.QueuePacket(GroupMembersX64Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex), true, false);
|
2016-12-21 09:27:51 -05:00
|
|
|
|
else if (GetMemberCount() - currentIndex >= 32)
|
2017-01-29 11:07:28 -05:00
|
|
|
|
session.QueuePacket(GroupMembersX32Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex), true, false);
|
2016-12-21 09:27:51 -05:00
|
|
|
|
else if (GetMemberCount() - currentIndex >= 16)
|
2017-01-29 11:07:28 -05:00
|
|
|
|
session.QueuePacket(GroupMembersX16Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex), true, false);
|
2016-12-21 09:27:51 -05:00
|
|
|
|
else if (GetMemberCount() - currentIndex > 0)
|
2017-01-29 11:07:28 -05:00
|
|
|
|
session.QueuePacket(GroupMembersX08Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex), true, false);
|
2016-12-04 09:52:57 -05:00
|
|
|
|
else
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-12-21 09:27:51 -05:00
|
|
|
|
|
2017-01-29 11:07:28 -05:00
|
|
|
|
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().zoneId, time, this), true, false);
|
|
|
|
|
|
|
|
|
|
}
|
2016-12-04 09:52:57 -05:00
|
|
|
|
|
2017-01-29 11:07:28 -05:00
|
|
|
|
public void SendDeletePacket(Session session)
|
|
|
|
|
{
|
|
|
|
|
if (session != null)
|
|
|
|
|
session.QueuePacket(DeleteGroupPacket.buildPacket(session.id, this), true, false);
|
2016-12-04 09:52:57 -05:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-21 09:27:51 -05:00
|
|
|
|
public virtual void SendInitWorkValues(Session session)
|
|
|
|
|
{
|
2016-12-06 08:26:16 -05:00
|
|
|
|
|
2016-12-21 09:27:51 -05:00
|
|
|
|
}
|
2016-12-04 09:52:57 -05:00
|
|
|
|
}
|
|
|
|
|
}
|