Skip to content

Commit

Permalink
dev tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheneq committed Oct 23, 2020
1 parent 060a103 commit c985c67
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 17 deletions.
4 changes: 2 additions & 2 deletions EvoS.DirectoryServer/DirectoryServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ public void Configure(IApplicationBuilder app)
PlayerData.Player p;
try
{
p = PlayerData.GetPlayer(request.AuthInfo.Handle);
p = PlayerData.GetPlayer(request.AuthInfo.Handle, request.AuthInfo.AccountId);
if (p == null)
{
Log.Print(LogType.Warning, $"Player {request.AuthInfo.Handle} doesnt exists");
PlayerData.CreatePlayer(request.AuthInfo.Handle);
p = PlayerData.GetPlayer(request.AuthInfo.Handle);
p = PlayerData.GetPlayer(request.AuthInfo.Handle, request.AuthInfo.AccountId);
if (p != null)
{
Log.Print(LogType.Debug, $"Succesfully Registered {p.UserName}");
Expand Down
4 changes: 2 additions & 2 deletions EvoS.Framework/DataAccess/PlayerData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ public class Player
public int SelectedRibbonID;
}

public static Player GetPlayer(string UserName)
public static Player GetPlayer(string UserName, long defaultAccountId)
{
if (!EvoSGameConfig.UseDatabase) {
return new Player()
{
AccountId = DateTime.Now.Ticks,
AccountId = defaultAccountId,
UserName = UserName,
LastSelectedCharacter = CharacterType.BazookaGirl,
SelectedTitleID = -1,
Expand Down
2 changes: 1 addition & 1 deletion EvoS.Framework/Game/EvoSGameConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class EvoSGameConfig
public static bool DebugNetworkBehaviour = true;
public static bool DebugSyncVars = false;
public static bool DebugNetSerialize = false;
public static bool UseDatabase = true;
public static bool UseDatabase = false;

public static bool GameTypeAvailability_Practice = true;
public static bool GameTypeAvailability_Coop = false;
Expand Down
4 changes: 2 additions & 2 deletions EvoS.LobbyServer/LobbyQueue/LobbyQueueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ private void CreatePracticeQueue()
TeamBBots = 2,
ResolveTimeoutLimit = 160,
RoomName = "default",
Map = Maps.VR_Practice,
Map = Maps.Skyway_Deathmatch,
SubTypes = new List<GameSubType>
{
new GameSubType
{
DuplicationRule = FreelancerDuplicationRuleTypes.noneInTeam,
GameMapConfigs = new List<GameMapConfig> { new GameMapConfig(Maps.VR_Practice) },
GameMapConfigs = new List<GameMapConfig> { new GameMapConfig(Maps.Skyway_Deathmatch) },
InstructionsToDisplay = GameSubType.GameLoadScreenInstructions.Default,
LocalizedName = "GenericPractice@SubTypes",
PersistedStatBucket = PersistedStatBucket.Deathmatch_Unranked,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class RegisterGameClientRequestHandler : IEvosNetworkMessageHandler
public async Task OnMessage(LobbyServerConnection connection, object requestData)
{
RegisterGameClientRequest request = (RegisterGameClientRequest) requestData;
PlayerData.Player p = PlayerData.GetPlayer(request.SessionInfo.Handle);
PlayerData.Player p = PlayerData.GetPlayer(request.SessionInfo.Handle, request.SessionInfo.AccountId);

connection.SessionToken = request.SessionInfo.SessionToken;

Expand Down Expand Up @@ -113,7 +113,8 @@ private static RegisterGameClientResponse RegisterGameClient(RegisterGameClientR
response.SessionInfo.ConnectionAddress = "127.0.0.1";
response.SessionInfo.LanguageCode = "EN";
response.AuthInfo = request.AuthInfo;
response.AuthInfo.AccountId = request.SessionInfo.AccountId; // Override AuthInfo.AccountId with SessionInfo.AccountID, The account id from SessionInfo is set in the DirectoryServer and has the accountid value from database for the client username
//response.AuthInfo.AccountId = request.SessionInfo.AccountId; // Override AuthInfo.AccountId with SessionInfo.AccountID, The account id from SessionInfo is set in the DirectoryServer and has the accountid value from database for the client username
Log.Print(LogType.Lobby, $"AccountId {request.AuthInfo.AccountId} (-> {request.SessionInfo.AccountId})");
response.DevServerConnectionUrl = "127.0.0.1"; // What is this?
response.AuthInfo.AccountStatus = null;
response.Status = new LobbyStatusNotification
Expand Down
4 changes: 2 additions & 2 deletions EvoS.LobbyServer/Utils/GameTypesUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static GameTypeAvailability GetPracticeGameTypeAvailability() {
{
new GameSubType {
LocalizedName = "GenericPractice@SubTypes",
GameMapConfigs = new List<GameMapConfig>{ new GameMapConfig(Maps.VR_Practice, true) },
GameMapConfigs = new List<GameMapConfig>{ new GameMapConfig(Maps.Skyway_Deathmatch, true) },
RewardBucket = GameBalanceVars.GameRewardBucketType.NoRewards,
PersistedStatBucket = PersistedStatBucket.DoNotPersist,
TeamBBots = 2,
Expand Down Expand Up @@ -109,7 +109,7 @@ public static GameTypeAvailability GetPvPGameTypeAvailability() {
new GameSubType
{
LocalizedName = "GenericPvP@SubTypes",
GameMapConfigs = new List<GameMapConfig>{ new GameMapConfig(Maps.VR_Practice, true) },
GameMapConfigs = new List<GameMapConfig>{ new GameMapConfig(Maps.Skyway_Deathmatch, true) },
RewardBucket = GameBalanceVars.GameRewardBucketType.NoRewards,
PersistedStatBucket = PersistedStatBucket.DoNotPersist,
TeamBBots = 2,
Expand Down
26 changes: 25 additions & 1 deletion LobbyServer2/BridgeServer/BridgeServerProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public enum BridgeMessageType
SetTeamInfo,
Start,
Stop,
GameStatusChange
GameStatusChange,
PlayerLeaving
}

protected override void OnMessage(MessageEventArgs e)
Expand Down Expand Up @@ -111,5 +112,28 @@ public void SendStartNotification()
Send(stream.ToArray());
Log.Print(LogType.Game, "Starting Game Server");
}

public void SendPlayerLeavingNotification(long accountId, bool isPermanent, GameResult gameResult)
{
MemoryStream stream = new MemoryStream();
stream.WriteByte((byte)BridgeMessageType.PlayerLeaving);
string jsonData = JsonConvert.SerializeObject(new PlayerLeavingNotification()
{
AccountId = accountId,
IsPermanent = isPermanent,
GameResult = gameResult
});
stream.Write(GetBytesSpan(jsonData));
Send(stream.ToArray());
Log.Print(LogType.Game, $"Player {accountId} leaves game");
}

[Serializable]
class PlayerLeavingNotification
{
public long AccountId;
public bool IsPermanent;
public GameResult GameResult;
}
}
}
2 changes: 1 addition & 1 deletion LobbyServer2/LobbyServer/Config/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace CentralServer.LobbyServer.Config
{
static class ConfigManager
{
public static string MOTDPopUpText = "Welcome back";
public static string MOTDPopUpText = "";
public static string MOTDText = "Lobby server version 2";

public static string PatchNotesHeader = "Evos Emulator v0.1";
Expand Down
4 changes: 2 additions & 2 deletions LobbyServer2/LobbyServer/GameMode/GameModeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private static GameTypeAvailability GetPracticeGameTypeAvailability()
{
new GameSubType {
LocalizedName = "GenericPractice@SubTypes",
GameMapConfigs = new List<GameMapConfig>{ new GameMapConfig(Maps.VR_Practice, true) },
GameMapConfigs = new List<GameMapConfig>{ new GameMapConfig(Maps.Skyway_Deathmatch, true) },
RewardBucket = GameBalanceVars.GameRewardBucketType.NoRewards,
PersistedStatBucket = PersistedStatBucket.DoNotPersist,
TeamAPlayers = 1,
Expand Down Expand Up @@ -106,7 +106,7 @@ private static GameTypeAvailability GetPvPGameTypeAvailability()
new GameSubType
{
LocalizedName = "GenericPvP@SubTypes",
GameMapConfigs = new List<GameMapConfig>{ new GameMapConfig(Maps.VR_Practice, true) },
GameMapConfigs = new List<GameMapConfig>{ new GameMapConfig(Maps.Skyway_Deathmatch, true) },
RewardBucket = GameBalanceVars.GameRewardBucketType.NoRewards,
PersistedStatBucket = PersistedStatBucket.DoNotPersist,
TeamAPlayers = 1,
Expand Down
13 changes: 12 additions & 1 deletion LobbyServer2/LobbyServer/LobbyServerProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ protected override void OnOpen()
RegisterHandler(new EvosMessageDelegate<ClientErrorSummary>(HandleClientErrorSummary));
RegisterHandler(new EvosMessageDelegate<PreviousGameInfoRequest>(HandlePreviousGameInfoRequest));
RegisterHandler(new EvosMessageDelegate<PurchaseTintRequest>(HandlePurchaseTintRequest));
RegisterHandler(new EvosMessageDelegate<LeaveGameRequest>(HandleLeaveGameRequest));

/*
RegisterHandler(new EvosMessageDelegate<PurchaseModResponse>(HandlePurchaseModRequest));
Expand Down Expand Up @@ -235,7 +236,17 @@ public void HandlePurchaseTintRequest(PurchaseTintRequest request)
sk.Save();
}


public void HandleLeaveGameRequest(LeaveGameRequest request)
{
Console.WriteLine("LeaveGameRequest " + JsonConvert.SerializeObject(request));

LeaveGameResponse response = new LeaveGameResponse()
{
Success = true,
ResponseId = request.RequestId
};
Send(response);
}


}
Expand Down
3 changes: 2 additions & 1 deletion LobbyServer2/LobbyServer/Matchmaking/MatchmakingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ public static void StartPractice(LobbyServerProtocolBase client)
ActiveHumanPlayers = 1,
ActivePlayers = 1,
CreateTimestamp = DateTime.Now.Ticks,
GameServerProcessCode = "Artemis" + DateTime.Now.Ticks,
GameConfig = new LobbyGameConfig
{
GameOptionFlags = GameOptionFlag.NoInputIdleDisconnect & GameOptionFlag.NoInputIdleDisconnect,
GameServerShutdownTime = -1,
GameType = GameType.Practice,
InstanceSubTypeBit = 1,
IsActive = true,
Map = Maps.VR_Practice,
Map = Maps.Skyway_Deathmatch,
ResolveTimeoutLimit = 1600, // TODO ?
RoomName = "",
Spectators = 0,
Expand Down

0 comments on commit c985c67

Please sign in to comment.