DB added and more
This commit is contained in:
35
TOOHUCardAPI/DTO/GameConfigResponse.cs
Normal file
35
TOOHUCardAPI/DTO/GameConfigResponse.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TOOHUCardAPI.DTO
|
||||
{
|
||||
/**
|
||||
* GameRules.GameData.code = data.code // "0000" for success
|
||||
GameRules.GameData.msg = data.msg // error message if any
|
||||
GameRules.GameData.game_code = data.game_code or "" // Possibly some incrementing value for the room num
|
||||
GameRules.GameData.game_msg = data.game_msg or "" // message shown on startup
|
||||
GameRules.GameData.luck_card = data.luck_card or "" // card that luck_crit applies to or "all"
|
||||
GameRules.GameData.luck_crit = data.luck_crit or 0 // above
|
||||
GameRules.GameData.new_card_list = data.new_card_list or ""
|
||||
GameRules.GameData.open_day_list = data.open_day_list or ""
|
||||
GameRules.GameData.is_open_day = data.is_open_day or 0
|
||||
GameRules.GameData.server_time = data.server_time
|
||||
*/
|
||||
public class GameConfigResponse
|
||||
{
|
||||
private static string SUCCESS_CODE = "0000";
|
||||
private static string DEFAULT_GAME_MESSAGE = "Welcome to english Touhou Card";
|
||||
[JsonProperty("code")] public string Code { get; set; } = SUCCESS_CODE;
|
||||
[JsonProperty("msg")] public string Message { get; set; } = string.Empty;
|
||||
[JsonProperty("game_code")] public string GameCode { get; set; } = string.Empty;
|
||||
[JsonProperty("game_msg")] public string GameMessage { get; set; } = DEFAULT_GAME_MESSAGE;
|
||||
[JsonProperty("luck_card")] public string LuckCard { get; set; } = string.Empty;
|
||||
[JsonProperty("luck_crit")] public float LuckCrit { get; set; }
|
||||
[JsonProperty("new_card_list")] public string NewCardList { get; set; } = string.Empty;
|
||||
[JsonProperty("open_day_list")] public string OpenDayList { get; set; } = string.Empty;
|
||||
[JsonProperty("is_open_day")] public int IsOpenDay { get; set; }
|
||||
[JsonProperty("server_time")] public string ServerTime { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
11
TOOHUCardAPI/DTO/IMethodBasedRequest.cs
Normal file
11
TOOHUCardAPI/DTO/IMethodBasedRequest.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace TOOHUCardAPI.DTO
|
||||
{
|
||||
public interface IMethodBasedRequest
|
||||
{
|
||||
[JsonPropertyName("method")]
|
||||
public string Method { get; }
|
||||
}
|
||||
}
|
||||
10
TOOHUCardAPI/DTO/PlayerDataRequestObjects.cs
Normal file
10
TOOHUCardAPI/DTO/PlayerDataRequestObjects.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace TOOHUCardAPI.DTO
|
||||
{
|
||||
public class PlayerDataGetRequestObject
|
||||
{
|
||||
public string Method { get; set; }
|
||||
public Dictionary<string, string> Ids;
|
||||
}
|
||||
}
|
||||
56
TOOHUCardAPI/DTO/PlayerDataResponseObjects.cs
Normal file
56
TOOHUCardAPI/DTO/PlayerDataResponseObjects.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using Newtonsoft.Json;
|
||||
using TOOHUCardAPI.Data.Models;
|
||||
|
||||
namespace TOOHUCardAPI.DTO
|
||||
{
|
||||
public class PlayerDataGetResponseObject
|
||||
{
|
||||
[JsonProperty("bo")]
|
||||
public Dictionary<string, PlayerDataGetResponseObjectPlayer> Players { get; set; }
|
||||
|
||||
public PlayerDataGetResponseObject(Dictionary<string, User> users, IMapper mapper)
|
||||
{
|
||||
this.Players = users.Aggregate(new Dictionary<string, PlayerDataGetResponseObjectPlayer>(),
|
||||
(players, pair) =>
|
||||
{
|
||||
User user = pair.Value;
|
||||
players[pair.Key] = new PlayerDataGetResponseObjectPlayer()
|
||||
{
|
||||
EndTime = user.EndTime.ToShortDateString(),
|
||||
KeyTotal = user.KeyTotal,
|
||||
KeySaveDate = user.KeySaveDate.ToShortDateString(),
|
||||
LevelList = user.LevelList,
|
||||
MaxTeamWave = user.MaxTeamWave,
|
||||
MaxWave = user.MaxWave,
|
||||
PetLevel = user.PetLevel,
|
||||
Point = user.Point
|
||||
};
|
||||
return players;
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fields pulled from the game code
|
||||
* Looking up Gamerules.Playerdata
|
||||
*/
|
||||
public class PlayerDataGetResponseObjectPlayer
|
||||
{
|
||||
[JsonProperty("code")] public string Code { get; set; } = "0000";
|
||||
|
||||
[JsonProperty("msg")] public string Message { get; set; } = string.Empty;
|
||||
//[JsonProperty("steamid")]
|
||||
//public string SteamId { get; set; }
|
||||
[JsonProperty("max_wave")] public int MaxWave { get; set; } = 0;
|
||||
[JsonProperty("max_team_wave")] public int MaxTeamWave { get; set; } = 0;
|
||||
[JsonProperty("pet_level")] public int PetLevel { get; set; } = 1;
|
||||
[JsonProperty("end_time")] public string EndTime { get; set; } = string.Empty;
|
||||
[JsonProperty("key_total")] public int KeyTotal { get; set; } = 100;
|
||||
[JsonProperty("key_save_date")] public string KeySaveDate { get; set; } = string.Empty;
|
||||
[JsonProperty("vip")] public int Vip { get; set; } = 1;
|
||||
[JsonProperty("point")] public int Point { get; set; } = 10000;
|
||||
[JsonProperty("level_list")] public string LevelList { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user