mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-02 19:42:05 -04:00
Random work.
This commit is contained in:
parent
fd2df829de
commit
6c409e93a9
@ -12,6 +12,10 @@ namespace FFXIVClassic_World_Server.DataObjects
|
||||
public enum Channel {ZONE, CHAT};
|
||||
|
||||
public readonly uint sessionId;
|
||||
|
||||
public string characterName;
|
||||
public uint currentZoneId;
|
||||
|
||||
public readonly ClientConnection clientConnection;
|
||||
public readonly Channel type;
|
||||
public ZoneServer routing1, routing2;
|
||||
@ -22,6 +26,7 @@ namespace FFXIVClassic_World_Server.DataObjects
|
||||
this.clientConnection = connection;
|
||||
this.type = type;
|
||||
connection.owner = this;
|
||||
Database.LoadZoneSessionInfo(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using FFXIVClassic_World_Server.DataObjects;
|
||||
using FFXIVClassic_World_Server.DataObjects.Group;
|
||||
|
||||
@ -11,6 +8,48 @@ namespace FFXIVClassic_World_Server
|
||||
{
|
||||
class Database
|
||||
{
|
||||
public static bool LoadZoneSessionInfo(Session session)
|
||||
{
|
||||
string characterName;
|
||||
uint currentZone = 0;
|
||||
uint destinationZone = 0;
|
||||
bool readIn = false;
|
||||
|
||||
using (MySqlConnection conn = new MySqlConnection(String.Format("Server={0}; Port={1}; Database={2}; UID={3}; Password={4}", ConfigConstants.DATABASE_HOST, ConfigConstants.DATABASE_PORT, ConfigConstants.DATABASE_NAME, ConfigConstants.DATABASE_USERNAME, ConfigConstants.DATABASE_PASSWORD)))
|
||||
{
|
||||
try
|
||||
{
|
||||
conn.Open();
|
||||
MySqlCommand cmd = new MySqlCommand("SELECT name, currentZoneId, destinationZoneId FROM characters WHERE id = @charaId", conn);
|
||||
cmd.Parameters.AddWithValue("@charaId", session.sessionId);
|
||||
using (MySqlDataReader Reader = cmd.ExecuteReader())
|
||||
{
|
||||
while (Reader.Read())
|
||||
{
|
||||
characterName = Reader.GetString("name");
|
||||
currentZone = Reader.GetUInt32("currentZoneId");
|
||||
destinationZone = Reader.GetUInt32("destinationZoneId");
|
||||
|
||||
session.characterName = characterName;
|
||||
session.currentZoneId = currentZone;
|
||||
|
||||
readIn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (MySqlException e)
|
||||
{
|
||||
Program.Log.Error(e.ToString());
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
return readIn;
|
||||
}
|
||||
|
||||
public static uint GetCurrentZoneForSession(uint charId)
|
||||
{
|
||||
uint currentZone = 0;
|
||||
|
@ -82,8 +82,11 @@
|
||||
<Compile Include="Packets\Send\_0x2Packet.cs" />
|
||||
<Compile Include="Packets\Send\_0x7Packet.cs" />
|
||||
<Compile Include="Packets\Send\_0x8PingPacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\Group\GroupControlCreateModifyPacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\Group\GroupControlGetDeletePacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\Group\ModifyLinkshellPacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\Group\CreateRelationPacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\Group\CreateLinkshellPacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\Group\GetGroupPacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\Group\DeleteGroupPacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\Group\GroupMemberChangePacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\SessionBeginConfirmPacket.cs" />
|
||||
<Compile Include="Packets\WorldPackets\Receive\WorldRequestZoneChangePacket.cs" />
|
||||
|
@ -50,7 +50,7 @@ namespace FFXIVClassic_World_Server
|
||||
}
|
||||
|
||||
//Creates a new linkshell and adds it to the list
|
||||
public bool DeleteLinkshell(uint groupInstanceId)
|
||||
public bool DeleteLinkshell(ulong groupInstanceId)
|
||||
{
|
||||
if (mCurrentWorldGroupsReference.ContainsKey(groupInstanceId))
|
||||
{
|
||||
|
@ -110,6 +110,7 @@ namespace FFXIVClassic_World_Server
|
||||
//Check destination, if != 0, update route and start new session
|
||||
if (endConfirmPacket.destinationZone != 0)
|
||||
{
|
||||
session.currentZoneId = endConfirmPacket.destinationZone;
|
||||
session.routing1 = Server.GetServer().GetWorldManager().GetZoneServer(endConfirmPacket.destinationZone);
|
||||
session.routing1.SendSessionStart(session);
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||
{
|
||||
class CreateLinkshellPacket
|
||||
{
|
||||
public bool invalidPacket = false;
|
||||
|
||||
public string name;
|
||||
public ushort crestid;
|
||||
public uint master;
|
||||
|
||||
public CreateLinkshellPacket(byte[] data)
|
||||
{
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try
|
||||
{
|
||||
name = Encoding.ASCII.GetString(binReader.ReadBytes(0x20)).Trim(new[] { '\0' });
|
||||
crestid = binReader.ReadUInt16();
|
||||
master = binReader.ReadUInt32();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
invalidPacket = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||
{
|
||||
class CreateRelationPacket
|
||||
{
|
||||
public bool invalidPacket = false;
|
||||
|
||||
public uint host;
|
||||
public uint guest;
|
||||
public uint command;
|
||||
|
||||
public CreateRelationPacket(byte[] data)
|
||||
{
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try
|
||||
{
|
||||
host = binReader.ReadUInt32();
|
||||
guest = binReader.ReadUInt32();
|
||||
command = binReader.ReadUInt32();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
invalidPacket = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,16 +3,12 @@ using System.IO;
|
||||
|
||||
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||
{
|
||||
class GroupControlGetDeletePacket
|
||||
class DeleteGroupPacket
|
||||
{
|
||||
public const byte GROUP_CONTROL_GET = 0;
|
||||
public const byte GROUP_CONTROL_DELETE = 1;
|
||||
|
||||
public bool invalidPacket = false;
|
||||
public uint controlCode;
|
||||
public ulong groupId;
|
||||
|
||||
public GroupControlGetDeletePacket(byte[] data)
|
||||
public DeleteGroupPacket(byte[] data)
|
||||
{
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
@ -20,7 +16,6 @@ namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||
{
|
||||
try
|
||||
{
|
||||
controlCode = binReader.ReadUInt32();
|
||||
groupId = binReader.ReadUInt64();
|
||||
}
|
||||
catch (Exception)
|
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||
{
|
||||
class GetGroupPacket
|
||||
{
|
||||
public bool invalidPacket = false;
|
||||
public ulong groupId;
|
||||
|
||||
public GetGroupPacket(byte[] data)
|
||||
{
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try
|
||||
{
|
||||
groupId = binReader.ReadUInt64();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
invalidPacket = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||
{
|
||||
class GroupControlCreateModifyPacket
|
||||
{
|
||||
public const byte GROUP_CONTROL_CREATE = 0;
|
||||
public const byte GROUP_CONTROL_MODIFY = 1;
|
||||
|
||||
public const byte GROUP_PARTY = 0;
|
||||
public const byte GROUP_RETAINER = 1;
|
||||
public const byte GROUP_LINKSHELL = 2;
|
||||
public const byte GROUP_RELATION = 3;
|
||||
|
||||
public bool invalidPacket = false;
|
||||
public byte controlCode;
|
||||
public ulong groupId;
|
||||
public byte groupType;
|
||||
|
||||
public GroupControlCreateModifyPacket(byte[] data)
|
||||
{
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try
|
||||
{
|
||||
controlCode = binReader.ReadByte();
|
||||
groupType = binReader.ReadByte();
|
||||
groupId = binReader.ReadUInt64();
|
||||
|
||||
//Work value data
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
invalidPacket = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace FFXIVClassic_World_Server.Packets.WorldPackets.Receive.Group
|
||||
{
|
||||
class ModifyLinkshellPacket
|
||||
{
|
||||
public bool invalidPacket = false;
|
||||
|
||||
public ushort argCode;
|
||||
public string name;
|
||||
public ushort crestid;
|
||||
public uint master;
|
||||
|
||||
public ModifyLinkshellPacket(byte[] data)
|
||||
{
|
||||
using (MemoryStream mem = new MemoryStream(data))
|
||||
{
|
||||
using (BinaryReader binReader = new BinaryReader(mem))
|
||||
{
|
||||
try
|
||||
{
|
||||
argCode = binReader.ReadUInt16();
|
||||
|
||||
switch (argCode)
|
||||
{
|
||||
case 0:
|
||||
name = Encoding.ASCII.GetString(binReader.ReadBytes(0x20)).Trim(new[] { '\0' });
|
||||
break;
|
||||
case 1:
|
||||
crestid = binReader.ReadUInt16();
|
||||
break;
|
||||
case 2:
|
||||
master = binReader.ReadUInt32();
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
invalidPacket = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -204,60 +204,25 @@ namespace FFXIVClassic_World_Server
|
||||
}
|
||||
|
||||
break;
|
||||
//Group Control Create or Modify
|
||||
//Group get data request
|
||||
case 0x1020:
|
||||
GroupControlCreateModifyPacket gCreateModifyPacket = new GroupControlCreateModifyPacket(subpacket.data);
|
||||
|
||||
if (gCreateModifyPacket.controlCode == GroupControlCreateModifyPacket.GROUP_CONTROL_CREATE)
|
||||
{
|
||||
ulong groupId;
|
||||
switch (gCreateModifyPacket.groupType)
|
||||
{
|
||||
case GroupControlCreateModifyPacket.GROUP_PARTY:
|
||||
//mPartyManager.CreateParty();
|
||||
GetGroupPacket getGroupPacket = new GetGroupPacket(subpacket.data);
|
||||
SendGroupData(session, getGroupPacket.groupId);
|
||||
break;
|
||||
case GroupControlCreateModifyPacket.GROUP_RETAINER:
|
||||
//mPartyManager.CreateParty();
|
||||
break;
|
||||
case GroupControlCreateModifyPacket.GROUP_LINKSHELL:
|
||||
//mPartyManager.CreateParty();
|
||||
break;
|
||||
case GroupControlCreateModifyPacket.GROUP_RELATION:
|
||||
//mPartyManager.CreateParty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (gCreateModifyPacket.controlCode == GroupControlCreateModifyPacket.GROUP_CONTROL_MODIFY)
|
||||
{
|
||||
switch (gCreateModifyPacket.groupType)
|
||||
{
|
||||
case GroupControlCreateModifyPacket.GROUP_PARTY:
|
||||
//mPartyManager.CreateParty();
|
||||
break;
|
||||
case GroupControlCreateModifyPacket.GROUP_RETAINER:
|
||||
//mPartyManager.CreateParty();
|
||||
break;
|
||||
case GroupControlCreateModifyPacket.GROUP_LINKSHELL:
|
||||
//mPartyManager.CreateParty();
|
||||
break;
|
||||
case GroupControlCreateModifyPacket.GROUP_RELATION:
|
||||
//mPartyManager.CreateParty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
//Group Control Get or Delete
|
||||
//Group delete request
|
||||
case 0x1021:
|
||||
GroupControlGetDeletePacket gGetDeletePacket = new GroupControlGetDeletePacket(subpacket.data);
|
||||
if (gGetDeletePacket.controlCode == GroupControlGetDeletePacket.GROUP_CONTROL_GET)
|
||||
{
|
||||
|
||||
}
|
||||
else if (gGetDeletePacket.controlCode == GroupControlGetDeletePacket.GROUP_CONTROL_DELETE)
|
||||
{
|
||||
|
||||
}
|
||||
DeleteGroupPacket deleteGroupPacket = new DeleteGroupPacket(subpacket.data);
|
||||
DeleteGroup(deleteGroupPacket.groupId);
|
||||
break;
|
||||
//Linkshell create request
|
||||
case 0x1023:
|
||||
CreateLinkshellPacket createLinkshellpacket = new CreateLinkshellPacket(subpacket.data);
|
||||
mLinkshellManager.CreateLinkshell(createLinkshellpacket.name, createLinkshellpacket.crestid, createLinkshellpacket.master);
|
||||
break;
|
||||
//Linkshell modify request
|
||||
case 0x1024:
|
||||
ModifyLinkshellPacket modifyLinkshellpacket = new ModifyLinkshellPacket(subpacket.data);
|
||||
mLinkshellManager.ModifyLinkshell();
|
||||
break;
|
||||
//Group Add/Remove Member
|
||||
case 0x1022:
|
||||
@ -265,8 +230,7 @@ namespace FFXIVClassic_World_Server
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mZoneSessionList.ContainsKey(sessionId))
|
||||
else if (mZoneSessionList.ContainsKey(sessionId))
|
||||
{
|
||||
ClientConnection conn = mZoneSessionList[sessionId].clientConnection;
|
||||
conn.QueuePacket(subpacket, true, false);
|
||||
@ -412,6 +376,57 @@ namespace FFXIVClassic_World_Server
|
||||
|
||||
#endregion
|
||||
|
||||
private void SendGroupData(Session session, ulong groupId)
|
||||
{
|
||||
if (mCurrentWorldGroups.ContainsKey(groupId))
|
||||
{
|
||||
Group group = mCurrentWorldGroups[groupId];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void SendGroupDataToAllMembers(ulong groupId)
|
||||
{
|
||||
if (mCurrentWorldGroups.ContainsKey(groupId))
|
||||
{
|
||||
Group group = mCurrentWorldGroups[groupId];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void GetGroup(Group group)
|
||||
{
|
||||
if (group is Party)
|
||||
{
|
||||
|
||||
}
|
||||
else if (group is RetainerGroup)
|
||||
{
|
||||
|
||||
}
|
||||
else if (group is Linkshell)
|
||||
{
|
||||
|
||||
}
|
||||
else if (group is Relation)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void DeleteGroup(ulong id)
|
||||
{
|
||||
if (!mCurrentWorldGroups.ContainsKey(id))
|
||||
return;
|
||||
Group group = mCurrentWorldGroups[id];
|
||||
if (group is Party)
|
||||
mPartyManager.DeleteParty(group.groupIndex);
|
||||
else if (group is Linkshell)
|
||||
mLinkshellManager.DeleteLinkshell(group.groupIndex);
|
||||
else if (group is Relation)
|
||||
mRelationGroupManager.DeleteRelationGroup(group.groupIndex);
|
||||
}
|
||||
|
||||
public void IncrementGroupIndex()
|
||||
{
|
||||
mRunningGroupIndex++;
|
||||
|
@ -173,6 +173,12 @@ namespace FFXIVClassic_World_Server
|
||||
if (zs == null)
|
||||
return;
|
||||
|
||||
session.currentZoneId = destinationZoneId;
|
||||
|
||||
//Intrazone change, just update the id
|
||||
if (zs.Equals(session.routing1))
|
||||
return;
|
||||
|
||||
if (zs.isConnected)
|
||||
session.routing1.SendSessionEnd(session, destinationZoneId, destinationPrivateArea, spawnType, spawnX, spawnY, spawnZ, spawnRotation);
|
||||
else if (zs.Connect())
|
||||
@ -184,7 +190,7 @@ namespace FFXIVClassic_World_Server
|
||||
//Login Zone In
|
||||
public void DoLogin(Session session)
|
||||
{
|
||||
session.routing1 = GetZoneServer(Database.GetCurrentZoneForSession(session.sessionId));
|
||||
session.routing1 = GetZoneServer(session.currentZoneId);
|
||||
session.routing1.SendSessionStart(session);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user