Skip to content

Commit

Permalink
Add C# model repository in preparation to remove protobuf. Implement …
Browse files Browse the repository at this point in the history
…ASP.NET API
  • Loading branch information
QuinnBast committed Jan 16, 2023
1 parent e50c359 commit 859d98e
Show file tree
Hide file tree
Showing 82 changed files with 9,367 additions and 7,164 deletions.
68 changes: 68 additions & 0 deletions Core/Models/AccountModels.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;

namespace SubterfugeCore.Models.GameEvents
{
public interface INetworkAccountManager
{
AuthorizationResponse Login(AuthorizationRequest request);
AuthorizationResponse LoginWithToken(AuthorizedTokenRequest tokenRequest);
AuthorizationResponse RegisterAccount(AccountRegistrationRequest registrationRequeset);
GetRolesResponse GetRoles(GetRolesRequest roleRequest);
}

public class User
{
public string Id { get; set; }
public string Username { get; set; }
}

public class AuthorizationRequest
{
public string Username { get; set; }
public string Password { get; set; }
}

public class AuthorizedTokenRequest
{
public string Token { get; set; }
}

public class AuthorizationResponse : NetworkResponse
{
public User User { get; set; }
public string Token { get; set; }
}

public class AccountRegistrationRequest
{
public string Username { get; set; }
public string Password { get; set; }
public string Email { get; set; }
public string DeviceIdentifier { get; set; }
public string PhoneNumber { get; set; }
}

public class AccountRegistrationResponse : NetworkResponse
{
public User User { get; set; }
public string Token { get; set; }
}

public class GetRolesRequest {}

public class GetRolesResponse : NetworkResponse
{
public List<UserClaim> Claims { get; set; }
}

public enum UserClaim
{
Unknown,
User,
Moderator,
Administrator,
EmailVerified,
Banned,
}
}
27 changes: 27 additions & 0 deletions Core/Models/BaseNetworkModels.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;

namespace SubterfugeCore.Models.GameEvents
{
public interface INetworkHealthInterface
{
PingResponse Ping(PingRequest pingRequest);
PingResponse AuthorizedHealthCheck(AuthorizedPingRequest authorizedPingRequest);
}

public class NetworkResponse
{
public ResponseStatus Status { get; set; }
}

public class ResponseStatus
{
public Boolean IsSuccess { get; set; }
public String Detail { get; set; }
}

public class PingRequest { }

public class PingResponse : NetworkResponse { }

public class AuthorizedPingRequest { }
}
94 changes: 94 additions & 0 deletions Core/Models/ChatModels.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using System.Collections.Generic;
using System.Linq;

namespace SubterfugeCore.Models.GameEvents
{

public interface INetworkChatManager
{
CreateMessageGroupResponse CreateMessageGroup(CreateMessageGroupRequest createMessageGroupRequest);

SendMessageResponse SendMessage(SendMessageRequest sendMessageRequest);

GetMessageGroupsResponse GetMessageGroups(GetMessageGroupsRequest getMessageGroupsRequest);

GetGroupMessagesResponse GetGroupMessages(GetGroupMessagesRequest getGroupMessagesRequest);
}

public class MessageGroupDatabaseModel
{
public string Id { get; set; }
public string RoomId { get; set; }
public List<string> MemberIds { get; set; }
}

public class MessageGroup
{
public string Id { get; set; }
public string RoomId { get; set; }
public List<User> GroupMembers { get; set; }
public List<ChatMessage> Messages { get; set; }

public MessageGroupDatabaseModel ToDatabaseModel()
{
return new MessageGroupDatabaseModel()
{
Id = Id,
RoomId = RoomId,
MemberIds = GroupMembers.Select(it => it.Id).ToList()
};
}
}

public class ChatMessage
{
public string RoomId { get; set; }
public string GroupId { get; set; }
public string Id { get; set; }
public long UnixTimeCreatedAt { get; set; }
public User SentBy { get; set; }
public string Message { get; set; }
}

public class CreateMessageGroupRequest
{
public string RoomId { get; set; }
public List<string> UserIdsInGroup { get; set; }
}

public class CreateMessageGroupResponse : NetworkResponse
{
public string GroupId { get; set; }
}

public class SendMessageRequest
{
public string RoomId { get; set; }
public string GroupId { get; set; }
public string Message { get; set; }
}

public class SendMessageResponse : NetworkResponse { }

public class GetMessageGroupsRequest
{
public string RoomId { get; set; }
}

public class GetMessageGroupsResponse : NetworkResponse
{
private List<MessageGroup> MessageGroups { get; set; }
}

public class GetGroupMessagesRequest
{
public string RoomId { get; set; }
public string GroupId { get; set; }
public long Pagination { get; set; }
}

public class GetGroupMessagesResponse : NetworkResponse
{
public MessageGroup Group { get; set; }
}
}
174 changes: 174 additions & 0 deletions Core/Models/CustomSpecialistModels.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
using System.Collections.Generic;

namespace SubterfugeCore.Models.GameEvents
{
public interface INetworkCustomSpeicliastManager
{

SubmitCustomSpecialistResponse SubmitCustomSpecialist(
SubmitCustomSpecialistRequest submitCustomSpecialistRequest);

GetCustomSpecialistsResponse GetCustomSpecialists(GetCustomSpecialistsRequest getCustomSpecialistsRequest);

CreateSpecialistPackageResponse CreateSpecialistPackage(CreateSpecialistPackageRequest createSpecialistPackageRequest);

GetSpecialistPackagesResponse GetSpecialistPackages(GetSpecialistPackagesRequest getSpecialistPackagesRequest);
}

public class SpecialistConfiguration
{
public string Id { get; set; }
public long Priority { get; set; }
public string SpecialistName { get; set; }
public User Creator { get; set; }
public List<SpecialistEffectConfiguration> SpecialistEffects { get; set; }
public string PromotesFromSpecialistId { get; set; }
public List<SpecialistClass> SpecialistClasses { get; set; }
}

public class SpecialistEffectConfiguration
{
public long Value { get; set; }
public EffectTrigger EffectTrigger { get; set; }
public EffectTarget EffectTarget { get; set; }
public EffectTriggerRange EffectTriggerRange { get; set; }
public EffectModifier EffectModifier { get; set; }
public SpecialistEffectScale EffectScale { get; set; }
}

public class SpecialistEffectScale {
public EffectScale EffectScale { get; set; }
public EffectTarget EffectScaleTarget { get; set; }
public EffectTriggerRange EffectTriggerRange { get; set; }
}

public enum SpecialistClass
{
Unknown,
Warrier,
Protector,
Theif,
Zoner,
Investor,
Controller,
Producer,
Influencer,
Leecher,
Zoomer,
Piercer,
}

public enum EffectTrigger
{
NoTrigger,
Hire,
Promote,
SubLaunch,
SubArrive,
OutpostCombat,
SubCombat,
CombatLoss,
CombatVictory,
FactoryProduce,
MineProduce,
SubEnterVision,
}

public enum EffectTarget
{
NoTarget,
Friendly,
Enemy,
OnlyCombatParticipants,
Any,
}

public enum EffectTriggerRange
{
Self,
Local,
ConstantRange,
LocationVisionRange,
PlayerVisionRange,
Global,
}

public enum EffectModifier
{
NoEffect,
Driller,
SpecialistCapacity,
ShieldValue,
ShieldRegenerationRate,
ShieldMaxValue,
VisionRange,
Speed,
KillPlayer,
VictoryPlayer,
NeptuniumGenerationRate,
KillSpecialist,
SwapSpecialistOwner,
}

public enum EffectScale
{
NoScale,
ConstantValue,
PlayerOutpostCount
}

public class SpecialistPackage {
public string Id { get; set; }
public User Creator { get; set; }
public string PackageName { get; set; }
public List<string> SpecialistIds { get; set; }
public long TimesUsedInGame { get; set; }
}

public class SubmitCustomSpecialistRequest
{
public SpecialistConfiguration SpecialistConfiguration { get; set; }
}

public class SubmitCustomSpecialistResponse : NetworkResponse
{
public string SpecialistConfigurationId { get; set; }
}

public class GetCustomSpecialistsRequest
{
public long PageNumber { get; set; }
public string SearchTerm { get; set; }
public string PromotesFromSpecialistId { get; set; }
public string CreatedByPlayerId { get; set; }
}

public class GetCustomSpecialistsResponse : NetworkResponse
{
public List<SpecialistConfiguration> CustomSpecialists { get; set; }
}

public class CreateSpecialistPackageRequest
{
public SpecialistPackage SpecialistPackage { get; set; }
}

public class CreateSpecialistPackageResponse : NetworkResponse
{
public string SpecialistPackageId { get; set; }
}

public class GetSpecialistPackagesRequest
{
public long PageNumber { get; set; }
public string SearchTerm { get; set; }
public string IsPackageCreatedById { get; set; }
public string PackageContainsSpecialistId { get; set; }
}

public class GetSpecialistPackagesResponse : NetworkResponse
{
public List<SpecialistPackage> SpecialistPackages { get; set; }
}

}
Loading

0 comments on commit 859d98e

Please sign in to comment.