tag tabs: respect bank rearrange mode for reordering

This commit is contained in:
Ron Young
2020-01-27 13:24:11 -06:00
committed by Adam
parent 07501c1209
commit a5e5e8aa6f
3 changed files with 34 additions and 7 deletions

View File

@@ -470,6 +470,7 @@ public enum Varbits
SUPERIOR_ENABLED(5362),
FOSSIL_ISLAND_WYVERN_DISABLE(6251),
BANK_REARRANGE_MODE(3959),
CURRENT_BANK_TAB(4150),
WORLDHOPPER_FAVROITE_1(4597),

View File

@@ -690,12 +690,7 @@ public class TabInterface
else if (parent.getId() == draggedOn.getId() && parent.getId() == draggedWidget.getId())
{
// Reorder tag tabs
if (!Strings.isNullOrEmpty(draggedOn.getName()))
{
tabManager.move(draggedWidget.getName(), draggedOn.getName());
tabManager.save();
updateTabs();
}
moveTagTab(draggedWidget, draggedOn);
}
}
else if (draggedWidget.getItemId() > 0)
@@ -725,6 +720,26 @@ public class TabInterface
}
}
private void moveTagTab(final Widget source, final Widget dest)
{
if (Strings.isNullOrEmpty(dest.getName()))
{
return;
}
if (client.getVar(Varbits.BANK_REARRANGE_MODE) == 0)
{
tabManager.swap(source.getName(), dest.getName());
}
else
{
tabManager.insert(source.getName(), dest.getName());
}
tabManager.save();
updateTabs();
}
private boolean isHidden()
{
Widget widget = client.getWidget(WidgetInfo.BANK_CONTAINER);

View File

@@ -95,7 +95,7 @@ class TabManager
return tagTab;
}
void move(String tagToMove, String tagDestination)
void swap(String tagToMove, String tagDestination)
{
tagToMove = Text.standardize(tagToMove);
tagDestination = Text.standardize(tagDestination);
@@ -106,6 +106,17 @@ class TabManager
}
}
void insert(String tagToMove, String tagDestination)
{
tagToMove = Text.standardize(tagToMove);
tagDestination = Text.standardize(tagDestination);
if (contains(tagToMove) && contains(tagDestination))
{
tabs.add(indexOf(tagDestination), tabs.remove(indexOf(tagToMove)));
}
}
void remove(String tag)
{
TagTab tagTab = find(tag);