Linkshell inviting completed.

This commit is contained in:
Filip Maj 2017-01-08 21:42:43 -05:00
parent 8a0ebe7ec4
commit 108d8be013
22 changed files with 377 additions and 43 deletions

View file

@ -51,7 +51,7 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
public void AddMember(uint charaId)
{
members.Add(new LinkshellMember(charaId, dbId, 0xa));
members.Add(new LinkshellMember(charaId, dbId, 0x0));
members.Sort();
}
@ -85,10 +85,24 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
public override List<GroupMember> BuildMemberList(uint id)
{
List<GroupMember> groupMembers = new List<GroupMember>();
foreach (LinkshellMember member in members)
groupMembers.Add(new GroupMember(member.charaId, -1, 0, false, true, Server.GetServer().GetNameForId(member.charaId)));
return groupMembers;
lock (members)
{
List<GroupMember> groupMembers = new List<GroupMember>();
foreach (LinkshellMember member in members)
groupMembers.Add(new GroupMember(member.charaId, -1, 0, false, true, Server.GetServer().GetNameForId(member.charaId)));
return groupMembers;
}
}
public uint[] GetMemberIds()
{
lock (members)
{
uint[] memberIds = new uint[members.Count];
for (int i = 0; i < memberIds.Length; i++)
memberIds[i] = members[i].charaId;
return memberIds;
}
}
public override void SendInitWorkValues(Session session)
@ -115,5 +129,34 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
{
members = Database.GetLSMembers(this);
}
public void OnPlayerJoin(Session inviteeSession)
{
for (int i = 0; i < members.Count; i++)
{
Session session = Server.GetServer().GetSession(members[i].charaId);
if (session == null)
continue;
if (inviteeSession.Equals(session))
session.SendGameMessage(25157, 0x20, (object) 0, (object)inviteeSession, name);
else
session.SendGameMessage(25284, 0x20, (object) 0, (object)Server.GetServer().GetNameForId(inviteeSession.sessionId), name);
}
}
public bool HasMember(uint id)
{
lock (members)
{
for (int i = 0; i < members.Count; i++)
{
if (members[i].charaId == id)
return true;
}
return false;
}
}
}
}

View file

@ -12,13 +12,15 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
class Relation : Group
{
public RelationWork work = new RelationWork();
public uint charaOther;
private uint charaOther;
private ulong topicGroup;
public Relation(ulong groupIndex, uint host, uint other, uint command) : base (groupIndex)
public Relation(ulong groupIndex, uint host, uint other, uint command, ulong topicGroup) : base (groupIndex)
{
this.charaOther = other;
work._globalTemp.host = ((ulong)host << 32) | (0xc17909);
work._globalTemp.variableCommand = command;
this.topicGroup = topicGroup;
}
public uint GetHost()
@ -41,6 +43,11 @@ namespace FFXIVClassic_World_Server.DataObjects.Group
return Group.GroupInvitationRelationGroup;
}
public ulong GetTopicGroupIndex()
{
return topicGroup;
}
public override List<GroupMember> BuildMemberList(uint id)
{
List<GroupMember> groupMembers = new List<GroupMember>();

View file

@ -294,7 +294,11 @@ namespace FFXIVClassic_World_Server.DataObjects
else if (o == null)
{
luaParams.Add(new LuaParam(0x5, null));
}
}
else if (o is Session)
{
luaParams.Add(new LuaParam(0x6, (uint)((Session)o).sessionId));
}
else if (o is Type7Param)
{
luaParams.Add(new LuaParam(0x7, (Type7Param)o));

View file

@ -16,6 +16,7 @@ namespace FFXIVClassic_World_Server.DataObjects
public string characterName;
public uint currentZoneId;
public uint activeLinkshellIndex = 0;
public readonly ClientConnection clientConnection;
public readonly Channel type;
@ -27,7 +28,17 @@ namespace FFXIVClassic_World_Server.DataObjects
this.clientConnection = connection;
this.type = type;
connection.owner = this;
Database.LoadZoneSessionInfo(this);
Database.LoadZoneSessionInfo(this);
}
public void SendGameMessage(uint actorId, ushort textId, byte log, params object[] msgParams)
{
if (msgParams == null || msgParams.Length == 0)
{
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, sessionId, actorId, 0x5FF80001, textId, log), true, false);
}
else
clientConnection.QueuePacket(GameMessagePacket.BuildPacket(0x5FF80001, sessionId, actorId, 0x5FF80001, textId, log, LuaUtils.CreateLuaParamList(msgParams)), true, false);
}
public void SendGameMessage( ushort textId, byte log, params object[] msgParams)

View file

@ -77,7 +77,12 @@ namespace FFXIVClassic_World_Server.DataObjects
}
catch (Exception e)
{ Program.Log.Error("Weird case, socket was d/ced: {0}", e); }
}
}
else
{
if (Connect())
SendPacket(subpacket);
}
}
private void ReceiveCallback(IAsyncResult result)