Rename SettingsTracker
This commit is contained in:
@@ -43,7 +43,7 @@ public class DevToolsPanel extends PluginPanel
|
||||
private final Client client;
|
||||
private final DevToolsPlugin plugin;
|
||||
|
||||
private final SettingsTracker settingsTracker;
|
||||
private final VarTracker varTracker;
|
||||
|
||||
private WidgetInspector widgetInspector;
|
||||
|
||||
@@ -55,7 +55,7 @@ public class DevToolsPanel extends PluginPanel
|
||||
this.plugin = plugin;
|
||||
this.widgetInspector = widgetInspector;
|
||||
|
||||
settingsTracker = new SettingsTracker(client);
|
||||
varTracker = new VarTracker(client);
|
||||
add(createOptionsPanel());
|
||||
}
|
||||
|
||||
@@ -139,13 +139,13 @@ public class DevToolsPanel extends PluginPanel
|
||||
final JPanel boundsDebugPanel = createBoundsDebugMultiButton();
|
||||
container.add(boundsDebugPanel);
|
||||
|
||||
final JButton settingsSnapshotBtn = new JButton("Get Settings");
|
||||
settingsSnapshotBtn.addActionListener(settingsTracker::snapshot);
|
||||
container.add(settingsSnapshotBtn);
|
||||
final JButton varSnapshotBtn = new JButton("Snapshot Vars");
|
||||
varSnapshotBtn.addActionListener(varTracker::snapshot);
|
||||
container.add(varSnapshotBtn);
|
||||
|
||||
final JButton settingsClearBtn = new JButton("Clear Settings");
|
||||
settingsClearBtn.addActionListener(settingsTracker::clear);
|
||||
container.add(settingsClearBtn);
|
||||
final JButton varClearBtn = new JButton("Clear Vars");
|
||||
varClearBtn.addActionListener(varTracker::clear);
|
||||
container.add(varClearBtn);
|
||||
|
||||
final JButton renderLocationBtn = new JButton("Location");
|
||||
renderLocationBtn.addActionListener(e ->
|
||||
|
||||
@@ -30,49 +30,49 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
|
||||
@Slf4j
|
||||
public class SettingsTracker
|
||||
public class VarTracker
|
||||
{
|
||||
private final Client client;
|
||||
|
||||
private int[] widgetSettings;
|
||||
private int[] varPs;
|
||||
|
||||
public SettingsTracker(Client client)
|
||||
public VarTracker(Client client)
|
||||
{
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 after = newWidgetSettings[i];
|
||||
int before = varPs[i];
|
||||
int after = newVarPs[i];
|
||||
|
||||
if (before == after)
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
widgetSettings = copy(newWidgetSettings);
|
||||
varPs = copy(newVarPs);
|
||||
}
|
||||
|
||||
public void clear(ActionEvent e)
|
||||
{
|
||||
widgetSettings = null;
|
||||
varPs = null;
|
||||
}
|
||||
|
||||
private static int[] copy(int[] array)
|
||||
Reference in New Issue
Block a user