mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 06:24:38 +02:00
Fixed battle npcs appearing strangely (no nameplate, wrong colour, etc), and implemented content groups!
This commit is contained in:
parent
c6307dde35
commit
2de4934c41
21 changed files with 826 additions and 422 deletions
|
@ -1,7 +1,11 @@
|
|||
using FFXIVClassic.Common;
|
||||
using FFXIVClassic_Map_Server.actors.director;
|
||||
using FFXIVClassic_Map_Server.actors.group.Work;
|
||||
using FFXIVClassic_Map_Server.Actors;
|
||||
using FFXIVClassic_Map_Server.dataobjects;
|
||||
using FFXIVClassic_Map_Server.packets.send.group;
|
||||
using FFXIVClassic_Map_Server.packets.send.groups;
|
||||
using FFXIVClassic_Map_Server.utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -12,20 +16,36 @@ namespace FFXIVClassic_Map_Server.actors.group
|
|||
{
|
||||
class ContentGroup : Group
|
||||
{
|
||||
public ContentGroupWork contentGroupWork = new ContentGroupWork();
|
||||
private Director director;
|
||||
private List<uint> members = new List<uint>();
|
||||
|
||||
public ContentGroup(ulong groupIndex, uint[] initialMembers) : base(groupIndex)
|
||||
public ContentGroup(ulong groupIndex, Director director, uint[] initialMembers) : base(groupIndex)
|
||||
{
|
||||
for (int i = 0; i < initialMembers.Length; i++)
|
||||
members.Add(initialMembers[i]);
|
||||
if (initialMembers != null)
|
||||
{
|
||||
for (int i = 0; i < initialMembers.Length; i++)
|
||||
members.Add(initialMembers[i]);
|
||||
}
|
||||
|
||||
this.director = director;
|
||||
contentGroupWork._globalTemp.director = (ulong)director.actorId << 32;
|
||||
}
|
||||
|
||||
public void AddMember(uint memberId)
|
||||
public void AddMember(Actor actor)
|
||||
{
|
||||
members.Add(memberId);
|
||||
if (actor == null)
|
||||
return;
|
||||
|
||||
members.Add(actor.actorId);
|
||||
if (actor is Character)
|
||||
{
|
||||
((Character)actor).SetCurrentContentGroup(GetTypeId());
|
||||
SendCurrentContentSync(actor);
|
||||
}
|
||||
SendGroupPacketsAll(members);
|
||||
}
|
||||
|
||||
|
||||
public void RemoveMember(uint memberId)
|
||||
{
|
||||
members.Remove(memberId);
|
||||
|
@ -44,18 +64,68 @@ namespace FFXIVClassic_Map_Server.actors.group
|
|||
return groupMembers;
|
||||
}
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return members.Count;
|
||||
}
|
||||
|
||||
public override void SendInitWorkValues(Session session)
|
||||
{
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
groupWork.addProperty(this, "contentGroupWork._globalTemp.director");
|
||||
groupWork.addByte(Utils.MurmurHash2("contentGroupWork.property[0]", 0), 1);
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.id, session.id);
|
||||
test.DebugPrintSubPacket();
|
||||
session.QueuePacket(test, true, false);
|
||||
}
|
||||
|
||||
public override void SendGroupPackets(Session session)
|
||||
{
|
||||
ulong time = Utils.MilisUnixTimeStampUTC();
|
||||
List<GroupMember> members = BuildMemberList(session.id);
|
||||
|
||||
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);
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (GetMemberCount() - currentIndex >= 64)
|
||||
session.QueuePacket(ContentMembersX64Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex), true, false);
|
||||
else if (GetMemberCount() - currentIndex >= 32)
|
||||
session.QueuePacket(ContentMembersX32Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex), true, false);
|
||||
else if (GetMemberCount() - currentIndex >= 16)
|
||||
session.QueuePacket(ContentMembersX16Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex), true, false);
|
||||
else if (GetMemberCount() - currentIndex > 0)
|
||||
session.QueuePacket(ContentMembersX08Packet.buildPacket(session.id, session.GetActor().zoneId, time, members, ref currentIndex), true, false);
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
session.QueuePacket(GroupMembersEndPacket.buildPacket(session.id, session.GetActor().zoneId, time, this), true, false);
|
||||
|
||||
}
|
||||
|
||||
public void SendCurrentContentSync(Actor currentContentChanged)
|
||||
{
|
||||
foreach (uint memberId in members)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(memberId);
|
||||
if (session != null)
|
||||
{
|
||||
ActorPropertyPacketUtil propPacketUtil = new ActorPropertyPacketUtil("charaWork/currentContentGroup", currentContentChanged, session.id);
|
||||
propPacketUtil.AddProperty("charaWork.currentContentGroup");
|
||||
session.GetActor().QueuePackets(propPacketUtil.Done());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.ContentGroup_SimpleContentGroup24A;
|
||||
return Group.ContentGroup_SimpleContentGroup24B;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue