Removed NioTSO client and server

- NioTSO client isn't needed because we're using RayLib
- Added FreeSO's API server to handle most backend operations
This commit is contained in:
Tony Bark 2024-05-01 02:55:43 -04:00
parent f12ba1502b
commit 22191ce648
591 changed files with 53264 additions and 3362 deletions

View file

@ -0,0 +1,40 @@
using FSO.Common.Serialization;
using Mina.Core.Buffer;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class AnnouncementMsgPDU : AbstractVoltronPacket
{
public string SenderID = "??ARIES_OPERATIONS";
public string SenderAccount = "";
public byte Badge;
public byte IsAlertable;
public string Subject = "";
public string Message = "";
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
this.SenderID = input.GetPascalString();
this.SenderAccount = input.GetPascalString();
this.Badge = input.Get();
this.IsAlertable = input.Get();
this.Subject = input.GetPascalString();
this.Message = input.GetPascalString();
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.AnnouncementMsgPDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.PutPascalString(SenderID);
output.PutPascalString(SenderAccount);
output.Put(Badge);
output.Put(IsAlertable);
output.PutPascalString(Subject);
output.PutPascalString(Message);
}
}
}

View file

@ -0,0 +1,38 @@
using FSO.Common.Serialization;
using Mina.Core.Buffer;
using FSO.Server.Protocol.Voltron.Model;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class ChatMsgPDU : AbstractVoltronPacket
{
public bool EchoRequested;
public Sender Sender;
public byte Badge;
public byte Alertable;
public string Message;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
EchoRequested = input.Get() == 0x01;
Sender = GetSender(input);
Badge = input.Get();
Alertable = input.Get();
Message = input.GetPascalString();
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.ChatMsgPDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.Put(EchoRequested ? (byte)1 : (byte)0);
PutSender(output, Sender);
output.Put(Badge);
output.Put(Alertable);
output.PutPascalString(Message);
}
}
}

View file

@ -0,0 +1,36 @@
using Mina.Core.Buffer;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class ClientByePDU : AbstractVoltronPacket
{
public uint ReasonCode;
public string ReasonText;
public byte RequestTicket;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
this.ReasonCode = input.GetUInt32();
this.ReasonText = input.GetPascalString();
this.RequestTicket = input.Get();
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.ClientByePDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
var text = ReasonText;
if(text == null){
text = "";
}
output.PutUInt32(ReasonCode);
output.PutPascalString(text);
output.Put(RequestTicket);
}
}
}

View file

@ -0,0 +1,57 @@
using FSO.Common.Serialization;
using Mina.Core.Buffer;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class ClientOnlinePDU : AbstractVoltronPacket
{
public ushort MajorVersion { get; set; }
public ushort MinorVersion { get; set; }
public ushort PointVersion { get; set; }
public ushort ArtVersion { get; set; }
public ulong Timestamp { get; set; }
public byte NumberOfAttempts { get; set; }
public byte LastExitCode { get; set; }
public byte LastFailureType { get; set; }
public byte FailureCount { get; set; }
public byte IsRunning { get; set; }
public byte IsReLogging { get; set; }
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.ClientOnlinePDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.PutUInt16(MajorVersion);
output.PutUInt16(MinorVersion);
output.PutUInt16(PointVersion);
output.PutUInt16(ArtVersion);
output.PutUInt64(this.Timestamp);
output.Put(NumberOfAttempts);
output.Put(LastExitCode);
output.Put(LastFailureType);
output.Put(FailureCount);
output.Put(IsRunning);
output.Put(IsReLogging);
}
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
this.MajorVersion = input.GetUInt16();
this.MinorVersion = input.GetUInt16();
this.PointVersion = input.GetUInt16();
this.ArtVersion = input.GetUInt16();
this.Timestamp = input.GetUInt64();
this.NumberOfAttempts = input.Get();
this.LastExitCode = input.Get();
this.LastFailureType = input.Get();
this.FailureCount = input.Get();
this.IsRunning = input.Get();
this.IsReLogging = input.Get();
}
}
}

View file

@ -0,0 +1,56 @@
using Mina.Core.Buffer;
using FSO.Server.Protocol.Voltron.Model;
using System.ComponentModel;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class DBRequestWrapperPDU : AbstractVoltronPacket
{
public uint SendingAvatarID { get; set; }
public Sender Sender { get; set; }
public byte Badge { get; set; }
public byte IsAlertable { get; set; }
public object BodyType { get; set; }
[TypeConverter(typeof(ExpandableObjectConverter))]
public object Body { get; set; }
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
SendingAvatarID = input.GetUInt32();
Sender = GetSender(input);
Badge = input.Get();
IsAlertable = input.Get();
var bodySize = input.GetUInt32();
var bodyType = input.GetUInt32();
var bodyBytes = new byte[bodySize-4];
input.Get(bodyBytes, 0, (int)bodySize-4);
var bodyBuffer = IoBuffer.Wrap(bodyBytes);
this.Body = context.ModelSerializer.Deserialize(bodyType, bodyBuffer, context);
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.PutUInt32(SendingAvatarID);
PutSender(output, Sender);
output.Put(Badge);
output.Put(IsAlertable);
if (Body != null)
{
var bodyBytes = context.ModelSerializer.SerializeBuffer(Body, context, true);
output.PutUInt32((uint)bodyBytes.Remaining);
output.Put(bodyBytes);
}
}
public override VoltronPacketType GetPacketType(){
return VoltronPacketType.DBRequestWrapperPDU;
}
}
}

View file

@ -0,0 +1,53 @@
using Mina.Core.Buffer;
using System.ComponentModel;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class DataServiceWrapperPDU : AbstractVoltronPacket
{
public uint SendingAvatarID { get; set; }
public uint RequestTypeID { get; set; }
[TypeConverter(typeof(ExpandableObjectConverter))]
public object Body { get; set; }
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.DataServiceWrapperPDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.PutUInt32(SendingAvatarID);
output.PutUInt32(RequestTypeID);
if(Body != null){
var bodyBytes = context.ModelSerializer.SerializeBuffer(Body, context, true);
output.PutUInt32((uint)bodyBytes.Remaining);
output.Put(bodyBytes);
}
//output.PutUInt32(RequestTypeID);
//output.PutUInt32(0);
}
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
this.SendingAvatarID = input.GetUInt32();
this.RequestTypeID = input.GetUInt32();
var bodySize = input.GetUInt32();
var bodyBytes = new byte[bodySize];
input.Get(bodyBytes, 0, (int)bodySize);
this.Body = bodyBytes;
var bodyBuffer = IoBuffer.Wrap(bodyBytes);
var bodyType = bodyBuffer.GetUInt32();
this.Body = context.ModelSerializer.Deserialize(bodyType, bodyBuffer, context);
}
}
}

View file

@ -0,0 +1,29 @@
using Mina.Core.Buffer;
using FSO.Server.Protocol.Voltron.Model;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class FindPlayerPDU : AbstractVoltronPacket
{
public Sender Sender;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
this.Sender = GetSender(input);
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.FindPlayerPDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
//var result = Allocate(8);
//result.AutoExpand = true;
PutSender(output, Sender);
//return result;
}
}
}

View file

@ -0,0 +1,95 @@
using Mina.Core.Buffer;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class FindPlayerResponsePDU : AbstractVoltronPacket
{
public uint StatusCode;
public string ReasonText;
public int AvatarID;
public int RoomID;
public int StageID;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
StatusCode = input.GetUInt32();
ReasonText = input.GetPascalString();
//Room Info
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.FindPlayerResponsePDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
//var result = Allocate(8);
//result.AutoExpand = true;
output.PutUInt32(StatusCode);
output.PutPascalString(ReasonText);
//Room Info
output.PutPascalString("A 16318812");
output.PutPascalString("1");
output.Put((byte)0);
//Owner
output.PutPascalString("A 65538");
output.PutPascalString("1");
//Stage id
output.PutPascalString("A 16318812");
output.PutPascalString("1");
//Currnet ocupancy
output.PutUInt32(10);
//Max occupancy
output.PutUInt32(50);
//pswd required
output.Put((byte)0);
//room type
output.Put((byte)1);
//Group
output.PutPascalString("1");
//Admin list
output.PutUInt16(0);
//m_EnabledFlag
output.Put(0);
//m_AdmitList
output.PutUInt16(0);
//m_EnabledFlag
output.Put(0);
//m_DenyList
output.PutUInt16(0);
//m_EnabledFlag
output.Put(0);
output.PutUInt32(0);
output.PutUInt32(0);
output.PutUInt32(0);
//player info
output.PutPascalString("A "+AvatarID.ToString());
output.PutPascalString("");
output.Put(0);
output.Put(0);
//return result;
}
}
}

View file

@ -0,0 +1,33 @@
using FSO.Common.Serialization;
using Mina.Core.Buffer;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class HostOnlinePDU : AbstractVoltronPacket
{
public ushort HostReservedWords;
public ushort HostVersion;
public ushort ClientBufSize = 4096;
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.HostOnlinePDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
//IoBuffer result = Allocate(6);
output.PutUInt16(HostReservedWords);
output.PutUInt16(HostVersion);
output.PutUInt16(ClientBufSize);
//return result;
}
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
HostReservedWords = input.GetUInt16();
HostVersion = input.GetUInt16();
ClientBufSize = input.GetUInt16();
}
}
}

View file

@ -0,0 +1,32 @@
using Mina.Core.Buffer;
using FSO.Server.Protocol.Voltron.Model;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class OccupantArrivedPDU : AbstractVoltronPacket
{
public Sender Sender;
public byte Badge;
public bool IsAlertable;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
Sender = GetSender(input);
Badge = input.Get();
IsAlertable = input.Get() == 0x1;
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.OccupantArrivedPDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
PutSender(output, Sender);
output.Put(Badge);
output.Put((IsAlertable ? (byte)0x01 : (byte)0x00));
}
}
}

View file

@ -0,0 +1,76 @@
using Mina.Core.Buffer;
using FSO.Server.Protocol.Voltron.Model;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class RSGZWrapperPDU : AbstractVoltronPacket
{
public string Name { get; set; }
public string Description { get; set; }
public Gender Gender { get; set; }
public SkinTone SkinTone { get; set; }
public uint HeadOutfitId { get; set; }
public uint BodyOutfitId { get; set; }
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
//ignoring the dbwrapper junk
//byte 17 and 18 change without changing settings, perhaps a message id?
input.Skip(37);
this.Name = input.GetPascalVLCString();
this.Description = input.GetPascalVLCString();
this.Gender = input.Get() == 0x1 ? Gender.FEMALE : Gender.MALE;
var skin = input.Get();
switch (skin) {
default:
case 0x00:
SkinTone = SkinTone.LIGHT;
break;
case 0x01:
SkinTone = SkinTone.MEDIUM;
break;
case 0x02:
SkinTone = SkinTone.DARK;
break;
}
this.HeadOutfitId = input.GetUInt32();
input.Skip(4); //Unknown
this.BodyOutfitId = input.GetUInt32();
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.RSGZWrapperPDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.Skip(37);
output.PutPascalVLCString(Name);
output.PutPascalVLCString(Description);
output.Put(Gender == Gender.FEMALE ? (byte)0x01 : (byte)0x00);
switch (SkinTone)
{
case SkinTone.LIGHT:
output.Put(0x00);
break;
case SkinTone.MEDIUM:
output.Put(0x01);
break;
case SkinTone.DARK:
output.Put(0x02);
break;
}
output.PutUInt32(HeadOutfitId);
output.Skip(4);//Unknown
output.PutUInt32(BodyOutfitId);
}
}
}

View file

@ -0,0 +1,36 @@
using Mina.Core.Buffer;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class ServerByePDU : AbstractVoltronPacket
{
public uint ReasonCode;
public string ReasonText;
public string Ticket;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
this.ReasonCode = input.GetUInt32();
this.ReasonText = input.GetPascalString();
this.Ticket = input.GetPascalString();
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.ServerByePDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
var text = ReasonText;
if(text == null){
text = "";
}
output.PutUInt32(ReasonCode);
output.PutPascalString(text);
output.PutPascalString(Ticket);
}
}
}

View file

@ -0,0 +1,43 @@
using System.Collections.Generic;
using Mina.Core.Buffer;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class SetIgnoreListPDU : AbstractVoltronPacket
{
public List<uint> PlayerIds;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
var length = input.GetUInt16();
PlayerIds = new List<uint>();
for(var i=0; i < length; i++)
{
PlayerIds.Add(input.GetUInt32());
}
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
var len = 0;
if(PlayerIds != null)
{
len = PlayerIds.Count;
}
output.PutUInt16((ushort)len);
for(int i=0; i < len; i++)
{
output.PutUInt32(PlayerIds[i]);
}
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.SetIgnoreListPDU;
}
}
}

View file

@ -0,0 +1,33 @@
using Mina.Core.Buffer;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class SetIgnoreListResponsePDU : AbstractVoltronPacket
{
public uint StatusCode;
public string ReasonText;
public uint MaxNumberOfIgnored;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
this.StatusCode = input.GetUInt32();
this.ReasonText = input.GetPascalString();
this.MaxNumberOfIgnored = input.GetUInt32();
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.SetIgnoreListResponsePDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
//var result = Allocate(8 + 4 + ReasonText.Length);
output.PutUInt32(StatusCode);
output.PutPascalString(this.ReasonText);
output.PutUInt32(MaxNumberOfIgnored);
//return result;
}
}
}

View file

@ -0,0 +1,25 @@
using Mina.Core.Buffer;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class SetInvinciblePDU : AbstractVoltronPacket
{
public uint Action;
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
this.Action = input.GetUInt32();
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.SetInvinciblePDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.PutUInt32(Action);
}
}
}

View file

@ -0,0 +1,23 @@
using Mina.Core.Buffer;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class TransmitCreateAvatarNotificationPDU : AbstractVoltronPacket
{
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketType.TransmitCreateAvatarNotificationPDU;
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.Put(10);
}
}
}

View file

@ -0,0 +1,34 @@
using System;
using Mina.Core.Buffer;
using FSO.Common.Serialization;
namespace FSO.Server.Protocol.Voltron.Packets
{
public class VariableVoltronPacket : AbstractVoltronPacket
{
public ushort Type;
public byte[] Bytes;
public VariableVoltronPacket(ushort type, byte[] bytes)
{
this.Type = type;
this.Bytes = bytes;
}
public override void Deserialize(IoBuffer input, ISerializationContext context)
{
throw new NotImplementedException();
}
public override VoltronPacketType GetPacketType()
{
return VoltronPacketTypeUtils.FromPacketCode(Type);
}
public override void Serialize(IoBuffer output, ISerializationContext context)
{
output.Put(Bytes, 0, Bytes.Length);
}
}
}