mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
Fix auto-sell not being removed from adventure collection
This commit is contained in:
@@ -266,7 +266,14 @@ public class AdventureDeckEditor extends FDeckEditor {
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
cardManager.setPool(Current.player().getSellableCards());
|
||||
cardManager.setPool(getCardPool());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemPool<PaperCard> getCardPool() {
|
||||
ItemPool<PaperCard> pool = Current.player().getSellableCards();
|
||||
pool.removeAll(Current.player().autoSellCards);
|
||||
return pool;
|
||||
}
|
||||
|
||||
public void sellAllByFilter() {
|
||||
@@ -319,6 +326,13 @@ public class AdventureDeckEditor extends FDeckEditor {
|
||||
scheduleRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemPool<PaperCard> getCardPool() {
|
||||
ItemPool<PaperCard> pool = super.getCardPool();
|
||||
pool.removeAll(Current.player().autoSellCards);
|
||||
return pool;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void buildMenu(final FDropDownMenu menu, final PaperCard card) {
|
||||
super.buildMenu(menu, card);
|
||||
@@ -444,6 +458,12 @@ public class AdventureDeckEditor extends FDeckEditor {
|
||||
return Current.player().getAutoSellCards();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
super.refresh();
|
||||
//Used when executing an auto-sell.
|
||||
this.updateCaption();
|
||||
}
|
||||
|
||||
protected boolean isShop() {
|
||||
return parentScreen.getEditorConfig() instanceof ShopConfig;
|
||||
@@ -637,10 +657,12 @@ public class AdventureDeckEditor extends FDeckEditor {
|
||||
public void refresh() {
|
||||
FThreads.invokeInBackgroundThread(() -> {
|
||||
for (TabPage<FDeckEditor> page : tabPages) {
|
||||
if (page instanceof CatalogPage)
|
||||
((CatalogPage) page).scheduleRefresh();
|
||||
else if (page instanceof CardManagerPage)
|
||||
((CardManagerPage) page).refresh();
|
||||
if (page instanceof CollectionAutoSellPage p)
|
||||
p.refresh();
|
||||
else if (page instanceof CatalogPage p)
|
||||
p.scheduleRefresh();
|
||||
else if (page instanceof CardManagerPage p)
|
||||
p.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import forge.model.FModel;
|
||||
import forge.screens.FScreen;
|
||||
import forge.toolbox.FOptionPane;
|
||||
import forge.util.Callback;
|
||||
import forge.util.ItemPool;
|
||||
|
||||
/**
|
||||
* DeckEditScene
|
||||
@@ -79,7 +80,9 @@ public class ShopScene extends ForgeScene {
|
||||
}
|
||||
|
||||
private void doAutosell() {
|
||||
AdventurePlayer.current().doBulkSell(AdventurePlayer.current().autoSellCards);
|
||||
ItemPool<PaperCard> autoSellCards = AdventurePlayer.current().autoSellCards;
|
||||
AdventurePlayer.current().doBulkSell(autoSellCards);
|
||||
autoSellCards.clear();
|
||||
if (screen != null)
|
||||
screen.refresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user