mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-07-25 03:48:23 +02:00
Cleaned up namespaces (still have to do Map Project) and removed references to FFXIV Classic from the code. Removed the Launcher Editor project as it is no longer needed (host file editing is cleaner).
This commit is contained in:
parent
7587a6e142
commit
0f61c4c0e1
544 changed files with 54548 additions and 55498 deletions
158
World Server/DataObjects/Group/Group.cs
Normal file
158
World Server/DataObjects/Group/Group.cs
Normal file
|
@ -0,0 +1,158 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Meteor.Common;
|
||||
using Meteor.World.Packets.Send.Subpackets.Groups;
|
||||
|
||||
namespace Meteor.World.DataObjects.Group
|
||||
{
|
||||
class Group
|
||||
{
|
||||
public const uint PlayerPartyGroup = 10001;
|
||||
public const uint CompanyGroup = 20002;
|
||||
|
||||
public const uint GroupInvitationRelationGroup = 50001;
|
||||
public const uint TradeRelationGroup = 50002;
|
||||
public const uint RetainerMeetingRelationGroup = 50003;
|
||||
public const uint BazaarBuyItemRelationGroup = 50009;
|
||||
|
||||
public const uint RetainerGroup = 80001;
|
||||
|
||||
public readonly ulong groupIndex;
|
||||
|
||||
public Group(ulong groupIndex)
|
||||
{
|
||||
this.groupIndex = groupIndex;
|
||||
}
|
||||
|
||||
public virtual int GetMemberCount()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public virtual uint GetTypeId()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public virtual string GetGroupName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public virtual int GetGroupLocalizedName()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public virtual List<GroupMember> BuildMemberList(uint id)
|
||||
{
|
||||
return new List<GroupMember>();
|
||||
}
|
||||
|
||||
public void SendGroupPacketsAll(params uint[] sessionIds)
|
||||
{
|
||||
for (int i = 0; i < sessionIds.Length; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(sessionIds[i]);
|
||||
|
||||
if (session != null)
|
||||
SendGroupPackets(session);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendGroupPacketsAll(List<uint> sessionIds)
|
||||
{
|
||||
for (int i = 0; i < sessionIds.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(sessionIds[i]);
|
||||
|
||||
if (session != null)
|
||||
SendGroupPackets(session);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendDeletePackets(params uint[] sessionIds)
|
||||
{
|
||||
for (int i = 0; i < sessionIds.Length; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(sessionIds[i]);
|
||||
|
||||
if (session != null)
|
||||
SendDeletePacket(session);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendDeletePackets(List<uint> sessionIds)
|
||||
{
|
||||
for (int i = 0; i < sessionIds.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(sessionIds[i]);
|
||||
|
||||
if (session != null)
|
||||
SendDeletePacket(session);
|
||||
}
|
||||
}
|
||||
|
||||
public void SendGroupPackets(Session session)
|
||||
{
|
||||
ulong time = Utils.MilisUnixTimeStampUTC();
|
||||
List<GroupMember> members = BuildMemberList(session.sessionId);
|
||||
|
||||
session.clientConnection.QueuePacket(GroupHeaderPacket.buildPacket(session.sessionId, session.currentZoneId, time, this));
|
||||
session.clientConnection.QueuePacket(GroupMembersBeginPacket.buildPacket(session.sessionId, session.currentZoneId, time, this));
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
int memberCount = Math.Min(GetMemberCount(), members.Count);
|
||||
if (memberCount - currentIndex >= 64)
|
||||
session.clientConnection.QueuePacket(GroupMembersX64Packet.buildPacket(session.sessionId, session.currentZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex >= 32)
|
||||
session.clientConnection.QueuePacket(GroupMembersX32Packet.buildPacket(session.sessionId, session.currentZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex >= 16)
|
||||
session.clientConnection.QueuePacket(GroupMembersX16Packet.buildPacket(session.sessionId, session.currentZoneId, time, members, ref currentIndex));
|
||||
else if (memberCount - currentIndex > 0)
|
||||
session.clientConnection.QueuePacket(GroupMembersX08Packet.buildPacket(session.sessionId, session.currentZoneId, time, members, ref currentIndex));
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
session.clientConnection.QueuePacket(GroupMembersEndPacket.buildPacket(session.sessionId, session.currentZoneId, time, this));
|
||||
|
||||
}
|
||||
|
||||
public void SendDeletePacket(Session session)
|
||||
{
|
||||
if (session != null)
|
||||
session.clientConnection.QueuePacket(DeleteGroupPacket.buildPacket(session.sessionId, this));
|
||||
}
|
||||
|
||||
public virtual void SendInitWorkValues(Session session)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
329
World Server/DataObjects/Group/Linkshell.cs
Normal file
329
World Server/DataObjects/Group/Linkshell.cs
Normal file
|
@ -0,0 +1,329 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Meteor.Common;
|
||||
using Meteor.World.Actor.Group.Work;
|
||||
using Meteor.World.Packets.Send.Subpackets.Groups;
|
||||
|
||||
namespace Meteor.World.DataObjects.Group
|
||||
{
|
||||
class Linkshell : Group
|
||||
{
|
||||
public ulong dbId;
|
||||
public string name;
|
||||
|
||||
public LinkshellWork work = new LinkshellWork();
|
||||
|
||||
private List<LinkshellMember> members = new List<LinkshellMember>();
|
||||
|
||||
public Linkshell(ulong dbId, ulong groupIndex, string name, ushort crestId, uint master, byte rank) : base(groupIndex)
|
||||
{
|
||||
this.dbId = dbId;
|
||||
this.name = name;
|
||||
work._globalSave.crestIcon[0] = crestId;
|
||||
work._globalSave.master = master;
|
||||
work._globalSave.rank = rank;
|
||||
}
|
||||
|
||||
public void setMaster(uint actorId)
|
||||
{
|
||||
work._globalSave.master = (ulong)((0xB36F92 << 8) | actorId);
|
||||
}
|
||||
|
||||
public void setCrest(ushort crestId)
|
||||
{
|
||||
work._globalSave.crestIcon[0] = crestId;
|
||||
}
|
||||
|
||||
public void setRank(byte rank = 1)
|
||||
{
|
||||
work._globalSave.rank = rank;
|
||||
}
|
||||
|
||||
public void setMemberRank(int index, byte rank)
|
||||
{
|
||||
if (members.Count >= index)
|
||||
return;
|
||||
work._memberSave[index].rank = rank;
|
||||
}
|
||||
|
||||
public void AddMember(uint charaId, byte rank = LinkshellManager.RANK_MEMBER)
|
||||
{
|
||||
members.Add(new LinkshellMember(charaId, dbId, rank));
|
||||
members.Sort();
|
||||
}
|
||||
|
||||
public void RemoveMember(uint charaId)
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
if (members[i].charaId == charaId)
|
||||
{
|
||||
members.Remove(members[i]);
|
||||
members.Sort();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return members.Count;
|
||||
}
|
||||
|
||||
public override string GetGroupName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.CompanyGroup;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList(uint id)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
groupWork.addProperty(this, "work._globalSave.master");
|
||||
groupWork.addProperty(this, "work._globalSave.crestIcon[0]");
|
||||
groupWork.addProperty(this, "work._globalSave.rank");
|
||||
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
work._memberSave[i].rank = members[i].rank;
|
||||
groupWork.addProperty(this, String.Format("work._memberSave[{0}].rank", i));
|
||||
}
|
||||
|
||||
groupWork.setTarget("/_init");
|
||||
SubPacket test = groupWork.buildPacket(session.sessionId);
|
||||
test.DebugPrintSubPacket();
|
||||
session.clientConnection.QueuePacket(test);
|
||||
}
|
||||
|
||||
public void ResendWorkValues()
|
||||
{
|
||||
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
groupWork.addProperty(this, "work._globalSave.master");
|
||||
groupWork.addProperty(this, "work._globalSave.crestIcon[0]");
|
||||
groupWork.addProperty(this, "work._globalSave.rank");
|
||||
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
work._memberSave[i].rank = members[i].rank;
|
||||
groupWork.addProperty(this, String.Format("work._memberSave[{0}].rank", i));
|
||||
}
|
||||
|
||||
groupWork.setTarget("memberRank");
|
||||
|
||||
lock (members)
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(members[i].charaId);
|
||||
if (session != null)
|
||||
{
|
||||
SubPacket test = groupWork.buildPacket(session.sessionId);
|
||||
session.clientConnection.QueuePacket(test);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void LoadMembers()
|
||||
{
|
||||
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 LinkshellMember GetMember(string name)
|
||||
{
|
||||
lock (members)
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
if (Server.GetServer().GetNameForId((members[i].charaId)).Equals(name))
|
||||
return members[i];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasMember(uint id)
|
||||
{
|
||||
lock (members)
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
if (members[i].charaId == id)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void DisbandRequest(Session session)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void LeaveRequest(Session requestSession)
|
||||
{
|
||||
uint leaver = requestSession.sessionId;
|
||||
|
||||
//Check if ls contains this person
|
||||
if (!HasMember(leaver))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Send you are leaving message
|
||||
requestSession.SendGameMessage(25162, 0x20, (Object)1, name);
|
||||
|
||||
//All good, remove
|
||||
Server.GetServer().GetWorldManager().GetLinkshellManager().RemoveMemberFromLinkshell(requestSession.sessionId, name);
|
||||
SendGroupPacketsAll(GetMemberIds());
|
||||
ResendWorkValues();
|
||||
|
||||
//If active, remove it
|
||||
if (requestSession.activeLinkshellName.Equals(name))
|
||||
{
|
||||
SubPacket activeLsPacket = SetActiveLinkshellPacket.BuildPacket(requestSession.sessionId, 0);
|
||||
requestSession.clientConnection.QueuePacket(activeLsPacket);
|
||||
requestSession.SetActiveLS("");
|
||||
}
|
||||
|
||||
//Delete group for kicked guy
|
||||
SendDeletePacket(requestSession);
|
||||
}
|
||||
|
||||
public void KickRequest(Session requestSession, string kickedName)
|
||||
{
|
||||
LinkshellMember kicked = GetMember(kickedName);
|
||||
Session kickedSession = Server.GetServer().GetSession(kicked.charaId);
|
||||
|
||||
//Check if ls contains this person
|
||||
if (!HasMember(kicked.charaId))
|
||||
{
|
||||
requestSession.SendGameMessage(25281, 0x20, (Object)1, (Object)kickedName, (Object)name);
|
||||
return;
|
||||
}
|
||||
|
||||
//Send you are exiled message
|
||||
lock (members)
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(members[i].charaId);
|
||||
|
||||
if (session == null)
|
||||
continue;
|
||||
|
||||
if (session.sessionId == kicked.charaId)
|
||||
session.SendGameMessage(25184, 0x20, (Object)1, (Object)name);
|
||||
else
|
||||
session.SendGameMessage(25280, 0x20, (Object)1, (Object)kickedName, (Object)name);
|
||||
}
|
||||
}
|
||||
|
||||
//All good, remove
|
||||
Server.GetServer().GetWorldManager().GetLinkshellManager().RemoveMemberFromLinkshell(kicked.charaId, name);
|
||||
SendGroupPacketsAll(GetMemberIds());
|
||||
ResendWorkValues();
|
||||
|
||||
//If active, remove it
|
||||
if (requestSession.activeLinkshellName.Equals(name))
|
||||
{
|
||||
SubPacket activeLsPacket = SetActiveLinkshellPacket.BuildPacket(requestSession.sessionId, 0);
|
||||
requestSession.clientConnection.QueuePacket(activeLsPacket);
|
||||
requestSession.SetActiveLS("");
|
||||
}
|
||||
|
||||
//Delete group for kicked guy
|
||||
SendDeletePacket(kickedSession);
|
||||
|
||||
}
|
||||
|
||||
public void RankChangeRequest(Session requestSession, string name, byte rank)
|
||||
{
|
||||
lock (members)
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
if (Server.GetServer().GetNameForId(members[i].charaId).Equals(name))
|
||||
{
|
||||
if (Database.LinkshellChangeRank(members[i].charaId, rank))
|
||||
{
|
||||
members[i].rank = rank;
|
||||
ResendWorkValues();
|
||||
requestSession.SendGameMessage(25277, 0x20, (object)(100000 + rank), (object)name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
44
World Server/DataObjects/Group/LinkshellMember.cs
Normal file
44
World Server/DataObjects/Group/LinkshellMember.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace Meteor.World.DataObjects.Group
|
||||
{
|
||||
class LinkshellMember : IComparable<LinkshellMember>
|
||||
{
|
||||
public readonly uint charaId;
|
||||
public readonly ulong lsId;
|
||||
public byte rank;
|
||||
|
||||
public LinkshellMember(uint charaId, ulong lsId, byte rank)
|
||||
{
|
||||
this.charaId = charaId;
|
||||
this.lsId = lsId;
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
public int CompareTo(LinkshellMember other)
|
||||
{
|
||||
return Server.GetServer().GetNameForId(charaId).CompareTo(Server.GetServer().GetNameForId(other.charaId));
|
||||
}
|
||||
}
|
||||
}
|
288
World Server/DataObjects/Group/Party.cs
Normal file
288
World Server/DataObjects/Group/Party.cs
Normal file
|
@ -0,0 +1,288 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Meteor.Common;
|
||||
using Meteor.World.Actor.Group.Work;
|
||||
using Meteor.World.Packets.Send.Subpackets.Groups;
|
||||
|
||||
namespace Meteor.World.DataObjects.Group
|
||||
{
|
||||
class Party : Group
|
||||
{
|
||||
public PartyWork partyGroupWork = new PartyWork();
|
||||
public List<uint> members = new List<uint>();
|
||||
|
||||
public Party(ulong groupId, uint leaderCharaId) : base(groupId)
|
||||
{
|
||||
partyGroupWork._globalTemp.owner = (ulong)(((ulong)leaderCharaId << 32) | 0xB36F92);
|
||||
members.Add(leaderCharaId);
|
||||
}
|
||||
|
||||
public void SetLeaderPlayerRequest(Session requestSession, string name)
|
||||
{
|
||||
SetLeaderPlayerRequest(requestSession, GetIdForName(name));
|
||||
}
|
||||
|
||||
public void SetLeaderPlayerRequest(Session requestSession, uint actorId)
|
||||
{
|
||||
if (GetLeader() != requestSession.sessionId)
|
||||
{
|
||||
requestSession.SendGameMessage(30428, 0x20, Server.GetServer().GetNameForId(requestSession.sessionId));
|
||||
return;
|
||||
}
|
||||
|
||||
uint newLeader = actorId;
|
||||
|
||||
if (!members.Contains(actorId))
|
||||
{
|
||||
requestSession.SendGameMessage(30567, 0x20);
|
||||
return;
|
||||
}
|
||||
else if (newLeader == GetLeader())
|
||||
{
|
||||
requestSession.SendGameMessage(30559, 0x20, (Object)Server.GetServer().GetNameForId(actorId));
|
||||
return;
|
||||
}
|
||||
|
||||
SetLeader(newLeader);
|
||||
SendLeaderWorkToAllMembers();
|
||||
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(members[i]);
|
||||
if (session == null)
|
||||
continue;
|
||||
session.SendGameMessage(30429, 0x20, (Object)Server.GetServer().GetNameForId(actorId));
|
||||
}
|
||||
|
||||
Server.GetServer().GetWorldManager().SendPartySync(this);
|
||||
}
|
||||
|
||||
public void KickPlayerRequest(Session requestSession, string name)
|
||||
{
|
||||
KickPlayerRequest(requestSession, GetIdForName(name));
|
||||
}
|
||||
|
||||
public void KickPlayerRequest(Session requestSession, uint actorId)
|
||||
{
|
||||
if (GetLeader() != requestSession.sessionId)
|
||||
{
|
||||
requestSession.SendGameMessage(30428, 0x20, Server.GetServer().GetNameForId(requestSession.sessionId));
|
||||
return;
|
||||
}
|
||||
|
||||
uint kickedMemberId = actorId;
|
||||
|
||||
if (!members.Contains(actorId))
|
||||
{
|
||||
requestSession.SendGameMessage(30575, 0x20);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(members[i]);
|
||||
if (session == null)
|
||||
continue;
|
||||
|
||||
if (members[i] == kickedMemberId)
|
||||
session.SendGameMessage(30410, 0x20);
|
||||
else
|
||||
session.SendGameMessage(30428, 0x20, (Object)Server.GetServer().GetNameForId(actorId));
|
||||
}
|
||||
|
||||
//All good, remove
|
||||
Server.GetServer().GetWorldManager().GetPartyManager().RemoveFromParty(groupIndex, kickedMemberId);
|
||||
SendGroupPacketsAll(members);
|
||||
Server.GetServer().GetWorldManager().SendPartySync(this);
|
||||
|
||||
//Set the kicked guy to a new party
|
||||
Session kickedSession = Server.GetServer().GetSession(kickedMemberId);
|
||||
if (kickedSession != null)
|
||||
{
|
||||
Party kickedPlayersNewParty = Server.GetServer().GetWorldManager().GetPartyManager().CreateParty(kickedMemberId);
|
||||
kickedPlayersNewParty.SendGroupPackets(kickedSession);
|
||||
Server.GetServer().GetWorldManager().SendPartySync(kickedPlayersNewParty);
|
||||
kickedPlayersNewParty.SendInitWorkValues(kickedSession);
|
||||
}
|
||||
}
|
||||
|
||||
public void LeavePlayerRequest(Session requestSession)
|
||||
{
|
||||
uint leaver = requestSession.sessionId;
|
||||
|
||||
//Check if party contains this person
|
||||
if (!members.Contains(leaver))
|
||||
{
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Send you are leaving messages
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(members[i]);
|
||||
if (session == null)
|
||||
continue;
|
||||
|
||||
session.SendGameMessage(30431, 0x20, (Object)Server.GetServer().GetNameForId(leaver));
|
||||
}
|
||||
|
||||
//All good, remove
|
||||
Server.GetServer().GetWorldManager().GetPartyManager().RemoveFromParty(groupIndex, leaver);
|
||||
SendGroupPacketsAll(members);
|
||||
Server.GetServer().GetWorldManager().SendPartySync(this);
|
||||
|
||||
//Set the left guy to a new party
|
||||
if (requestSession != null)
|
||||
{
|
||||
Party kickedPlayersNewParty = Server.GetServer().GetWorldManager().GetPartyManager().CreateParty(leaver);
|
||||
kickedPlayersNewParty.SendGroupPackets(requestSession);
|
||||
Server.GetServer().GetWorldManager().SendPartySync(kickedPlayersNewParty);
|
||||
kickedPlayersNewParty.SendInitWorkValues(requestSession);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void DisbandPlayerRequest(Session requestSession)
|
||||
{
|
||||
uint disbander = requestSession.sessionId;
|
||||
|
||||
//Check if leader
|
||||
if (GetLeader() != disbander)
|
||||
{
|
||||
requestSession.SendGameMessage(30428, 0x20, Server.GetServer().GetNameForId(requestSession.sessionId));
|
||||
return;
|
||||
}
|
||||
|
||||
Server.GetServer().GetWorldManager().GetPartyManager().DeleteParty(groupIndex);
|
||||
|
||||
//Send game messages and set new parties
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(members[i]);
|
||||
if (session == null)
|
||||
continue;
|
||||
|
||||
session.SendGameMessage(30401, 0x20);
|
||||
|
||||
//Set char to new party
|
||||
Party newParty = Server.GetServer().GetWorldManager().GetPartyManager().CreateParty(members[i]);
|
||||
newParty.SendGroupPackets(session);
|
||||
Server.GetServer().GetWorldManager().SendPartySync(newParty);
|
||||
newParty.SendInitWorkValues(session);
|
||||
}
|
||||
|
||||
Server.GetServer().GetWorldManager().SendPartySync(this);
|
||||
}
|
||||
|
||||
public void SendLeaderWorkToAllMembers()
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
SynchGroupWorkValuesPacket leaderUpdate = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
leaderUpdate.addProperty(this, "partyGroupWork._globalTemp.owner");
|
||||
leaderUpdate.setTarget("partyGroupWork/leader");
|
||||
Session session = Server.GetServer().GetSession(members[i]);
|
||||
if (session == null)
|
||||
continue;
|
||||
else
|
||||
session.clientConnection.QueuePacket(leaderUpdate.buildPacket(session.sessionId));
|
||||
}
|
||||
}
|
||||
|
||||
public void SetLeader(uint actorId)
|
||||
{
|
||||
partyGroupWork._globalTemp.owner = (ulong)(((ulong)actorId << 32) | 0xB36F92);
|
||||
}
|
||||
|
||||
public uint GetLeader()
|
||||
{
|
||||
return (uint)(((ulong)partyGroupWork._globalTemp.owner >> 32) & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public uint GetIdForName(string name)
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
if (Server.GetServer().GetNameForId(members[i]).Equals(name))
|
||||
{
|
||||
return members[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public bool IsInParty(uint charaId)
|
||||
{
|
||||
return members.Contains(charaId);
|
||||
}
|
||||
|
||||
public override void SendInitWorkValues(Session session)
|
||||
{
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
groupWork.addProperty(this, "partyGroupWork._globalTemp.owner");
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.sessionId);
|
||||
session.clientConnection.QueuePacket(test);
|
||||
test.DebugPrintSubPacket();
|
||||
}
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return members.Count;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.PlayerPartyGroup;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList(uint id)
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
groupMembers.Add(new GroupMember(id, -1, 0, false, true, Server.GetServer().GetNameForId(id)));
|
||||
foreach (uint charaId in members)
|
||||
{
|
||||
if (charaId != id)
|
||||
groupMembers.Add(new GroupMember(charaId, -1, 0, false, true, Server.GetServer().GetNameForId(charaId)));
|
||||
}
|
||||
return groupMembers;
|
||||
}
|
||||
|
||||
public void OnPlayerJoin(Session inviteeSession)
|
||||
{
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
Session session = Server.GetServer().GetSession(members[i]);
|
||||
if (session == null)
|
||||
continue;
|
||||
|
||||
session.SendGameMessage(30427, 0x20, (Object)Server.GetServer().GetNameForId(inviteeSession.sessionId));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
93
World Server/DataObjects/Group/Relation.cs
Normal file
93
World Server/DataObjects/Group/Relation.cs
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Meteor.Common;
|
||||
using Meteor.World.Actor.Group.Work;
|
||||
using Meteor.World.Packets.Send.Subpackets.Groups;
|
||||
|
||||
namespace Meteor.World.DataObjects.Group
|
||||
{
|
||||
class Relation : Group
|
||||
{
|
||||
public RelationWork work = new RelationWork();
|
||||
private uint charaOther;
|
||||
private ulong topicGroup;
|
||||
|
||||
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()
|
||||
{
|
||||
return (uint)(((ulong)work._globalTemp.host >> 32) & 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public uint GetOther()
|
||||
{
|
||||
return charaOther;
|
||||
}
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.GroupInvitationRelationGroup;
|
||||
}
|
||||
|
||||
public ulong GetTopicGroupIndex()
|
||||
{
|
||||
return topicGroup;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList(uint id)
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
|
||||
uint hostId = (uint)((work._globalTemp.host >> 32) & 0xFFFFFFFF);
|
||||
|
||||
groupMembers.Add(new GroupMember(hostId, -1, 0, false, Server.GetServer().GetSession(hostId) != null, Server.GetServer().GetNameForId(hostId)));
|
||||
groupMembers.Add(new GroupMember(charaOther, -1, 0, false, Server.GetServer().GetSession(charaOther) != null, Server.GetServer().GetNameForId(charaOther)));
|
||||
return groupMembers;
|
||||
}
|
||||
|
||||
public override void SendInitWorkValues(Session session)
|
||||
{
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
groupWork.addProperty(this, "work._globalTemp.host");
|
||||
groupWork.addProperty(this, "work._globalTemp.variableCommand");
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.sessionId);
|
||||
test.DebugPrintSubPacket();
|
||||
session.clientConnection.QueuePacket(test);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
99
World Server/DataObjects/Group/RetainerGroup.cs
Normal file
99
World Server/DataObjects/Group/RetainerGroup.cs
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Meteor.Common;
|
||||
using Meteor.World.Actor.Group.Work;
|
||||
using Meteor.World.Packets.Send.Subpackets.Groups;
|
||||
|
||||
namespace Meteor.World.DataObjects.Group
|
||||
{
|
||||
class RetainerGroup : Group
|
||||
{
|
||||
public RetainerWork work = new RetainerWork();
|
||||
public uint owner;
|
||||
public List<RetainerGroupMember> members = new List<RetainerGroupMember>();
|
||||
|
||||
public RetainerGroup(ulong groupId, uint owner) : base(groupId)
|
||||
{
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public void setRetainerProperties(int index, byte cdIDOffset, ushort placeName, byte condition, byte level)
|
||||
{
|
||||
if (members.Count >= index)
|
||||
return;
|
||||
work._memberSave[index].cdIDOffset = cdIDOffset;
|
||||
work._memberSave[index].placeName = placeName;
|
||||
work._memberSave[index].conditions = condition;
|
||||
work._memberSave[index].level = level;
|
||||
}
|
||||
|
||||
public override void SendInitWorkValues(Session session)
|
||||
{
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
|
||||
for (int i = 0; i < members.Count; i++)
|
||||
{
|
||||
work._memberSave[i].cdIDOffset = members[i].cdIDOffset;
|
||||
work._memberSave[i].placeName = members[i].placeName;
|
||||
work._memberSave[i].conditions = members[i].conditions;
|
||||
work._memberSave[i].level = members[i].level;
|
||||
|
||||
groupWork.addProperty(this, String.Format("work._memberSave[{0}].cdIDOffset", i));
|
||||
groupWork.addProperty(this, String.Format("work._memberSave[{0}].placeName", i));
|
||||
groupWork.addProperty(this, String.Format("work._memberSave[{0}].conditions", i));
|
||||
groupWork.addProperty(this, String.Format("work._memberSave[{0}].level", i));
|
||||
}
|
||||
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.sessionId);
|
||||
session.clientConnection.QueuePacket(test);
|
||||
}
|
||||
|
||||
public override int GetMemberCount()
|
||||
{
|
||||
return members.Count + 1;
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.RetainerGroup;
|
||||
}
|
||||
|
||||
public override List<GroupMember> BuildMemberList(uint id)
|
||||
{
|
||||
List<GroupMember> groupMembers = new List<GroupMember>();
|
||||
|
||||
//Add retainers
|
||||
foreach (RetainerGroupMember member in members)
|
||||
groupMembers.Add(new GroupMember(member.id, -1, 0, false, true, member.name));
|
||||
|
||||
//Add player
|
||||
groupMembers.Add(new GroupMember(owner, -1, 0, false, true, Server.GetServer().GetNameForId(owner)));
|
||||
|
||||
return groupMembers;
|
||||
}
|
||||
}
|
||||
}
|
45
World Server/DataObjects/Group/RetainerGroupMember.cs
Normal file
45
World Server/DataObjects/Group/RetainerGroupMember.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
namespace Meteor.World.DataObjects.Group
|
||||
{
|
||||
class RetainerGroupMember
|
||||
{
|
||||
public uint id;
|
||||
public string name;
|
||||
public uint classActorId;
|
||||
public byte cdIDOffset;
|
||||
public ushort placeName;
|
||||
public byte conditions;
|
||||
public byte level;
|
||||
|
||||
public RetainerGroupMember(uint id, string name, uint classActorId, byte cdIDOffset, ushort placeName, byte conditions, byte level)
|
||||
{
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.classActorId = classActorId;
|
||||
this.cdIDOffset = cdIDOffset;
|
||||
this.placeName = placeName;
|
||||
this.conditions = conditions;
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
===========================================================================
|
||||
Copyright (C) 2015-2019 Project Meteor Dev Team
|
||||
|
||||
This file is part of Project Meteor Server.
|
||||
|
||||
Project Meteor Server is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Project Meteor Server is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with Project Meteor Server. If not, see <https:www.gnu.org/licenses/>.
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
using Meteor.Common;
|
||||
using Meteor.World.Packets.Send.Subpackets.Groups;
|
||||
|
||||
namespace Meteor.World.DataObjects.Group
|
||||
{
|
||||
class RetainerMeetingRelationGroup : Relation
|
||||
{
|
||||
public RetainerMeetingRelationGroup(ulong groupIndex, uint host, uint other, uint command, ulong topicGroup)
|
||||
: base(groupIndex, host, other, command, topicGroup)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override uint GetTypeId()
|
||||
{
|
||||
return Group.RetainerMeetingRelationGroup;
|
||||
}
|
||||
|
||||
public override void SendInitWorkValues(Session session)
|
||||
{
|
||||
SynchGroupWorkValuesPacket groupWork = new SynchGroupWorkValuesPacket(groupIndex);
|
||||
groupWork.setTarget("/_init");
|
||||
|
||||
SubPacket test = groupWork.buildPacket(session.sessionId);
|
||||
test.DebugPrintSubPacket();
|
||||
session.clientConnection.QueuePacket(test);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue