feat: 보스레이드 연동 — 입장 요청, 토큰 검증, 결과 보고 API 추가
- RestApi에 보스레이드 입장/검증/시작/완료/실패 엔드포인트 추가 - GameServer에 보스레이드 흐름 처리 로직 - Player 모델에 보스레이드 상태 필드 추가 - 보스레이드 관련 패킷 정의 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -60,6 +60,38 @@ public class RestApi : Singleton<RestApi>
|
||||
return null;
|
||||
}
|
||||
|
||||
// 플레이어 프로필 조회 - 성공 시 PlayerProfileResponse 반환
|
||||
public async Task<PlayerProfileResponse?> GetPlayerProfileAsync(string username)
|
||||
{
|
||||
string url = VERIFY_URL + "/api/internal/player/profile?username=" + Uri.EscapeDataString(username);
|
||||
for (int attempt = 1; attempt <= MAX_RETRY; attempt++)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||
if (response.StatusCode == HttpStatusCode.NotFound)
|
||||
{
|
||||
Log.Warning("[RestApi] 프로필 없음 username={Username}", username);
|
||||
return null;
|
||||
}
|
||||
|
||||
response.EnsureSuccessStatusCode();
|
||||
return await response.Content.ReadFromJsonAsync<PlayerProfileResponse>();
|
||||
}
|
||||
catch (Exception ex) when (attempt < MAX_RETRY)
|
||||
{
|
||||
Log.Warning("[RestApi] 프로필 조회 실패 (시도 {Attempt}/{Max}): {Message}", attempt, MAX_RETRY, ex.Message);
|
||||
await Task.Delay(RETRY_DELAY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("[RestApi] 프로필 조회 최종 실패 ({Max}회 시도): {Message}", MAX_RETRY, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private sealed class AuthVerifyResponse
|
||||
{
|
||||
[JsonPropertyName("username")]
|
||||
@@ -69,4 +101,34 @@ public class RestApi : Singleton<RestApi>
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class PlayerProfileResponse
|
||||
{
|
||||
[JsonPropertyName("nickname")]
|
||||
public string Nickname { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("level")]
|
||||
public int Level { get; set; }
|
||||
|
||||
[JsonPropertyName("experience")]
|
||||
public int Experience { get; set; }
|
||||
|
||||
[JsonPropertyName("nextExp")]
|
||||
public int NextExp { get; set; }
|
||||
|
||||
[JsonPropertyName("maxHp")]
|
||||
public double MaxHp { get; set; }
|
||||
|
||||
[JsonPropertyName("maxMp")]
|
||||
public double MaxMp { get; set; }
|
||||
|
||||
[JsonPropertyName("attackPower")]
|
||||
public double AttackPower { get; set; }
|
||||
|
||||
[JsonPropertyName("attackRange")]
|
||||
public double AttackRange { get; set; }
|
||||
|
||||
[JsonPropertyName("sprintMultiplier")]
|
||||
public double SprintMultiplier { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user