111 lines
3.5 KiB
C#
111 lines
3.5 KiB
C#
namespace LocationsApi.Models;
|
|
|
|
public class TrainUnitRequest
|
|
{
|
|
public string UnitType { get; set; } = "Scout";
|
|
public int? Q { get; set; }
|
|
public int? R { get; set; }
|
|
}
|
|
|
|
public class MoveUnitSquadRequest
|
|
{
|
|
public string? UnitId { get; set; }
|
|
public string UnitType { get; set; } = "Archer";
|
|
public int FromQ { get; set; }
|
|
public int FromR { get; set; }
|
|
public int ToQ { get; set; }
|
|
public int ToR { get; set; }
|
|
}
|
|
|
|
public class DismissUnitSquadRequest
|
|
{
|
|
public string UnitType { get; set; } = "Archer";
|
|
public int Q { get; set; }
|
|
public int R { get; set; }
|
|
}
|
|
|
|
public class DismissUnitSquadResponse
|
|
{
|
|
public string UnitType { get; set; } = "";
|
|
public int DismissedCount { get; set; }
|
|
}
|
|
|
|
public class UnitTrainingResponse
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string Username { get; set; } = "";
|
|
public string UnitType { get; set; } = "";
|
|
public int GoldCost { get; set; }
|
|
public int WoodCost { get; set; }
|
|
public int OreCost { get; set; }
|
|
public int? OriginQ { get; set; }
|
|
public int? OriginR { get; set; }
|
|
public string Status { get; set; } = "";
|
|
public DateTime StartedAtUtc { get; set; }
|
|
public DateTime CompletesAtUtc { get; set; }
|
|
public DateTime? CompletedAtUtc { get; set; }
|
|
|
|
public static UnitTrainingResponse FromTraining(UnitTraining training) => new()
|
|
{
|
|
Id = training.Id,
|
|
Username = training.Username,
|
|
UnitType = training.UnitType,
|
|
GoldCost = training.GoldCost,
|
|
WoodCost = training.WoodCost,
|
|
OreCost = training.OreCost,
|
|
OriginQ = training.OriginQ,
|
|
OriginR = training.OriginR,
|
|
Status = training.Status,
|
|
StartedAtUtc = training.StartedAtUtc,
|
|
CompletesAtUtc = training.CompletesAtUtc,
|
|
CompletedAtUtc = training.CompletedAtUtc
|
|
};
|
|
}
|
|
|
|
public class UnitInstanceResponse
|
|
{
|
|
public string Id { get; set; } = "";
|
|
public string Username { get; set; } = "";
|
|
public string UnitType { get; set; } = "";
|
|
public int Q { get; set; }
|
|
public int R { get; set; }
|
|
public string Status { get; set; } = "";
|
|
public int MovementPerTick { get; set; }
|
|
public int MovementRemaining { get; set; }
|
|
public DateTime LastMovementRefillAtUtc { get; set; }
|
|
public int? DestinationQ { get; set; }
|
|
public int? DestinationR { get; set; }
|
|
public DateTime? MovementStartedAtUtc { get; set; }
|
|
public DateTime? MovementCompletesAtUtc { get; set; }
|
|
public DateTime CreatedAtUtc { get; set; }
|
|
public DateTime UpdatedAtUtc { get; set; }
|
|
|
|
public static UnitInstanceResponse FromUnit(UnitInstance unit) => new()
|
|
{
|
|
Id = unit.Id,
|
|
Username = unit.Username,
|
|
UnitType = unit.UnitType,
|
|
Q = unit.Q,
|
|
R = unit.R,
|
|
Status = unit.Status,
|
|
MovementPerTick = unit.MovementPerTick,
|
|
MovementRemaining = unit.MovementRemaining,
|
|
LastMovementRefillAtUtc = unit.LastMovementRefillAtUtc,
|
|
DestinationQ = unit.DestinationQ,
|
|
DestinationR = unit.DestinationR,
|
|
MovementStartedAtUtc = unit.MovementStartedAtUtc,
|
|
MovementCompletesAtUtc = unit.MovementCompletesAtUtc,
|
|
CreatedAtUtc = unit.CreatedAtUtc,
|
|
UpdatedAtUtc = unit.UpdatedAtUtc
|
|
};
|
|
}
|
|
|
|
public class PlayerUnitsResponse
|
|
{
|
|
public int CompletedScouts { get; set; }
|
|
public int CompletedArchers { get; set; }
|
|
public int CompletedPeasants { get; set; }
|
|
public List<UnitTrainingResponse> Training { get; set; } = [];
|
|
public List<UnitInstanceResponse> Units { get; set; } = [];
|
|
}
|