Rename SettingsTracker
This commit is contained in:
@@ -43,7 +43,7 @@ public class DevToolsPanel extends PluginPanel
|
|||||||
private final Client client;
|
private final Client client;
|
||||||
private final DevToolsPlugin plugin;
|
private final DevToolsPlugin plugin;
|
||||||
|
|
||||||
private final SettingsTracker settingsTracker;
|
private final VarTracker varTracker;
|
||||||
|
|
||||||
private WidgetInspector widgetInspector;
|
private WidgetInspector widgetInspector;
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ public class DevToolsPanel extends PluginPanel
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.widgetInspector = widgetInspector;
|
this.widgetInspector = widgetInspector;
|
||||||
|
|
||||||
settingsTracker = new SettingsTracker(client);
|
varTracker = new VarTracker(client);
|
||||||
add(createOptionsPanel());
|
add(createOptionsPanel());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,13 +139,13 @@ public class DevToolsPanel extends PluginPanel
|
|||||||
final JPanel boundsDebugPanel = createBoundsDebugMultiButton();
|
final JPanel boundsDebugPanel = createBoundsDebugMultiButton();
|
||||||
container.add(boundsDebugPanel);
|
container.add(boundsDebugPanel);
|
||||||
|
|
||||||
final JButton settingsSnapshotBtn = new JButton("Get Settings");
|
final JButton varSnapshotBtn = new JButton("Snapshot Vars");
|
||||||
settingsSnapshotBtn.addActionListener(settingsTracker::snapshot);
|
varSnapshotBtn.addActionListener(varTracker::snapshot);
|
||||||
container.add(settingsSnapshotBtn);
|
container.add(varSnapshotBtn);
|
||||||
|
|
||||||
final JButton settingsClearBtn = new JButton("Clear Settings");
|
final JButton varClearBtn = new JButton("Clear Vars");
|
||||||
settingsClearBtn.addActionListener(settingsTracker::clear);
|
varClearBtn.addActionListener(varTracker::clear);
|
||||||
container.add(settingsClearBtn);
|
container.add(varClearBtn);
|
||||||
|
|
||||||
final JButton renderLocationBtn = new JButton("Location");
|
final JButton renderLocationBtn = new JButton("Location");
|
||||||
renderLocationBtn.addActionListener(e ->
|
renderLocationBtn.addActionListener(e ->
|
||||||
|
|||||||
@@ -30,49 +30,49 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SettingsTracker
|
public class VarTracker
|
||||||
{
|
{
|
||||||
private final Client client;
|
private final Client client;
|
||||||
|
|
||||||
private int[] widgetSettings;
|
private int[] varPs;
|
||||||
|
|
||||||
public SettingsTracker(Client client)
|
public VarTracker(Client client)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void snapshot(ActionEvent e)
|
public void snapshot(ActionEvent e)
|
||||||
{
|
{
|
||||||
if (widgetSettings == null)
|
if (varPs == null)
|
||||||
{
|
{
|
||||||
widgetSettings = copy(client.getVarps());
|
varPs = copy(client.getVarps());
|
||||||
|
|
||||||
log.info("Snapshotted client and widget settings");
|
log.info("Snapshotted VarPs");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] newWidgetSettings = client.getVarps();
|
int[] newVarPs = client.getVarps();
|
||||||
|
|
||||||
for (int i = 0; i < Math.min(widgetSettings.length, newWidgetSettings.length); ++i)
|
for (int i = 0; i < Math.min(varPs.length, newVarPs.length); ++i)
|
||||||
{
|
{
|
||||||
int before = widgetSettings[i];
|
int before = varPs[i];
|
||||||
int after = newWidgetSettings[i];
|
int after = newVarPs[i];
|
||||||
|
|
||||||
if (before == after)
|
if (before == after)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Widget setting index {} has changed from {} to {}: {} -> {}",
|
log.info("VarP index {} has changed from {} to {}: {} -> {}",
|
||||||
i, before, after, prettyPrintInt(before), prettyPrintInt(after));
|
i, before, after, prettyPrintInt(before), prettyPrintInt(after));
|
||||||
}
|
}
|
||||||
|
|
||||||
widgetSettings = copy(newWidgetSettings);
|
varPs = copy(newVarPs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear(ActionEvent e)
|
public void clear(ActionEvent e)
|
||||||
{
|
{
|
||||||
widgetSettings = null;
|
varPs = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int[] copy(int[] array)
|
private static int[] copy(int[] array)
|
||||||
Reference in New Issue
Block a user