1- using Dalamud . Game . Command ;
1+ using Dalamud . Game . Command ;
22using Dalamud . IoC ;
33using Dalamud . Plugin ;
44using Dalamud . Interface . Windowing ;
77using System ;
88using FFXIVClientStructs . FFXIV . Client . UI . Misc ;
99using ZoomTilt . Structures ;
10- using Dalamud . Game . Gui ;
11- using Dalamud . Logging ;
1210using Dalamud . Game . ClientState . Conditions ;
11+ using Dalamud . Game . Config ;
12+ using Dalamud . Plugin . Services ;
13+ using FFXIVClientStructs . FFXIV . Client . System . Framework ;
1314
1415namespace ZoomTilt {
1516 public sealed unsafe class Plugin : IDalamudPlugin {
@@ -21,6 +22,8 @@ public sealed unsafe class Plugin : IDalamudPlugin {
2122 private ConfigModule * configModule { get ; init ; }
2223 private CameraManager * cameraManager { get ; init ; }
2324
25+ private MainWindow mainWindow { get ; init ; }
26+
2427 public class Dalamud {
2528 public static void Initialize ( DalamudPluginInterface pluginInterface ) =>
2629 pluginInterface . Create < Dalamud > ( ) ;
@@ -30,23 +33,28 @@ public static void Initialize(DalamudPluginInterface pluginInterface) =>
3033 public static DalamudPluginInterface PluginInterface { get ; private set ; } = null ! ;
3134 [ PluginService ]
3235 [ RequiredVersion ( "1.0" ) ]
33- public static CommandManager CommandManager { get ; private set ; } = null ! ;
36+ public static ICommandManager CommandManager { get ; private set ; } = null ! ;
37+
38+ [ PluginService ]
39+ [ RequiredVersion ( "1.0" ) ]
40+ public static IFramework Framework { get ; private set ; } = null ! ;
3441
3542 [ PluginService ]
3643 [ RequiredVersion ( "1.0" ) ]
37- public static Framework Framework { get ; private set ; } = null ! ;
44+ public static ISigScanner SigScanner { get ; private set ; } = null ! ;
3845
3946 [ PluginService ]
4047 [ RequiredVersion ( "1.0" ) ]
41- public static SigScanner SigScanner { get ; private set ; } = null ! ;
48+ public static IChatGui Chat { get ; private set ; } = null ! ;
4249
4350 [ PluginService ]
4451 [ RequiredVersion ( "1.0" ) ]
45- public static ChatGui Chat { get ; private set ; } = null ! ;
52+ public static ICondition Condition { get ; private set ; } = null ! ;
4653
4754 [ PluginService ]
4855 [ RequiredVersion ( "1.0" ) ]
49- public static Condition Condition { get ; private set ; } = null ! ;
56+ public static IGameConfig GameConfig { get ; private set ; } = null ! ;
57+
5058 }
5159
5260 public Plugin ( DalamudPluginInterface pluginInterface
@@ -55,7 +63,6 @@ public Plugin(DalamudPluginInterface pluginInterface
5563 // this.pluginInterface = pluginInterface;
5664 // this.commandManager = commandManager;
5765 // this.framework = framework;
58- this . configModule = ConfigModule . Instance ( ) ;
5966 this . cameraManager = ( CameraManager * ) Dalamud . SigScanner . GetStaticAddressFromSig ( "4C 8D 35 ?? ?? ?? ?? 85 D2" ) ; // g_ControlSystem_CameraManager
6067
6168 Configuration = pluginInterface . GetPluginConfig ( ) as Configuration ?? new Configuration ( ) ;
@@ -65,7 +72,8 @@ public Plugin(DalamudPluginInterface pluginInterface
6572 // var imagePath = Path.Combine(pluginInterface.AssemblyLocation.Directory?.FullName!, "goat.png");
6673 // var goatImage = pluginInterface.UiBuilder.LoadImage(imagePath);
6774
68- windowSystem . AddWindow ( new MainWindow ( this ) ) ;
75+ mainWindow = new MainWindow ( this ) ;
76+ windowSystem . AddWindow ( mainWindow ) ;
6977
7078 Dalamud . CommandManager . AddHandler ( CommandName , new CommandInfo ( OnCommand ) {
7179 HelpMessage = "A useful message to display in /xlhelp"
@@ -99,7 +107,7 @@ public static double Lerp(double delta, double from, double to) {
99107
100108 private float desiredTiltOffset ;
101109 private float currentTiltOffset ;
102- public void Update ( Framework framework ) {
110+ public void Update ( IFramework framework ) {
103111 if ( ! Configuration . Enabled ) return ;
104112
105113 var currentZoom = cameraManager ->WorldCamera ->CurrentZoom ;
@@ -127,7 +135,9 @@ public void Update(Framework framework) {
127135 framework . UpdateDelta . TotalMilliseconds / 100f ,
128136 currentTiltOffset , desiredTiltOffset
129137 ) ;
130- configModule ->SetOption ( ConfigOption . TiltOffset , ( int ) Math . Round ( currentTiltOffset ) ) ;
138+ // [15:33]Cara: its a float with a valid range of -0.08 to 0.21
139+ var actualTiltOffset = ( currentTiltOffset / 100 * ( 0.21 - ( - 0.08 ) ) ) + ( - 0.08 ) ;
140+ Dalamud . GameConfig . Set ( UiControlOption . TiltOffset , ( float ) actualTiltOffset ) ;
131141 }
132142
133143 /* This didn't work
@@ -199,7 +209,7 @@ private void DrawUI() {
199209 }
200210
201211 public void DrawConfigUI ( ) {
202- windowSystem . GetWindow ( "ZoomTilt" ) ! . IsOpen = true ;
212+ mainWindow ! . IsOpen = true ;
203213 }
204214 }
205215}
0 commit comments