More group work. Added packet operations to the world server so it can send global group info.

This commit is contained in:
Filip Maj 2016-12-15 12:19:44 -05:00
parent 6c409e93a9
commit 1148619ca5
30 changed files with 1173 additions and 43 deletions

View file

@ -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;
}
}
}