mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Fixed linkshell invites being stackable. Fixed founder of a LS not being set to master.
This commit is contained in:
parent
a07aa12783
commit
8a03c40af9
@ -46,9 +46,9 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
|
|||||||
work._memberSave[index].rank = rank;
|
work._memberSave[index].rank = rank;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddMember(uint charaId)
|
public void AddMember(uint charaId, byte rank = LinkshellManager.RANK_MEMBER)
|
||||||
{
|
{
|
||||||
members.Add(new LinkshellMember(charaId, dbId, 0x4));
|
members.Add(new LinkshellMember(charaId, dbId, rank));
|
||||||
members.Sort();
|
members.Sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool LinkshellAddPlayer(ulong lsId, uint charaId)
|
public static bool LinkshellAddPlayer(ulong lsId, uint charaId, byte rank = LinkshellManager.RANK_MEMBER)
|
||||||
{
|
{
|
||||||
string query;
|
string query;
|
||||||
MySqlCommand cmd;
|
MySqlCommand cmd;
|
||||||
@ -394,14 +394,15 @@ namespace FFXIVClassic_World_Server
|
|||||||
|
|
||||||
query = @"
|
query = @"
|
||||||
INSERT INTO characters_linkshells
|
INSERT INTO characters_linkshells
|
||||||
(characterId, linkshellId)
|
(characterId, linkshellId, rank)
|
||||||
VALUES
|
VALUES
|
||||||
(@charaId, @lsId)
|
(@charaId, @lsId, @rank)
|
||||||
";
|
";
|
||||||
|
|
||||||
cmd = new MySqlCommand(query, conn);
|
cmd = new MySqlCommand(query, conn);
|
||||||
cmd.Parameters.AddWithValue("@charaId", charaId);
|
cmd.Parameters.AddWithValue("@charaId", charaId);
|
||||||
cmd.Parameters.AddWithValue("@lsId", lsId);
|
cmd.Parameters.AddWithValue("@lsId", lsId);
|
||||||
|
cmd.Parameters.AddWithValue("@rank", rank);
|
||||||
cmd.ExecuteNonQuery();
|
cmd.ExecuteNonQuery();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,11 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
class LinkshellManager
|
class LinkshellManager
|
||||||
{
|
{
|
||||||
|
public const byte RANK_GUEST = 0x1;
|
||||||
|
public const byte RANK_MEMBER = 0x4;
|
||||||
|
public const byte RANK_LEADER = 0x7;
|
||||||
|
public const byte RANK_MASTER = 0xA;
|
||||||
|
|
||||||
private WorldManager mWorldManager;
|
private WorldManager mWorldManager;
|
||||||
private Object mGroupLockReference;
|
private Object mGroupLockReference;
|
||||||
private Dictionary<ulong, Group> mCurrentWorldGroupsReference; //GroupId, LS
|
private Dictionary<ulong, Group> mCurrentWorldGroupsReference; //GroupId, LS
|
||||||
@ -42,7 +47,7 @@ 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, mWorldManager.GetGroupIndex(), name, crest, master, 0xa);
|
Linkshell newLs = new Linkshell(resultId, mWorldManager.GetGroupIndex(), name, crest, master, RANK_MASTER);
|
||||||
|
|
||||||
mLinkshellList.Add(mWorldManager.GetGroupIndex(), newLs);
|
mLinkshellList.Add(mWorldManager.GetGroupIndex(), newLs);
|
||||||
mNameToIdLookup.Add(newLs.name, newLs.groupIndex);
|
mNameToIdLookup.Add(newLs.name, newLs.groupIndex);
|
||||||
@ -51,7 +56,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
mWorldManager.IncrementGroupIndex();
|
mWorldManager.IncrementGroupIndex();
|
||||||
|
|
||||||
//Add founder to the LS
|
//Add founder to the LS
|
||||||
AddMemberToLinkshell(master, newLs.name);
|
AddMemberToLinkshell(master, newLs.name, RANK_MASTER);
|
||||||
|
|
||||||
return newLs;
|
return newLs;
|
||||||
}
|
}
|
||||||
@ -125,7 +130,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Adds a player to the linkshell
|
//Adds a player to the linkshell
|
||||||
public bool AddMemberToLinkshell(uint charaId, string LSName)
|
public bool AddMemberToLinkshell(uint charaId, string LSName, byte rank = RANK_MEMBER)
|
||||||
{
|
{
|
||||||
//Get the LS
|
//Get the LS
|
||||||
Linkshell ls = GetLinkshell(LSName);
|
Linkshell ls = GetLinkshell(LSName);
|
||||||
@ -135,11 +140,11 @@ namespace FFXIVClassic_World_Server
|
|||||||
//Add player to ls in db
|
//Add player to ls in db
|
||||||
lock (mGroupLockReference)
|
lock (mGroupLockReference)
|
||||||
{
|
{
|
||||||
bool result = Database.LinkshellAddPlayer(ls.dbId, charaId);
|
bool result = Database.LinkshellAddPlayer(ls.dbId, charaId, rank);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
ls.AddMember(charaId);
|
ls.AddMember(charaId, rank);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -180,6 +185,10 @@ namespace FFXIVClassic_World_Server
|
|||||||
lock (mGroupLockReference)
|
lock (mGroupLockReference)
|
||||||
{
|
{
|
||||||
Linkshell ls = Database.GetLinkshell(mWorldManager.GetGroupIndex(), name);
|
Linkshell ls = Database.GetLinkshell(mWorldManager.GetGroupIndex(), name);
|
||||||
|
|
||||||
|
if (ls == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
ls.LoadMembers();
|
ls.LoadMembers();
|
||||||
|
|
||||||
if (ls != null)
|
if (ls != null)
|
||||||
|
@ -356,7 +356,7 @@ namespace FFXIVClassic_World_Server
|
|||||||
{
|
{
|
||||||
inviterSession.SendGameMessage(30544, 0x20);
|
inviterSession.SendGameMessage(30544, 0x20);
|
||||||
}
|
}
|
||||||
else if (mRelationGroupManager.GetLinkshellRelationGroup(inviterSession.sessionId) != null)
|
else if (mRelationGroupManager.GetLinkshellRelationGroup(invitee) != null)
|
||||||
{
|
{
|
||||||
Session inviteeSession = mServer.GetSession(invitee);
|
Session inviteeSession = mServer.GetSession(invitee);
|
||||||
inviterSession.SendGameMessage(25196, 0x20, (object)inviteeSession); //Unable to invite X another pending
|
inviterSession.SendGameMessage(25196, 0x20, (object)inviteeSession); //Unable to invite X another pending
|
||||||
|
Loading…
Reference in New Issue
Block a user