Got linkshell creation working.

This commit is contained in:
Filip Maj 2018-04-10 01:07:11 -04:00
parent c3c19c3592
commit 1d3dd99414
10 changed files with 149 additions and 13 deletions

View file

@ -23,8 +23,22 @@ namespace FFXIVClassic_World_Server
mCurrentWorldGroupsReference = worldGroupList;
}
//Checks if the LS name is in use or banned
public int CanCreateLinkshell(string name)
{
bool nameBanned = Database.LinkshellIsBannedName(name);
bool alreadyExists = Database.LinkshellExists(name);
if (nameBanned)
return 2;
if (alreadyExists)
return 1;
else
return 0;
}
//Creates a new linkshell and adds it to the list
public ulong CreateLinkshell(string name, ushort crest, uint master)
public Linkshell CreateLinkshell(string name, ushort crest, uint master)
{
lock (mGroupLockReference)
{
@ -32,18 +46,19 @@ namespace FFXIVClassic_World_Server
if (resultId >= 0)
{
Linkshell newLs = new Linkshell(resultId, mWorldManager.GetGroupIndex(), name, crest, master, 0xa);
mLinkshellList.Add(mWorldManager.GetGroupIndex(), newLs);
mNameToIdLookup.Add(newLs.name, newLs.groupIndex);
mLSIdToIdLookup.Add(newLs.dbId, newLs);
mCurrentWorldGroupsReference.Add(mWorldManager.GetGroupIndex(), newLs);
mWorldManager.IncrementGroupIndex();
//Add founder to the LS
if (AddMemberToLinkshell(master, newLs.name))
{
mLinkshellList.Add(mWorldManager.GetGroupIndex(), newLs);
mNameToIdLookup.Add(newLs.name, newLs.groupIndex);
mLSIdToIdLookup.Add(newLs.dbId, newLs);
mCurrentWorldGroupsReference.Add(mWorldManager.GetGroupIndex(), newLs);
mWorldManager.IncrementGroupIndex();
}
AddMemberToLinkshell(master, newLs.name);
return newLs;
}
return resultId;
return null;
}
}