mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-06-10 06:24:38 +02:00
Added all the base code for managing world-scope groups.
This commit is contained in:
parent
09e1e31e79
commit
31b13300ac
20 changed files with 940 additions and 4 deletions
41
FFXIVClassic World Server/RelationGroupManager.cs
Normal file
41
FFXIVClassic World Server/RelationGroupManager.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using FFXIVClassic_World_Server.DataObjects.Group;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace FFXIVClassic_World_Server
|
||||
{
|
||||
class RelationGroupManager
|
||||
{
|
||||
private Server mServer;
|
||||
private Object mGroupLockReference;
|
||||
private Dictionary<ulong, Group> mCurrentWorldGroupsReference;
|
||||
private Dictionary<ulong, Relation> mRelationList = new Dictionary<ulong, Relation>();
|
||||
|
||||
public RelationGroupManager(Server server, Object groupLock, Dictionary<ulong, Group> worldGroupList)
|
||||
{
|
||||
mServer = server;
|
||||
mGroupLockReference = groupLock;
|
||||
mCurrentWorldGroupsReference = worldGroupList;
|
||||
}
|
||||
|
||||
public void CreateRelationGroup(uint hostCharaId, uint otherCharaId, uint command)
|
||||
{
|
||||
lock (mGroupLockReference)
|
||||
{
|
||||
ulong groupIndex = mServer.GetGroupIndex();
|
||||
Relation relation = new Relation(groupIndex, hostCharaId, otherCharaId, command);
|
||||
mRelationList.Add(groupIndex, relation);
|
||||
mCurrentWorldGroupsReference.Add(groupIndex, relation);
|
||||
mServer.IncrementGroupIndex();
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteRelationGroup(ulong groupId)
|
||||
{
|
||||
if (mRelationList.ContainsKey(groupId))
|
||||
mRelationList.Remove(groupId);
|
||||
if (mCurrentWorldGroupsReference.ContainsKey(groupId))
|
||||
mCurrentWorldGroupsReference.Remove(groupId);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue