Initial import of IC.Rebuild
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using System.Globalization;
|
||||
|
||||
namespace ICRebuild.Core;
|
||||
|
||||
public sealed record ServiceBarStatus(bool Shown,string Text,string Tooltip);
|
||||
|
||||
public static class ServiceBarPresentation
|
||||
{
|
||||
public static ServiceBarStatus Build(GameFrame frame,ModuleState height,ModuleState mode,ModuleState display,float preset,float applied)
|
||||
{
|
||||
if(!frame.Ready) return new(false,"IC","Not in game or changing areas. Height offset paused.");
|
||||
var enabled=height==ModuleState.Enabled;
|
||||
var effective=enabled ? Policies.HeightDelta(true,mode==ModuleState.Enabled,frame.Dungeon,applied) : 0;
|
||||
var heightText=height==ModuleState.Failed ? "ERR" : !enabled ? "OFF" : applied==0 ? "SET" : effective==0 ? "HOLD" : Number(effective);
|
||||
var modeText=mode==ModuleState.Failed ? "ERR" : mode==ModuleState.Enabled ? "1" : "0";
|
||||
var floorText=display==ModuleState.Failed ? "ERR" : display!=ModuleState.Enabled ? "OFF" : !frame.Dungeon.Valid ? "--" : $"{frame.Dungeon.Floor}{(frame.Dungeon.SpecialFloor ? "*" : "")}";
|
||||
var reason=!enabled ? "Height disabled." : applied==0 ? "SET: preset ready; press Apply to activate." : effective!=0 ? "Height offset active." : "HOLD: outside a valid deep dungeon or on a special floor.";
|
||||
var dungeonText=mode!=ModuleState.Enabled && display!=ModuleState.Enabled ? "Dungeon sampling disabled." : !frame.Dungeon.Valid ? "No valid deep dungeon instance." : $"Territory {frame.Dungeon.Territory}, dungeon {frame.Dungeon.DungeonId}, floor {frame.Dungeon.Floor}{(frame.Dungeon.SpecialFloor ? " (special)" : "")}.";
|
||||
return new(true,$"IC Y:{heightText} D:{modeText} F:{floorText}",
|
||||
$"Y = height offset (9)\nPreset {Number(preset)}, applied {Number(applied)}, effective {Number(effective)}\n{reason}\nD = dungeon-only mode (10): 1 on, 0 off\nF = floor display (11): -- outside, * special floor\nOFF = disabled; ERR = failed\n{dungeonText}\nClick to open IC settings.");
|
||||
}
|
||||
private static string Number(float value) => value.ToString("0.###",CultureInfo.InvariantCulture);
|
||||
}
|
||||
Reference in New Issue
Block a user