mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-11 06:54:43 +02:00
More group work. Added packet operations to the world server so it can send global group info.
This commit is contained in:
parent
6c409e93a9
commit
1148619ca5
30 changed files with 1173 additions and 43 deletions
|
@ -1,18 +1,79 @@
|
|||
using System;
|
||||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_World_Server.Packets.Send.Subpackets.Groups;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace FFXIVClassic_World_Server.DataObjects.Group
|
||||
{
|
||||
class Group
|
||||
{
|
||||
public readonly ulong groupIndex;
|
||||
public const uint PlayerPartyGroup = 10001;
|
||||
public const uint CompanyGroup = 20001;
|
||||
|
||||
public const uint GroupInvitationRelationGroup = 50001;
|
||||
public const uint TradeRelationGroup = 50002;
|
||||
public const uint BazaarBuyItemRelationGroup = 50009;
|
||||
|
||||
public const uint RetainerGroup = 80001;
|
||||
|
||||
public readonly ulong groupIndex;
|
||||
|
||||
public Group(ulong groupIndex)
|
||||
{
|
||||
this.groupIndex = groupIndex;
|
||||
}
|
||||
|
||||
public virtual int GetMemberCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public virtual uint GetTypeId()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public virtual string GetGroupName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public virtual int GetGroupLocalizedName()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public virtual List<GroupMember> BuildMemberList()
|
||||
{
|
||||
return new List<GroupMember>();
|
||||
}
|
||||
|
||||
public void SendGroupPackets(Session session)
|
||||
{
|
||||
ulong time = Utils.MilisUnixTimeStampUTC();
|
||||
List<GroupMember> members = BuildMemberList();
|
||||
|
||||
session.clientConnection.QueuePacket(GroupHeaderPacket.buildPacket(session.sessionId, session.currentZoneId, time, this), true, false);
|
||||
session.clientConnection.QueuePacket(GroupMembersBeginPacket.buildPacket(session.sessionId, session.currentZoneId, time, this), true, false);
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (GetMemberCount() - currentIndex >= 64)
|
||||
session.clientConnection.QueuePacket(GroupMembersX64Packet.buildPacket(session.sessionId, session.currentZoneId, time, members, ref currentIndex), true, false);
|
||||
else if (GetMemberCount() - currentIndex >= 32)
|
||||
session.clientConnection.QueuePacket(GroupMembersX32Packet.buildPacket(session.sessionId, session.currentZoneId, time, members, ref currentIndex), true, false);
|
||||
else if (GetMemberCount() - currentIndex >= 16)
|
||||
session.clientConnection.QueuePacket(GroupMembersX16Packet.buildPacket(session.sessionId, session.currentZoneId, time, members, ref currentIndex), true, false);
|
||||
else if (GetMemberCount() - currentIndex > 0)
|
||||
session.clientConnection.QueuePacket(GroupMembersX08Packet.buildPacket(session.sessionId, session.currentZoneId, time, members, ref currentIndex), true, false);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
session.clientConnection.QueuePacket(GroupMembersEndPacket.buildPacket(session.sessionId, session.currentZoneId, time, this), true, false);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using System;
|
||||
using FFXIVClassic_World_Server.Actor.Group.Work;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_World_Server.Packets.Send.Subpackets.Groups;
|
||||
|
||||
namespace FFXIVClassic_World_Server.DataObjects.Group
|
||||
{
|
||||
|
@ -10,19 +12,63 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||
{
|
||||
public ulong dbId;
|
||||
public string name;
|
||||
public ushort crestId;
|
||||
public uint master;
|
||||
public ushort rank;
|
||||
|
||||
public LinkshellWork linkshellWork = new LinkshellWork();
|
||||
|
||||
public Dictionary<ulong, LinkshellMember> members = new Dictionary<ulong, LinkshellMember>();
|
||||
|
||||
public Linkshell(ulong dbId, ulong groupIndex, string name, ushort crestId, uint master, ushort rank) : base(groupIndex)
|
||||
public Linkshell(ulong dbId, ulong groupIndex, string name, ushort crestId, uint master, byte rank) : base(groupIndex)
|
||||
{
|
||||
this.dbId = dbId;
|
||||
this.name = name;
|
||||
this.crestId = crestId;
|
||||
this.master = master;
|
||||
this.rank = rank;
|
||||
linkshellWork._globalSave.crestIcon[0] = crestId;
|
||||
linkshellWork._globalSave.master = master;
|
||||
linkshellWork._globalSave.rank = rank;
|
||||
}
|
||||
|
||||
public void setMaster(uint actorId)
|
||||
{
|
||||
linkshellWork._globalSave.master = (ulong)((0xB36F92 << 8) | actorId);
|
||||
}
|
||||
|
||||
public void setCrest(ushort crestId)
|
||||
{
|
||||
linkshellWork._globalSave.crestIcon[0] = crestId;
|
||||
}
|
||||
|
||||
public void setRank(byte rank = 1)
|
||||
{
|
||||
linkshellWork._globalSave.rank = rank;
|
||||
}
|
||||
|
||||
public void setMemberRank(int index, byte rank)
|
||||
{
|
||||
if (members.Count >= index)
|
||||
return;
|
||||
linkshellWork._memberSave[index].rank = rank;
|
||||
}
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return members.Count;
|
||||
}
|
||||
|
||||
public override string GetGroupName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.CompanyGroup;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList()
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
foreach (LinkshellMember member in members.Values)
|
||||
groupMembers.Add(new GroupMember(member.charaId, -1, 0, false, Server.GetServer().GetSession(member.charaId) != null, Server.GetServer().GetNameForId(member.charaId)));
|
||||
return groupMembers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using FFXIVClassic_World_Server.Actor.Group.Work;
|
||||
using FFXIVClassic_World_Server.Packets.Send.Subpackets.Groups;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -8,12 +10,53 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||
{
|
||||
class Party : Group
|
||||
{
|
||||
public uint leader;
|
||||
public PartyWork partyGroupWork = new PartyWork();
|
||||
public List<uint> members = new List<uint>();
|
||||
|
||||
public Party(ulong groupId, uint leaderCharaId) : base(groupId)
|
||||
{
|
||||
this.leader = leaderCharaId;
|
||||
partyGroupWork._globalTemp.owner = (ulong)((0xB36F92 << 8) | leaderCharaId);
|
||||
}
|
||||
|
||||
public void SetLeader(uint actorId)
|
||||
{
|
||||
partyGroupWork._globalTemp.owner = (ulong)((0xB36F92 << 8) | actorId);
|
||||
}
|
||||
|
||||
public uint GetLeader()
|
||||
{
|
||||
return (uint)(partyGroupWork._globalTemp.owner & 0xFFFFFF);
|
||||
}
|
||||
|
||||
/*
|
||||
public override void sendWorkValues(Session session)
|
||||
{
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupId);
|
||||
groupWork.addProperty(this, "partyGroupWork._globalTemp.owner");
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.sessionId, session.sessionId);
|
||||
session.clientConnection.QueuePacket(test, true, false);
|
||||
}
|
||||
*/
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return members.Count;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.PlayerPartyGroup;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList()
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
foreach (uint charaId in members)
|
||||
groupMembers.Add(new GroupMember(charaId, -1, 0, false, Server.GetServer().GetSession(charaId) != null, Server.GetServer().GetNameForId(charaId)));
|
||||
return groupMembers;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using FFXIVClassic_World_Server.Packets.Send.Subpackets.Groups;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -17,5 +18,24 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||
this.charaOther = other;
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.GroupInvitationRelationGroup;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList()
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
groupMembers.Add(new GroupMember(charaHost, -1, 0, false, Server.GetServer().GetSession(charaHost) != null, Server.GetServer().GetNameForId(charaHost)));
|
||||
groupMembers.Add(new GroupMember(charaOther, -1, 0, false, Server.GetServer().GetSession(charaOther) != null, Server.GetServer().GetNameForId(charaOther)));
|
||||
return groupMembers;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using System;
|
||||
using FFXIVClassic_World_Server.Actor.Group.Work;
|
||||
using FFXIVClassic_World_Server.Packets.Send.Subpackets.Groups;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -8,6 +10,7 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||
{
|
||||
class RetainerGroup : Group
|
||||
{
|
||||
public RetainerWork work = new RetainerWork();
|
||||
public uint owner;
|
||||
public Dictionary<uint, RetainerGroupMember> members = new Dictionary<uint, RetainerGroupMember>();
|
||||
|
||||
|
@ -15,5 +18,48 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||
{
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public void setRetainerProperties(int index, byte cdIDOffset, ushort placeName, byte condition, byte level)
|
||||
{
|
||||
if (members.Count >= index)
|
||||
return;
|
||||
work._memberSave[index].cdIDOffset = cdIDOffset;
|
||||
work._memberSave[index].placeName = placeName;
|
||||
work._memberSave[index].conditions = condition;
|
||||
work._memberSave[index].level = level;
|
||||
}
|
||||
|
||||
/*
|
||||
public override void sendWorkValues(Session session)
|
||||
{
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupId);
|
||||
groupWork.addProperty(this, "work._memberSave[0].cdIDOffset");
|
||||
groupWork.addProperty(this, "work._memberSave[0].placeName");
|
||||
groupWork.addProperty(this, "work._memberSave[0].conditions");
|
||||
groupWork.addProperty(this, "work._memberSave[0].level");
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.sessionId, session.sessionId);
|
||||
session.clientConnection.QueuePacket(test, true, false);
|
||||
}
|
||||
*/
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return members.Count;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.RetainerGroup;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList()
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
foreach (RetainerGroupMember member in members.Values)
|
||||
groupMembers.Add(new GroupMember(member.retainerId, -1, 0, false, true, member.name));
|
||||
return groupMembers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,5 +8,7 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||
{
|
||||
class RetainerGroupMember
|
||||
{
|
||||
public uint retainerId;
|
||||
public string name;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue