fix(gameplay): resolve character switch, outfit hiding, weather, and locomotion issues
This commit is contained in:
1 parent
a8ad83a84a
commit
81a0f65ea6
4 files changed
+289
-48
No files matched your search
@@ -120,6 +120,8 @@ internal sealed class DebugApiServer(PrivateServerConfig config, GameSessionHub
|
||||
await WriteJsonAsync(ctx, await TimeSetAsync(await ReadBodyAsync(ctx.Request, token), token), token);
|
||||
else if (method == "POST" && path == "/api/weather/set")
|
||||
await WriteJsonAsync(ctx, await WeatherSetAsync(await ReadBodyAsync(ctx.Request, token), token), token);
|
||||
else if (method == "POST" && path == "/api/weather/fog")
|
||||
await WriteJsonAsync(ctx, await WeatherFogAsync(await ReadBodyAsync(ctx.Request, token), token), token);
|
||||
else if (method == "POST" && path == "/api/world/switch-scene")
|
||||
await WriteJsonAsync(ctx, await SwitchSceneAsync(await ReadBodyAsync(ctx.Request, token), token), token);
|
||||
else if (method == "POST" && path == "/api/unstuck/blackscreen")
|
||||
@@ -902,6 +904,32 @@ internal sealed class DebugApiServer(PrivateServerConfig config, GameSessionHub
|
||||
return new { ok = true, weatherId, transition };
|
||||
}
|
||||
|
||||
private async Task<object> WeatherFogAsync(string json, CancellationToken token)
|
||||
{
|
||||
var session = hub.Current;
|
||||
if (session is null)
|
||||
return new { ok = false, error = "no live game session (is the client in the world?)" };
|
||||
|
||||
float density = 0.08f;
|
||||
try
|
||||
{
|
||||
using var doc = JsonDocument.Parse(string.IsNullOrWhiteSpace(json) ? "{}" : json);
|
||||
var root = doc.RootElement;
|
||||
if (root.TryGetProperty("density", out var pd))
|
||||
density = pd.GetSingle();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return new { ok = false, error = $"bad request: {ex.Message}" };
|
||||
}
|
||||
|
||||
var cmd = $"CMD:SET_FOG:{density.ToString(System.Globalization.CultureInfo.InvariantCulture)}";
|
||||
await session.NotifyAsync(MethodId.SyncNotice, UxSerializer.Serialize(cmd), token);
|
||||
|
||||
session.Log.Info($"[DEBUG-API] fog set density={density}");
|
||||
return new { ok = true, density };
|
||||
}
|
||||
|
||||
private async Task<object> UnstuckBlackScreenAsync(CancellationToken token)
|
||||
{
|
||||
var session = hub.Current;
|
||||
|
||||
@@ -37,25 +37,37 @@
|
||||
<div id="clock">12:00</div>
|
||||
<input id="timeslider" type="range" min="0" max="1439" step="1" value="720" aria-label="Time of day">
|
||||
<div class="muted">00:00 — night · 06:00 — morning · 12:00 — noon · 18:00 — evening · 23:59 — night</div>
|
||||
<div style="margin-top:8px">
|
||||
<button class="ghost" onclick="setTimePreset(6, 0)">🌅 Morning (06:00)</button>
|
||||
<button class="ghost" onclick="setTimePreset(12, 0)">☀️ Noon (12:00)</button>
|
||||
<button class="ghost" onclick="setTimePreset(18, 30)">🌇 Evening (18:30)</button>
|
||||
<button class="ghost" onclick="setTimePreset(22, 0)">🌙 Night (22:00)</button>
|
||||
<button class="ghost" onclick="setTimePreset(0, 0)">🌌 Midnight (00:00)</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<h2>Weather / Atmosphere (สภาพอากาศ)</h2>
|
||||
<div>
|
||||
<button style="background:#fbc02d;color:#222;font-weight:bold" onclick="setWeather(1)">☀️ Sunny (แดดออก)</button>
|
||||
<button style="background:#78909c" onclick="setWeather(2)">⛅ Cloudy (มีเมฆมาก)</button>
|
||||
<button style="background:#1976d2" onclick="setWeather(3)">🌧️ Rain (ฝนตก)</button>
|
||||
<button style="background:#512da8" onclick="setWeather(4)">⛈️ Storm (พายุฝนฟ้าคะนอง)</button>
|
||||
<button style="background:#757575" onclick="setWeather(5)">🌫️ Fog (หมอกลงจัด)</button>
|
||||
<button style="background:#455a64" onclick="setWeather(6)">🌥️ Overcast (มืดครึ้ม)</button>
|
||||
<button style="background:#303f9f" onclick="setWeather(7)">🌙 Night / Snow (หิมะ/กลางคืน)</button>
|
||||
<button style="background:#fbc02d;color:#222;font-weight:bold" onclick="setWeather(1)">☀️ Sunny (แดดออก) [1]</button>
|
||||
<button style="background:#78909c" onclick="setWeather(2)">⛅ Cloudy (มีเมฆมาก) [2]</button>
|
||||
<button style="background:#1976d2" onclick="setWeather(3)">🌧️ Rain (ฝนตก) [3]</button>
|
||||
<button style="background:#512da8" onclick="setWeather(4)">⛈️ Storm (พายุฝนฟ้าคะนอง) [4]</button>
|
||||
<button style="background:#00897b" onclick="setWeather(5)">🌤️ Afterrain (หลังฝนตก / ใสเคลียร์) [5]</button>
|
||||
</div>
|
||||
<div style="margin-top:10px;padding:8px;background:#252932;border-radius:6px">
|
||||
<div style="font-weight:bold;margin-bottom:6px;color:#80deea">🌫️ Volumetric Exponential Fog (หมอกหนา / ทัศนวิสัย):</div>
|
||||
<button style="background:#00695c" onclick="setFog(0.08)">🌫️ Thick Fog (เปิดหมอกหนาจัด 0.08)</button>
|
||||
<button style="background:#00838f" onclick="setFog(0.02)">🌁 Light Fog (หมอกบาง 0.02)</button>
|
||||
<button class="ghost" onclick="setFog(0)">☀️ Clear Fog (ปิดหมอก)</button>
|
||||
<div class="muted" style="margin-top:4px">ปรับความหนาแน่นหมอกแบบเรียลไทม์ผ่าน WeatherBridge.EnableExternalExpFogDensity</div>
|
||||
</div>
|
||||
<div style="margin-top:8px">
|
||||
Custom Weather ID: <input id="customWeatherId" type="number" style="width:90px" value="1">
|
||||
Custom Weather ID: <input id="customWeatherId" type="number" style="width:90px" value="1" min="1" max="5">
|
||||
Transition (sec): <input id="weatherTransition" type="number" style="width:70px" value="5">
|
||||
<button class="ghost" onclick="setCustomWeather()">Apply Custom Weather</button>
|
||||
</div>
|
||||
<div class="muted" style="margin-top:6px">ซิงค์สภาพอากาศของโลกและบรรยากาศ client ทันที</div>
|
||||
<div class="muted" style="margin-top:6px">ซิงค์สภาพอากาศของโลก (WeatherConfig 1..5) และบรรยากาศ client ทันที</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
@@ -444,6 +456,18 @@ async function toggleClothes() {
|
||||
log('toggle clothes: ' + JSON.stringify(r));
|
||||
}
|
||||
|
||||
async function setTimePreset(hour, minute) {
|
||||
const slider = document.getElementById('timeslider');
|
||||
if (slider) {
|
||||
slider.value = hour * 60 + minute;
|
||||
const clock = document.getElementById('clock');
|
||||
if (clock) clock.textContent = fmtClock(hour * 60 + minute);
|
||||
}
|
||||
const body = { hour, minute, fix: true, transition: 5 };
|
||||
const r = await api('/api/time/set', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
||||
log('time preset: ' + JSON.stringify(r));
|
||||
}
|
||||
|
||||
async function setWeather(weatherId) {
|
||||
const transition = parseInt(document.getElementById('weatherTransition')?.value || '5', 10);
|
||||
const body = { weatherId: parseInt(weatherId, 10), transition };
|
||||
@@ -451,6 +475,12 @@ async function setWeather(weatherId) {
|
||||
log('set weather: ' + JSON.stringify(r));
|
||||
}
|
||||
|
||||
async function setFog(density) {
|
||||
const body = { density: parseFloat(density) };
|
||||
const r = await api('/api/weather/fog', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
|
||||
log('set fog: ' + JSON.stringify(r));
|
||||
}
|
||||
|
||||
async function setCustomWeather() {
|
||||
const id = parseInt(document.getElementById('customWeatherId').value || '1', 10);
|
||||
await setWeather(id);
|
||||
|
||||
Reference in new issue
Block a user