v0.8.2: unique stackable items can now be sold to shops
This commit is contained in:
parent
f1c56ba6c7
commit
1325f3317e
|
@ -28,6 +28,7 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.CellEmitter;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.ElmoParticle;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Heap;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.items.armor.Armor;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
import com.shatteredpixel.shatteredpixeldungeon.journal.Notes;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||||
|
@ -102,6 +103,14 @@ public class Shopkeeper extends NPC {
|
||||||
public static WndBag sell() {
|
public static WndBag sell() {
|
||||||
return GameScene.selectItem( itemSelector, WndBag.Mode.FOR_SALE, Messages.get(Shopkeeper.class, "sell"));
|
return GameScene.selectItem( itemSelector, WndBag.Mode.FOR_SALE, Messages.get(Shopkeeper.class, "sell"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean willBuyItem( Item item ){
|
||||||
|
if (item.value() < 0) return false;
|
||||||
|
if (item.unique && !item.stackable) return false;
|
||||||
|
if (item instanceof Armor && ((Armor) item).checkSeal() != null) return false;
|
||||||
|
if (item.isEquipped(Dungeon.hero) && item.cursed) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private static WndBag.Listener itemSelector = new WndBag.Listener() {
|
private static WndBag.Listener itemSelector = new WndBag.Listener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,6 +26,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
import com.shatteredpixel.shatteredpixeldungeon.SPDAction;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
|
import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Gold;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||||
|
@ -412,7 +413,7 @@ public class WndBag extends WndTabbed {
|
||||||
enable( false );
|
enable( false );
|
||||||
} else {
|
} else {
|
||||||
enable(
|
enable(
|
||||||
mode == Mode.FOR_SALE && !item.unique && (item.value() > 0) && (!item.isEquipped( Dungeon.hero ) || !item.cursed) ||
|
mode == Mode.FOR_SALE && Shopkeeper.willBuyItem(item) ||
|
||||||
mode == Mode.UPGRADEABLE && item.isUpgradable() ||
|
mode == Mode.UPGRADEABLE && item.isUpgradable() ||
|
||||||
mode == Mode.UNIDENTIFED && !item.isIdentified() ||
|
mode == Mode.UNIDENTIFED && !item.isIdentified() ||
|
||||||
mode == Mode.UNCURSABLE && ScrollOfRemoveCurse.uncursable(item) ||
|
mode == Mode.UNCURSABLE && ScrollOfRemoveCurse.uncursable(item) ||
|
||||||
|
|
Loading…
Reference in New Issue
Block a user