mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-04 13:47:04 -04:00
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:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
37
server/FSO.Server.Protocol/Gluon/Packets/AdvertiseCapacity.cs
Executable file
37
server/FSO.Server.Protocol/Gluon/Packets/AdvertiseCapacity.cs
Executable file
|
@ -0,0 +1,37 @@
|
|||
using Mina.Core.Buffer;
|
||||
using FSO.Common.Serialization;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class AdvertiseCapacity : AbstractGluonPacket
|
||||
{
|
||||
public short MaxLots;
|
||||
public short CurrentLots;
|
||||
public byte CpuPercentAvg;
|
||||
public long RamUsed;
|
||||
public long RamAvaliable;
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.AdvertiseCapacity;
|
||||
}
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
MaxLots = input.GetInt16();
|
||||
CurrentLots = input.GetInt16();
|
||||
CpuPercentAvg = input.Get();
|
||||
RamUsed = input.GetInt64();
|
||||
RamAvaliable = input.GetInt64();
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutInt16(MaxLots);
|
||||
output.PutInt16(CurrentLots);
|
||||
output.Put(CpuPercentAvg);
|
||||
output.PutInt64(RamUsed);
|
||||
output.PutInt64(RamAvaliable);
|
||||
}
|
||||
}
|
||||
}
|
45
server/FSO.Server.Protocol/Gluon/Packets/CityNotify.cs
Executable file
45
server/FSO.Server.Protocol/Gluon/Packets/CityNotify.cs
Executable file
|
@ -0,0 +1,45 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
// Task -> City notifications.
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class CityNotify : AbstractGluonPacket
|
||||
{
|
||||
public CityNotifyType Mode;
|
||||
public uint Value;
|
||||
public string Message = "";
|
||||
|
||||
public CityNotify() { }
|
||||
|
||||
public CityNotify(CityNotifyType mode)
|
||||
{
|
||||
Mode = mode;
|
||||
}
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
Mode = input.GetEnum<CityNotifyType>();
|
||||
Value = input.GetUInt32();
|
||||
Message = input.GetPascalVLCString();
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.CityNotify;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutEnum(Mode);
|
||||
output.PutUInt32(Value);
|
||||
output.PutPascalVLCString(Message);
|
||||
}
|
||||
}
|
||||
|
||||
public enum CityNotifyType : byte
|
||||
{
|
||||
NhoodUpdate = 1
|
||||
}
|
||||
}
|
23
server/FSO.Server.Protocol/Gluon/Packets/HealthPing.cs
Executable file
23
server/FSO.Server.Protocol/Gluon/Packets/HealthPing.cs
Executable file
|
@ -0,0 +1,23 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class HealthPing : AbstractGluonCallPacket
|
||||
{
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
base.Deserialize(input, context);
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
base.Serialize(output, context);
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.HealthPing;
|
||||
}
|
||||
}
|
||||
}
|
27
server/FSO.Server.Protocol/Gluon/Packets/HealthPingResponse.cs
Executable file
27
server/FSO.Server.Protocol/Gluon/Packets/HealthPingResponse.cs
Executable file
|
@ -0,0 +1,27 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class HealthPingResponse : AbstractGluonCallPacket
|
||||
{
|
||||
public string PoolHash { get; set; }
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
base.Deserialize(input, context);
|
||||
PoolHash = input.GetPascalString();
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
base.Serialize(output, context);
|
||||
output.PutPascalString(PoolHash);
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.HealthPingResponse;
|
||||
}
|
||||
}
|
||||
}
|
9
server/FSO.Server.Protocol/Gluon/Packets/IGluonCall.cs
Executable file
9
server/FSO.Server.Protocol/Gluon/Packets/IGluonCall.cs
Executable file
|
@ -0,0 +1,9 @@
|
|||
using System;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public interface IGluonCall
|
||||
{
|
||||
Guid CallId { get; set; }
|
||||
}
|
||||
}
|
40
server/FSO.Server.Protocol/Gluon/Packets/MatchmakerNotify.cs
Executable file
40
server/FSO.Server.Protocol/Gluon/Packets/MatchmakerNotify.cs
Executable file
|
@ -0,0 +1,40 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
/// <summary>
|
||||
/// Lot -> City server messages used to notify the matchmaker about some change to lot state.
|
||||
/// (currently only when an avatar leaves a lot. this frees up a space for the matchmaker to shove someone else in)
|
||||
/// </summary>
|
||||
public class MatchmakerNotify : AbstractGluonPacket
|
||||
{
|
||||
public MatchmakerNotifyType Mode;
|
||||
public uint LotID;
|
||||
public uint AvatarID;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
Mode = input.GetEnum<MatchmakerNotifyType>();
|
||||
LotID = input.GetUInt32();
|
||||
AvatarID = input.GetUInt32();
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.MatchmakerNotify;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutEnum(Mode);
|
||||
output.PutUInt32(LotID);
|
||||
output.PutUInt32(AvatarID);
|
||||
}
|
||||
}
|
||||
|
||||
public enum MatchmakerNotifyType : byte
|
||||
{
|
||||
RemoveAvatar = 1
|
||||
}
|
||||
}
|
39
server/FSO.Server.Protocol/Gluon/Packets/NotifyLotRoommateChange.cs
Executable file
39
server/FSO.Server.Protocol/Gluon/Packets/NotifyLotRoommateChange.cs
Executable file
|
@ -0,0 +1,39 @@
|
|||
using FSO.Common.Serialization;
|
||||
using FSO.Server.Protocol.Gluon.Model;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
/// <summary>
|
||||
/// A signal sent from the city server to notify a lot that an avatar's roommate status on that lot has changed.
|
||||
/// May wish to change this to be more generic for further avatar related changes in future.
|
||||
/// </summary>
|
||||
public class NotifyLotRoommateChange : AbstractGluonPacket
|
||||
{
|
||||
public uint AvatarId;
|
||||
public uint ReplaceId;
|
||||
public int LotId;
|
||||
public ChangeType Change;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
AvatarId = input.GetUInt32();
|
||||
ReplaceId = input.GetUInt32();
|
||||
LotId = input.GetInt32();
|
||||
Change = input.GetEnum<ChangeType>();
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.NotifyLotRoommateChange;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutUInt32(AvatarId);
|
||||
output.PutUInt32(ReplaceId);
|
||||
output.PutInt32(LotId);
|
||||
output.PutEnum(Change);
|
||||
}
|
||||
}
|
||||
}
|
31
server/FSO.Server.Protocol/Gluon/Packets/RequestLotClientTermination.cs
Executable file
31
server/FSO.Server.Protocol/Gluon/Packets/RequestLotClientTermination.cs
Executable file
|
@ -0,0 +1,31 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class RequestLotClientTermination : AbstractGluonPacket
|
||||
{
|
||||
public uint AvatarId;
|
||||
public int LotId;
|
||||
public string FromOwner;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
AvatarId = input.GetUInt32();
|
||||
LotId = input.GetInt32();
|
||||
FromOwner = input.GetPascalString();
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.RequestLotClientTermination;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutUInt32(AvatarId);
|
||||
output.PutInt32(LotId);
|
||||
output.PutPascalString(FromOwner);
|
||||
}
|
||||
}
|
||||
}
|
34
server/FSO.Server.Protocol/Gluon/Packets/RequestTask.cs
Executable file
34
server/FSO.Server.Protocol/Gluon/Packets/RequestTask.cs
Executable file
|
@ -0,0 +1,34 @@
|
|||
using System.Text;
|
||||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class RequestTask : AbstractGluonCallPacket
|
||||
{
|
||||
public string TaskType { get; set; }
|
||||
public string ParameterJson { get; set; }
|
||||
public int ShardId { get; set; }
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
base.Deserialize(input, context);
|
||||
TaskType = input.GetPascalString();
|
||||
ShardId = input.GetInt32();
|
||||
ParameterJson = input.GetString(Encoding.UTF8);
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
base.Serialize(output, context);
|
||||
output.PutPascalString(TaskType);
|
||||
output.PutInt32(ShardId);
|
||||
output.PutString(ParameterJson, Encoding.UTF8);
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.RequestTask;
|
||||
}
|
||||
}
|
||||
}
|
27
server/FSO.Server.Protocol/Gluon/Packets/RequestTaskResponse.cs
Executable file
27
server/FSO.Server.Protocol/Gluon/Packets/RequestTaskResponse.cs
Executable file
|
@ -0,0 +1,27 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class RequestTaskResponse : AbstractGluonCallPacket
|
||||
{
|
||||
public int TaskId;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
base.Deserialize(input, context);
|
||||
TaskId = input.GetInt32();
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
base.Serialize(output, context);
|
||||
output.PutInt32(TaskId);
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.RequestTaskResponse;
|
||||
}
|
||||
}
|
||||
}
|
58
server/FSO.Server.Protocol/Gluon/Packets/SendCityMail.cs
Executable file
58
server/FSO.Server.Protocol/Gluon/Packets/SendCityMail.cs
Executable file
|
@ -0,0 +1,58 @@
|
|||
using FSO.Common.Serialization;
|
||||
using FSO.Files.Formats.tsodata;
|
||||
using Mina.Core.Buffer;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class SendCityMail : AbstractGluonCallPacket
|
||||
{
|
||||
public List<MessageItem> Items { get; set; }
|
||||
|
||||
public SendCityMail() { }
|
||||
|
||||
public SendCityMail(List<MessageItem> items) {
|
||||
Items = items;
|
||||
}
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
base.Deserialize(input, context);
|
||||
var itemCount = input.GetInt32();
|
||||
var dataSize = input.GetInt32();
|
||||
var data = input.GetSlice(dataSize).GetBytes();
|
||||
using (var mem = new MemoryStream(data)) {
|
||||
Items = new List<MessageItem>();
|
||||
for (int i = 0; i < itemCount; i++)
|
||||
{
|
||||
var message = new MessageItem();
|
||||
message.Read(mem);
|
||||
Items.Add(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
base.Serialize(output, context);
|
||||
byte[] data = null;
|
||||
using (var mem = new MemoryStream())
|
||||
{
|
||||
foreach (var item in Items)
|
||||
{
|
||||
item.Save(mem);
|
||||
}
|
||||
data = mem.ToArray();
|
||||
}
|
||||
output.PutInt32(Items.Count);
|
||||
output.PutInt32(data.Length);
|
||||
output.Put(data);
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.CitySendMail;
|
||||
}
|
||||
}
|
||||
}
|
25
server/FSO.Server.Protocol/Gluon/Packets/ShardShutdownCompleteResponse.cs
Executable file
25
server/FSO.Server.Protocol/Gluon/Packets/ShardShutdownCompleteResponse.cs
Executable file
|
@ -0,0 +1,25 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class ShardShutdownCompleteResponse : AbstractGluonPacket
|
||||
{
|
||||
public uint ShardId;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
ShardId = input.GetUInt32();
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.ShardShutdownCompleteResponse;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutUInt32(ShardId);
|
||||
}
|
||||
}
|
||||
}
|
29
server/FSO.Server.Protocol/Gluon/Packets/ShardShutdownRequest.cs
Executable file
29
server/FSO.Server.Protocol/Gluon/Packets/ShardShutdownRequest.cs
Executable file
|
@ -0,0 +1,29 @@
|
|||
using FSO.Common.Serialization;
|
||||
using FSO.Server.Common;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class ShardShutdownRequest : AbstractGluonPacket
|
||||
{
|
||||
public uint ShardId;
|
||||
public ShutdownType Type;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
ShardId = input.GetUInt32();
|
||||
Type = input.GetEnum<ShutdownType>();
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.ShardShutdownRequest;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutUInt32(ShardId);
|
||||
output.PutEnum(Type);
|
||||
}
|
||||
}
|
||||
}
|
41
server/FSO.Server.Protocol/Gluon/Packets/TransferClaim.cs
Executable file
41
server/FSO.Server.Protocol/Gluon/Packets/TransferClaim.cs
Executable file
|
@ -0,0 +1,41 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
using FSO.Server.Protocol.Gluon.Model;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class TransferClaim : AbstractGluonPacket
|
||||
{
|
||||
public ClaimType Type;
|
||||
public ClaimAction Action;
|
||||
public int EntityId;
|
||||
public uint ClaimId;
|
||||
public uint SpecialId; //job lot info
|
||||
public string FromOwner;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
Type = input.GetEnum<ClaimType>();
|
||||
Action = input.GetEnum<ClaimAction>();
|
||||
EntityId = input.GetInt32();
|
||||
ClaimId = input.GetUInt32();
|
||||
SpecialId = input.GetUInt32();
|
||||
FromOwner = input.GetPascalString();
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.TransferClaim;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutEnum(Type);
|
||||
output.PutEnum(Action);
|
||||
output.PutInt32(EntityId);
|
||||
output.PutUInt32(ClaimId);
|
||||
output.PutUInt32(SpecialId);
|
||||
output.PutPascalString(FromOwner);
|
||||
}
|
||||
}
|
||||
}
|
45
server/FSO.Server.Protocol/Gluon/Packets/TransferClaimResponse.cs
Executable file
45
server/FSO.Server.Protocol/Gluon/Packets/TransferClaimResponse.cs
Executable file
|
@ -0,0 +1,45 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
using FSO.Server.Protocol.Gluon.Model;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class TransferClaimResponse : AbstractGluonPacket
|
||||
{
|
||||
public TransferClaimResponseStatus Status;
|
||||
public ClaimType Type;
|
||||
public int EntityId;
|
||||
public uint ClaimId;
|
||||
public string NewOwner;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
Status = input.GetEnum<TransferClaimResponseStatus>();
|
||||
Type = input.GetEnum<ClaimType>();
|
||||
EntityId = input.GetInt32();
|
||||
ClaimId = input.GetUInt32();
|
||||
NewOwner = input.GetPascalString();
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.TransferClaimResponse;
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
output.PutEnum(Status);
|
||||
output.PutEnum(Type);
|
||||
output.PutInt32(EntityId);
|
||||
output.PutUInt32(ClaimId);
|
||||
output.PutPascalString(NewOwner);
|
||||
}
|
||||
}
|
||||
|
||||
public enum TransferClaimResponseStatus
|
||||
{
|
||||
ACCEPTED,
|
||||
REJECTED,
|
||||
CLAIM_NOT_FOUND
|
||||
}
|
||||
}
|
27
server/FSO.Server.Protocol/Gluon/Packets/TuningChanged.cs
Executable file
27
server/FSO.Server.Protocol/Gluon/Packets/TuningChanged.cs
Executable file
|
@ -0,0 +1,27 @@
|
|||
using FSO.Common.Serialization;
|
||||
using Mina.Core.Buffer;
|
||||
|
||||
namespace FSO.Server.Protocol.Gluon.Packets
|
||||
{
|
||||
public class TuningChanged : AbstractGluonCallPacket
|
||||
{
|
||||
public bool UpdateInstantly;
|
||||
|
||||
public override void Deserialize(IoBuffer input, ISerializationContext context)
|
||||
{
|
||||
base.Deserialize(input, context);
|
||||
UpdateInstantly = input.GetBool();
|
||||
}
|
||||
|
||||
public override void Serialize(IoBuffer output, ISerializationContext context)
|
||||
{
|
||||
base.Serialize(output, context);
|
||||
output.PutBool(UpdateInstantly);
|
||||
}
|
||||
|
||||
public override GluonPacketType GetPacketType()
|
||||
{
|
||||
return GluonPacketType.TuningChanged;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue