mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
More cleanup (moved groups to WorldMaster class) and fixed the project file.
This commit is contained in:
parent
2cc63960a7
commit
31446f37fa
@ -80,6 +80,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
return AddActorPacket.BuildPacket(actorId, playerActorId, 8);
|
return AddActorPacket.BuildPacket(actorId, playerActorId, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int val = 0x0b00;
|
||||||
// actorClassId, [], [], numBattleCommon, [battleCommon], numEventCommon, [eventCommon], args for either initForBattle/initForEvent
|
// actorClassId, [], [], numBattleCommon, [battleCommon], numEventCommon, [eventCommon], args for either initForBattle/initForEvent
|
||||||
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
public override SubPacket CreateScriptBindPacket(uint playerActorId)
|
||||||
{
|
{
|
||||||
@ -88,6 +89,13 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
|
Player player = Server.GetWorldManager().GetPCInWorld(playerActorId);
|
||||||
lParams = DoActorInit(player);
|
lParams = DoActorInit(player);
|
||||||
|
|
||||||
|
if (uniqueIdentifier.Equals("1"))
|
||||||
|
{
|
||||||
|
lParams[5].value = val;
|
||||||
|
val++;
|
||||||
|
player.SendMessage(0x20, "", String.Format("ID is now: 0x{0:X}", val));
|
||||||
|
}
|
||||||
|
|
||||||
if (lParams != null && lParams.Count >= 3 && lParams[2].typeID == 0 && (int)lParams[2].value == 0)
|
if (lParams != null && lParams.Count >= 3 && lParams[2].typeID == 0 && (int)lParams[2].value == 0)
|
||||||
isStatic = true;
|
isStatic = true;
|
||||||
|
|
||||||
@ -122,6 +130,57 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||||||
subpackets.AddRange(GetEventConditionPackets(playerActorId));
|
subpackets.AddRange(GetEventConditionPackets(playerActorId));
|
||||||
subpackets.Add(CreateSpeedPacket(playerActorId));
|
subpackets.Add(CreateSpeedPacket(playerActorId));
|
||||||
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x0));
|
subpackets.Add(CreateSpawnPositonPacket(playerActorId, 0x0));
|
||||||
|
|
||||||
|
if (uniqueIdentifier.Equals("door2"))
|
||||||
|
{
|
||||||
|
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, 0xB09, 0x1af));
|
||||||
|
}
|
||||||
|
else if (uniqueIdentifier.Equals("uldah_mapshipport_1"))
|
||||||
|
{
|
||||||
|
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, 0xdc5, 0x1af));
|
||||||
|
subpackets[subpackets.Count - 1].DebugPrintSubPacket();
|
||||||
|
subpackets.Add(_0xD9Packet.BuildPacket(actorId, playerActorId, "end0"));
|
||||||
|
subpackets[subpackets.Count - 1].DebugPrintSubPacket();
|
||||||
|
}
|
||||||
|
else if (uniqueIdentifier.Equals("uldah_mapshipport_2"))
|
||||||
|
{
|
||||||
|
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, 0x2, 0x1eb));
|
||||||
|
subpackets[subpackets.Count - 1].DebugPrintSubPacket();
|
||||||
|
subpackets.Add(_0xD9Packet.BuildPacket(actorId, playerActorId, "end0"));
|
||||||
|
subpackets[subpackets.Count - 1].DebugPrintSubPacket();
|
||||||
|
}
|
||||||
|
else if (uniqueIdentifier.Equals("gridania_shipport"))
|
||||||
|
{
|
||||||
|
subpackets.Add(_0xD8Packet.BuildPacket(actorId,playerActorId, 0xcde, 0x141));
|
||||||
|
subpackets.Add(_0xD9Packet.BuildPacket(actorId,playerActorId, "end0"));
|
||||||
|
}
|
||||||
|
else if (uniqueIdentifier.Equals("gridania_shipport2"))
|
||||||
|
{
|
||||||
|
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, 0x02, 0x187));
|
||||||
|
subpackets.Add(_0xD9Packet.BuildPacket(actorId, playerActorId, "end0"));
|
||||||
|
}
|
||||||
|
else if (uniqueIdentifier.Equals("limsa_shipport"))
|
||||||
|
{
|
||||||
|
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, 0x1c8, 0xc4));
|
||||||
|
subpackets.Add(_0xD9Packet.BuildPacket(actorId, playerActorId, "spin"));
|
||||||
|
}
|
||||||
|
else if (actorClassId == 5900013)
|
||||||
|
{
|
||||||
|
uint id = 2;
|
||||||
|
uint id2 = 5144;
|
||||||
|
string val = "fdot";
|
||||||
|
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, id, id2));
|
||||||
|
subpackets.Add(_0xD9Packet.BuildPacket(actorId, playerActorId, val));
|
||||||
|
}
|
||||||
|
else if (actorClassId == 5900014)
|
||||||
|
{
|
||||||
|
uint id = 2;
|
||||||
|
uint id2 = 5145;
|
||||||
|
string val = "fdot";
|
||||||
|
subpackets.Add(_0xD8Packet.BuildPacket(actorId, playerActorId, id, id2));
|
||||||
|
subpackets.Add(_0xD9Packet.BuildPacket(actorId, playerActorId, val));
|
||||||
|
}
|
||||||
|
else
|
||||||
subpackets.Add(CreateAppearancePacket(playerActorId));
|
subpackets.Add(CreateAppearancePacket(playerActorId));
|
||||||
subpackets.Add(CreateNamePacket(playerActorId));
|
subpackets.Add(CreateNamePacket(playerActorId));
|
||||||
subpackets.Add(CreateStatePacket(playerActorId));
|
subpackets.Add(CreateStatePacket(playerActorId));
|
||||||
|
@ -82,7 +82,7 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
GetActor().zone.UpdateActorPosition(GetActor());
|
GetActor().zone.UpdateActorPosition(GetActor());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
long lastMilis = 0;
|
||||||
public void UpdateInstance(List<Actor> list)
|
public void UpdateInstance(List<Actor> list)
|
||||||
{
|
{
|
||||||
if (isUpdatesLocked)
|
if (isUpdatesLocked)
|
||||||
@ -95,11 +95,29 @@ namespace FFXIVClassic_Map_Server.dataobjects
|
|||||||
//Remove missing actors
|
//Remove missing actors
|
||||||
for (int i = 0; i < actorInstanceList.Count; i++)
|
for (int i = 0; i < actorInstanceList.Count; i++)
|
||||||
{
|
{
|
||||||
|
if (list.Contains(actorInstanceList[i]) && actorInstanceList[i] is Npc)
|
||||||
|
{
|
||||||
|
Npc npc = (Npc)actorInstanceList[i];
|
||||||
|
|
||||||
|
|
||||||
|
long milliseconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
|
||||||
|
|
||||||
|
|
||||||
|
if (npc.GetUniqueId().Equals("1") && milliseconds - lastMilis > 1000)
|
||||||
|
{
|
||||||
|
lastMilis = milliseconds;
|
||||||
|
GetActor().QueuePacket(RemoveActorPacket.BuildPacket(playerActor.actorId, actorInstanceList[i].actorId));
|
||||||
|
actorInstanceList.RemoveAt(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!list.Contains(actorInstanceList[i]))
|
if (!list.Contains(actorInstanceList[i]))
|
||||||
{
|
{
|
||||||
GetActor().QueuePacket(RemoveActorPacket.BuildPacket(playerActor.actorId, actorInstanceList[i].actorId));
|
GetActor().QueuePacket(RemoveActorPacket.BuildPacket(playerActor.actorId, actorInstanceList[i].actorId));
|
||||||
actorInstanceList.RemoveAt(i);
|
actorInstanceList.RemoveAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Add new actors or move
|
//Add new actors or move
|
||||||
|
@ -29,6 +29,11 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||||||
return (uint)(partyGroupWork._globalTemp.owner & 0xFFFFFF);
|
return (uint)(partyGroupWork._globalTemp.owner & 0xFFFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsInParty(uint charaId)
|
||||||
|
{
|
||||||
|
return members.Contains(charaId);
|
||||||
|
}
|
||||||
|
|
||||||
public override void SendInitWorkValues(Session session)
|
public override void SendInitWorkValues(Session session)
|
||||||
{
|
{
|
||||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||||
|
@ -64,12 +64,6 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Actor\Group\Group.cs" />
|
|
||||||
<Compile Include="Actor\Group\GroupInvitationRelationGroup.cs" />
|
|
||||||
<Compile Include="Actor\Group\GroupMember.cs" />
|
|
||||||
<Compile Include="Actor\Group\LinkshellGroup.cs" />
|
|
||||||
<Compile Include="Actor\Group\PartyGroup.cs" />
|
|
||||||
<Compile Include="Actor\Group\RetainerGroup.cs" />
|
|
||||||
<Compile Include="Actor\Group\Work\ContentWork.cs" />
|
<Compile Include="Actor\Group\Work\ContentWork.cs" />
|
||||||
<Compile Include="Actor\Group\Work\GroupGlobalSave.cs" />
|
<Compile Include="Actor\Group\Work\GroupGlobalSave.cs" />
|
||||||
<Compile Include="Actor\Group\Work\GroupGlobalTemp.cs" />
|
<Compile Include="Actor\Group\Work\GroupGlobalTemp.cs" />
|
||||||
@ -93,6 +87,7 @@
|
|||||||
<Compile Include="LinkshellManager.cs" />
|
<Compile Include="LinkshellManager.cs" />
|
||||||
<Compile Include="PacketProcessor.cs" />
|
<Compile Include="PacketProcessor.cs" />
|
||||||
<Compile Include="Packets\Receive\HelloPacket.cs" />
|
<Compile Include="Packets\Receive\HelloPacket.cs" />
|
||||||
|
<Compile Include="Packets\Receive\Subpackets\GroupCreatedPacket.cs" />
|
||||||
<Compile Include="Packets\Send\Subpackets\Groups\CreateNamedGroup.cs" />
|
<Compile Include="Packets\Send\Subpackets\Groups\CreateNamedGroup.cs" />
|
||||||
<Compile Include="Packets\Send\Subpackets\Groups\CreateNamedGroupMultiple.cs" />
|
<Compile Include="Packets\Send\Subpackets\Groups\CreateNamedGroupMultiple.cs" />
|
||||||
<Compile Include="Packets\Send\Subpackets\Groups\DeleteGroupPacket.cs" />
|
<Compile Include="Packets\Send\Subpackets\Groups\DeleteGroupPacket.cs" />
|
||||||
|
@ -9,14 +9,14 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
class LinkshellManager
|
class LinkshellManager
|
||||||
{
|
{
|
||||||
private Server mServer;
|
private WorldManager mWorldManager;
|
||||||
private Object mGroupLockReference;
|
private Object mGroupLockReference;
|
||||||
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
||||||
private Dictionary<ulong, Linkshell> mLinkshellList = new Dictionary<ulong, Linkshell>();
|
private Dictionary<ulong, Linkshell> mLinkshellList = new Dictionary<ulong, Linkshell>();
|
||||||
|
|
||||||
public LinkshellManager(Server server, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
public LinkshellManager(WorldManager worldManager, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
||||||
{
|
{
|
||||||
mServer = server;
|
mWorldManager = worldManager;
|
||||||
mGroupLockReference = groupLock;
|
mGroupLockReference = groupLock;
|
||||||
mCurrentWorldGroupsReference = worldGroupList;
|
mCurrentWorldGroupsReference = worldGroupList;
|
||||||
}
|
}
|
||||||
@ -29,14 +29,14 @@ namespace FFXIVClassic_World_Server
|
|||||||
ulong resultId = Database.CreateLinkshell(name, crest, master);
|
ulong resultId = Database.CreateLinkshell(name, crest, master);
|
||||||
if (resultId >= 0)
|
if (resultId >= 0)
|
||||||
{
|
{
|
||||||
Linkshell newLs = new Linkshell(resultId, mServer.GetGroupIndex(), name, crest, master, 0xa);
|
Linkshell newLs = new Linkshell(resultId, mWorldManager.GetGroupIndex(), name, crest, master, 0xa);
|
||||||
|
|
||||||
//Add founder to the LS
|
//Add founder to the LS
|
||||||
if (AddMemberToLinkshell(master, newLs.groupIndex))
|
if (AddMemberToLinkshell(master, newLs.groupIndex))
|
||||||
{
|
{
|
||||||
mLinkshellList.Add(mServer.GetGroupIndex(), newLs);
|
mLinkshellList.Add(mWorldManager.GetGroupIndex(), newLs);
|
||||||
mCurrentWorldGroupsReference.Add(mServer.GetGroupIndex(), newLs);
|
mCurrentWorldGroupsReference.Add(mWorldManager.GetGroupIndex(), newLs);
|
||||||
mServer.IncrementGroupIndex();
|
mWorldManager.IncrementGroupIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resultId;
|
return resultId;
|
||||||
@ -126,14 +126,14 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
lock (mGroupLockReference)
|
lock (mGroupLockReference)
|
||||||
{
|
{
|
||||||
Linkshell ls = Database.GetLinkshell(mServer.GetGroupIndex(), id);
|
Linkshell ls = Database.GetLinkshell(mWorldManager.GetGroupIndex(), id);
|
||||||
ls.LoadMembers();
|
ls.LoadMembers();
|
||||||
|
|
||||||
if (ls != null)
|
if (ls != null)
|
||||||
{
|
{
|
||||||
mLinkshellList.Add(id, ls);
|
mLinkshellList.Add(id, ls);
|
||||||
mCurrentWorldGroupsReference.Add(mServer.GetGroupIndex(), ls);
|
mCurrentWorldGroupsReference.Add(mWorldManager.GetGroupIndex(), ls);
|
||||||
mServer.IncrementGroupIndex();
|
mWorldManager.IncrementGroupIndex();
|
||||||
return ls;
|
return ls;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,27 +6,30 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
class PartyManager
|
class PartyManager
|
||||||
{
|
{
|
||||||
private Server mServer;
|
private WorldManager mWorldManager;
|
||||||
private Object mGroupLockReference;
|
private Object mGroupLockReference;
|
||||||
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
||||||
private Dictionary<ulong, Party> mPartyList = new Dictionary<ulong, Party>();
|
private Dictionary<ulong, Party> mPartyList = new Dictionary<ulong, Party>();
|
||||||
|
private Dictionary<uint, Party> mPlayerPartyLookup = new Dictionary<uint, Party>();
|
||||||
|
|
||||||
public PartyManager(Server server, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
public PartyManager(WorldManager worldManager, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
||||||
{
|
{
|
||||||
mServer = server;
|
mWorldManager = worldManager;
|
||||||
mGroupLockReference = groupLock;
|
mGroupLockReference = groupLock;
|
||||||
mCurrentWorldGroupsReference = worldGroupList;
|
mCurrentWorldGroupsReference = worldGroupList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateParty(uint leaderCharaId)
|
public Party CreateParty(uint leaderCharaId)
|
||||||
{
|
{
|
||||||
lock (mGroupLockReference)
|
lock (mGroupLockReference)
|
||||||
{
|
{
|
||||||
ulong groupId = mServer.GetGroupIndex();
|
ulong groupId = mWorldManager.GetGroupIndex();
|
||||||
Party party = new Party(groupId, leaderCharaId);
|
Party party = new Party(groupId, leaderCharaId);
|
||||||
mPartyList.Add(groupId, party);
|
mPartyList.Add(groupId, party);
|
||||||
|
mPlayerPartyLookup.Add(leaderCharaId, party);
|
||||||
mCurrentWorldGroupsReference.Add(groupId, party);
|
mCurrentWorldGroupsReference.Add(groupId, party);
|
||||||
mServer.IncrementGroupIndex();
|
mWorldManager.IncrementGroupIndex();
|
||||||
|
return party;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +47,11 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
Party party = mPartyList[groupId];
|
Party party = mPartyList[groupId];
|
||||||
if (!party.members.Contains(charaId))
|
if (!party.members.Contains(charaId))
|
||||||
|
{
|
||||||
party.members.Add(charaId);
|
party.members.Add(charaId);
|
||||||
|
mPlayerPartyLookup.Remove(charaId);
|
||||||
|
mPlayerPartyLookup.Add(charaId, party);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -58,6 +65,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
if (party.members.Contains(charaId))
|
if (party.members.Contains(charaId))
|
||||||
{
|
{
|
||||||
party.members.Remove(charaId);
|
party.members.Remove(charaId);
|
||||||
|
mPlayerPartyLookup.Remove(charaId);
|
||||||
|
|
||||||
//If current ldr, make a new ldr if not empty pt
|
//If current ldr, make a new ldr if not empty pt
|
||||||
if (party.GetLeader() == charaId && party.members.Count != 0)
|
if (party.GetLeader() == charaId && party.members.Count != 0)
|
||||||
@ -81,5 +89,13 @@ namespace FFXIVClassic_World_Server
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Party GetParty(uint charaId)
|
||||||
|
{
|
||||||
|
if (mPlayerPartyLookup.ContainsKey(charaId))
|
||||||
|
return mPlayerPartyLookup[charaId];
|
||||||
|
else
|
||||||
|
return CreateParty(charaId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,14 +6,14 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
class RelationGroupManager
|
class RelationGroupManager
|
||||||
{
|
{
|
||||||
private Server mServer;
|
private WorldManager mWorldManager;
|
||||||
private Object mGroupLockReference;
|
private Object mGroupLockReference;
|
||||||
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
||||||
private Dictionary<ulong, Relation> mRelationList = new Dictionary<ulong, Relation>();
|
private Dictionary<ulong, Relation> mRelationList = new Dictionary<ulong, Relation>();
|
||||||
|
|
||||||
public RelationGroupManager(Server server, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
public RelationGroupManager(WorldManager worldManager, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
||||||
{
|
{
|
||||||
mServer = server;
|
mWorldManager = worldManager;
|
||||||
mGroupLockReference = groupLock;
|
mGroupLockReference = groupLock;
|
||||||
mCurrentWorldGroupsReference = worldGroupList;
|
mCurrentWorldGroupsReference = worldGroupList;
|
||||||
}
|
}
|
||||||
@ -22,11 +22,11 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
lock (mGroupLockReference)
|
lock (mGroupLockReference)
|
||||||
{
|
{
|
||||||
ulong groupIndex = mServer.GetGroupIndex();
|
ulong groupIndex = mWorldManager.GetGroupIndex();
|
||||||
Relation relation = new Relation(groupIndex, hostCharaId, otherCharaId, command);
|
Relation relation = new Relation(groupIndex, hostCharaId, otherCharaId, command);
|
||||||
mRelationList.Add(groupIndex, relation);
|
mRelationList.Add(groupIndex, relation);
|
||||||
mCurrentWorldGroupsReference.Add(groupIndex, relation);
|
mCurrentWorldGroupsReference.Add(groupIndex, relation);
|
||||||
mServer.IncrementGroupIndex();
|
mWorldManager.IncrementGroupIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,14 +9,14 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
class RetainerGroupManager
|
class RetainerGroupManager
|
||||||
{
|
{
|
||||||
private Server mServer;
|
private WorldManager mWorldManager;
|
||||||
private Object mGroupLockReference;
|
private Object mGroupLockReference;
|
||||||
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
||||||
private Dictionary<uint, RetainerGroup> mRetainerGroupList = new Dictionary<uint, RetainerGroup>();
|
private Dictionary<uint, RetainerGroup> mRetainerGroupList = new Dictionary<uint, RetainerGroup>();
|
||||||
|
|
||||||
public RetainerGroupManager(Server server, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
public RetainerGroupManager(WorldManager worldManager, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
||||||
{
|
{
|
||||||
mServer = server;
|
mWorldManager = worldManager;
|
||||||
mGroupLockReference = groupLock;
|
mGroupLockReference = groupLock;
|
||||||
mCurrentWorldGroupsReference = worldGroupList;
|
mCurrentWorldGroupsReference = worldGroupList;
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
lock(mGroupLockReference)
|
lock(mGroupLockReference)
|
||||||
{
|
{
|
||||||
ulong groupId = mServer.GetGroupIndex();
|
ulong groupId = mWorldManager.GetGroupIndex();
|
||||||
RetainerGroup retainerGroup = new RetainerGroup(groupId, charaId);
|
RetainerGroup retainerGroup = new RetainerGroup(groupId, charaId);
|
||||||
|
|
||||||
Dictionary<uint, RetainerGroupMember> members = Database.GetRetainers(charaId);
|
Dictionary<uint, RetainerGroupMember> members = Database.GetRetainers(charaId);
|
||||||
@ -44,7 +44,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
mRetainerGroupList.Add(charaId, retainerGroup);
|
mRetainerGroupList.Add(charaId, retainerGroup);
|
||||||
mCurrentWorldGroupsReference.Add(groupId, retainerGroup);
|
mCurrentWorldGroupsReference.Add(groupId, retainerGroup);
|
||||||
|
|
||||||
mServer.IncrementGroupIndex();
|
mWorldManager.IncrementGroupIndex();
|
||||||
|
|
||||||
return retainerGroup;
|
return retainerGroup;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using FFXIVClassic_World_Server.DataObjects;
|
using FFXIVClassic_World_Server.DataObjects;
|
||||||
using FFXIVClassic_World_Server.DataObjects.Group;
|
using FFXIVClassic_World_Server.DataObjects.Group;
|
||||||
using FFXIVClassic_World_Server.Packets.Receive.Subpackets;
|
using FFXIVClassic_World_Server.Packets.Receive.Subpackets;
|
||||||
|
using FFXIVClassic_World_Server.Packets.Send.Subpackets.Groups;
|
||||||
using FFXIVClassic_World_Server.Packets.WorldPackets.Receive;
|
using FFXIVClassic_World_Server.Packets.WorldPackets.Receive;
|
||||||
using FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group;
|
using FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group;
|
||||||
using System;
|
using System;
|
||||||
@ -31,23 +32,9 @@ namespace FFXIVClassic_World_Server
|
|||||||
private Dictionary<uint, Session> mZoneSessionList = new Dictionary<uint, Session>();
|
private Dictionary<uint, Session> mZoneSessionList = new Dictionary<uint, Session>();
|
||||||
private Dictionary<uint, Session> mChatSessionList = new Dictionary<uint, Session>();
|
private Dictionary<uint, Session> mChatSessionList = new Dictionary<uint, Session>();
|
||||||
|
|
||||||
//World Scope Group Management
|
|
||||||
private Object mGroupLock = new object();
|
|
||||||
private ulong mRunningGroupIndex = 1;
|
|
||||||
private Dictionary<ulong, Group> mCurrentWorldGroups = new Dictionary<ulong, Group>();
|
|
||||||
|
|
||||||
private PartyManager mPartyManager;
|
|
||||||
private RetainerGroupManager mRetainerGroupManager;
|
|
||||||
private LinkshellManager mLinkshellManager;
|
|
||||||
private RelationGroupManager mRelationGroupManager;
|
|
||||||
|
|
||||||
public Server()
|
public Server()
|
||||||
{
|
{
|
||||||
mSelf = this;
|
mSelf = this;
|
||||||
mPartyManager = new PartyManager(this, mGroupLock, mCurrentWorldGroups);
|
|
||||||
mLinkshellManager = new LinkshellManager(this, mGroupLock, mCurrentWorldGroups);
|
|
||||||
mRetainerGroupManager = new RetainerGroupManager(this, mGroupLock, mCurrentWorldGroups);
|
|
||||||
mRelationGroupManager = new RelationGroupManager(this, mGroupLock, mCurrentWorldGroups);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Server GetServer()
|
public static Server GetServer()
|
||||||
@ -58,6 +45,9 @@ namespace FFXIVClassic_World_Server
|
|||||||
public bool StartServer()
|
public bool StartServer()
|
||||||
{
|
{
|
||||||
mPacketProcessor = new PacketProcessor(this);
|
mPacketProcessor = new PacketProcessor(this);
|
||||||
|
|
||||||
|
LoadCharaNames();
|
||||||
|
|
||||||
mWorldManager = new WorldManager(this);
|
mWorldManager = new WorldManager(this);
|
||||||
mWorldManager.LoadZoneServerList();
|
mWorldManager.LoadZoneServerList();
|
||||||
mWorldManager.LoadZoneEntranceList();
|
mWorldManager.LoadZoneEntranceList();
|
||||||
@ -213,22 +203,22 @@ namespace FFXIVClassic_World_Server
|
|||||||
//Group get data request
|
//Group get data request
|
||||||
case 0x1020:
|
case 0x1020:
|
||||||
GetGroupPacket getGroupPacket = new GetGroupPacket(subpacket.data);
|
GetGroupPacket getGroupPacket = new GetGroupPacket(subpacket.data);
|
||||||
SendGroupData(session, getGroupPacket.groupId);
|
mWorldManager.SendGroupData(session, getGroupPacket.groupId);
|
||||||
break;
|
break;
|
||||||
//Group delete request
|
//Group delete request
|
||||||
case 0x1021:
|
case 0x1021:
|
||||||
DeleteGroupPacket deleteGroupPacket = new DeleteGroupPacket(subpacket.data);
|
FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group.DeleteGroupPacket deleteGroupPacket = new FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group.DeleteGroupPacket(subpacket.data);
|
||||||
DeleteGroup(deleteGroupPacket.groupId);
|
mWorldManager.DeleteGroup(deleteGroupPacket.groupId);
|
||||||
break;
|
break;
|
||||||
//Linkshell create request
|
//Linkshell create request
|
||||||
case 0x1023:
|
case 0x1023:
|
||||||
CreateLinkshellPacket createLinkshellpacket = new CreateLinkshellPacket(subpacket.data);
|
CreateLinkshellPacket createLinkshellpacket = new CreateLinkshellPacket(subpacket.data);
|
||||||
mLinkshellManager.CreateLinkshell(createLinkshellpacket.name, createLinkshellpacket.crestid, createLinkshellpacket.master);
|
mWorldManager.GetLinkshellManager().CreateLinkshell(createLinkshellpacket.name, createLinkshellpacket.crestid, createLinkshellpacket.master);
|
||||||
break;
|
break;
|
||||||
//Linkshell modify request
|
//Linkshell modify request
|
||||||
case 0x1024:
|
case 0x1024:
|
||||||
ModifyLinkshellPacket modifyLinkshellpacket = new ModifyLinkshellPacket(subpacket.data);
|
ModifyLinkshellPacket modifyLinkshellpacket = new ModifyLinkshellPacket(subpacket.data);
|
||||||
mLinkshellManager.ModifyLinkshell();
|
mWorldManager.GetLinkshellManager().ModifyLinkshell();
|
||||||
break;
|
break;
|
||||||
//Group Add/Remove Member
|
//Group Add/Remove Member
|
||||||
case 0x1022:
|
case 0x1022:
|
||||||
@ -240,11 +230,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
else if (subpacket.gameMessage.opcode == 0x133)
|
else if (subpacket.gameMessage.opcode == 0x133)
|
||||||
{
|
{
|
||||||
GroupCreatedPacket groupCreatedPacket = new GroupCreatedPacket(subpacket.data);
|
GroupCreatedPacket groupCreatedPacket = new GroupCreatedPacket(subpacket.data);
|
||||||
if (mCurrentWorldGroups.ContainsKey(groupCreatedPacket.groupId))
|
if (!mWorldManager.SendGroupInit(session, groupCreatedPacket.groupId))
|
||||||
{
|
|
||||||
mCurrentWorldGroups[groupCreatedPacket.groupId].SendInitWorkValues(session);
|
|
||||||
}
|
|
||||||
else //Not a world group, send to zone server
|
|
||||||
{
|
{
|
||||||
ClientConnection conn = mZoneSessionList[sessionId].clientConnection;
|
ClientConnection conn = mZoneSessionList[sessionId].clientConnection;
|
||||||
conn.QueuePacket(subpacket, true, false);
|
conn.QueuePacket(subpacket, true, false);
|
||||||
@ -414,66 +400,5 @@ namespace FFXIVClassic_World_Server
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendGroupData(Session session, ulong groupId)
|
|
||||||
{
|
|
||||||
if (mCurrentWorldGroups.ContainsKey(groupId))
|
|
||||||
{
|
|
||||||
Group group = mCurrentWorldGroups[groupId];
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SendGroupDataToAllMembers(ulong groupId)
|
|
||||||
{
|
|
||||||
if (mCurrentWorldGroups.ContainsKey(groupId))
|
|
||||||
{
|
|
||||||
Group group = mCurrentWorldGroups[groupId];
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void GetGroup(Group group)
|
|
||||||
{
|
|
||||||
if (group is Party)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (group is RetainerGroup)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (group is Linkshell)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else if (group is Relation)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DeleteGroup(ulong id)
|
|
||||||
{
|
|
||||||
if (!mCurrentWorldGroups.ContainsKey(id))
|
|
||||||
return;
|
|
||||||
Group group = mCurrentWorldGroups[id];
|
|
||||||
if (group is Party)
|
|
||||||
mPartyManager.DeleteParty(group.groupIndex);
|
|
||||||
else if (group is Linkshell)
|
|
||||||
mLinkshellManager.DeleteLinkshell(group.groupIndex);
|
|
||||||
else if (group is Relation)
|
|
||||||
mRelationGroupManager.DeleteRelationGroup(group.groupIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void IncrementGroupIndex()
|
|
||||||
{
|
|
||||||
mRunningGroupIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ulong GetGroupIndex()
|
|
||||||
{
|
|
||||||
return mRunningGroupIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using FFXIVClassic.Common;
|
using FFXIVClassic.Common;
|
||||||
using FFXIVClassic_World_Server.DataObjects;
|
using FFXIVClassic_World_Server.DataObjects;
|
||||||
|
using FFXIVClassic_World_Server.DataObjects.Group;
|
||||||
|
using FFXIVClassic_World_Server.Packets.Send.Subpackets.Groups;
|
||||||
using FFXIVClassic_World_Server.Packets.WorldPackets.Send;
|
using FFXIVClassic_World_Server.Packets.WorldPackets.Send;
|
||||||
using MySql.Data.MySqlClient;
|
using MySql.Data.MySqlClient;
|
||||||
using System;
|
using System;
|
||||||
@ -18,9 +20,23 @@ namespace FFXIVClassic_World_Server
|
|||||||
public Dictionary<string, ZoneServer> mZoneServerList;
|
public Dictionary<string, ZoneServer> mZoneServerList;
|
||||||
private Dictionary<uint, ZoneEntrance> zoneEntranceList;
|
private Dictionary<uint, ZoneEntrance> zoneEntranceList;
|
||||||
|
|
||||||
|
//World Scope Group Management
|
||||||
|
private Object mGroupLock = new object();
|
||||||
|
private ulong mRunningGroupIndex = 1;
|
||||||
|
private Dictionary<ulong, Group> mCurrentWorldGroups = new Dictionary<ulong, Group>();
|
||||||
|
|
||||||
|
private PartyManager mPartyManager;
|
||||||
|
private RetainerGroupManager mRetainerGroupManager;
|
||||||
|
private LinkshellManager mLinkshellManager;
|
||||||
|
private RelationGroupManager mRelationGroupManager;
|
||||||
|
|
||||||
public WorldManager(Server server)
|
public WorldManager(Server server)
|
||||||
{
|
{
|
||||||
mServer = server;
|
mServer = server;
|
||||||
|
mPartyManager = new PartyManager(this, mGroupLock, mCurrentWorldGroups);
|
||||||
|
mLinkshellManager = new LinkshellManager(this, mGroupLock, mCurrentWorldGroups);
|
||||||
|
mRetainerGroupManager = new RetainerGroupManager(this, mGroupLock, mCurrentWorldGroups);
|
||||||
|
mRelationGroupManager = new RelationGroupManager(this, mGroupLock, mCurrentWorldGroups);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadZoneServerList()
|
public void LoadZoneServerList()
|
||||||
@ -216,6 +232,72 @@ namespace FFXIVClassic_World_Server
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SendGroupData(Session session, ulong groupId)
|
||||||
|
{
|
||||||
|
if (mCurrentWorldGroups.ContainsKey(groupId))
|
||||||
|
{
|
||||||
|
Group group = mCurrentWorldGroups[groupId];
|
||||||
|
group.SendGroupPackets(session);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendGroupDataToAllMembers(ulong groupId)
|
||||||
|
{
|
||||||
|
if (mCurrentWorldGroups.ContainsKey(groupId))
|
||||||
|
{
|
||||||
|
Group group = mCurrentWorldGroups[groupId];
|
||||||
|
foreach (GroupMember member in group.BuildMemberList())
|
||||||
|
group.SendGroupPackets(mServer.GetSession(member.actorId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteGroup(ulong id)
|
||||||
|
{
|
||||||
|
if (!mCurrentWorldGroups.ContainsKey(id))
|
||||||
|
return;
|
||||||
|
Group group = mCurrentWorldGroups[id];
|
||||||
|
if (group is Party)
|
||||||
|
mPartyManager.DeleteParty(group.groupIndex);
|
||||||
|
else if (group is Linkshell)
|
||||||
|
mLinkshellManager.DeleteLinkshell(group.groupIndex);
|
||||||
|
else if (group is Relation)
|
||||||
|
mRelationGroupManager.DeleteRelationGroup(group.groupIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void IncrementGroupIndex()
|
||||||
|
{
|
||||||
|
mRunningGroupIndex++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ulong GetGroupIndex()
|
||||||
|
{
|
||||||
|
return mRunningGroupIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool SendGroupInit(Session session, ulong groupId)
|
||||||
|
{
|
||||||
|
if (mCurrentWorldGroups.ContainsKey(groupId))
|
||||||
|
{
|
||||||
|
mCurrentWorldGroups[groupId].SendInitWorkValues(session);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PartyManager GetPartyManager()
|
||||||
|
{
|
||||||
|
return mPartyManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RetainerGroupManager GetRetainerManager()
|
||||||
|
{
|
||||||
|
return mRetainerGroupManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinkshellManager GetLinkshellManager()
|
||||||
|
{
|
||||||
|
return mLinkshellManager;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user