Search in sources :

Example 1 with Belongings

use of com.watabou.pixeldungeon.actors.hero.Belongings in project pixel-dungeon by watabou.

the class WndBag method placeItems.

protected void placeItems(Bag container) {
    // Equipped items
    Belongings stuff = Dungeon.hero.belongings;
    placeItem(stuff.weapon != null ? stuff.weapon : new Placeholder(ItemSpriteSheet.WEAPON));
    placeItem(stuff.armor != null ? stuff.armor : new Placeholder(ItemSpriteSheet.ARMOR));
    placeItem(stuff.ring1 != null ? stuff.ring1 : new Placeholder(ItemSpriteSheet.RING));
    placeItem(stuff.ring2 != null ? stuff.ring2 : new Placeholder(ItemSpriteSheet.RING));
    boolean backpack = (container == Dungeon.hero.belongings.backpack);
    if (!backpack) {
        count = nCols;
        col = 0;
        row = 1;
    }
    // Items in the bag
    for (Item item : container.items) {
        placeItem(item);
    }
    // Free space
    while (count - (backpack ? 4 : nCols) < container.size) {
        placeItem(null);
    }
    // Gold in the backpack
    if (container == Dungeon.hero.belongings.backpack) {
        row = nRows - 1;
        col = nCols - 1;
        placeItem(new Gold(Dungeon.gold));
    }
}
Also used : Item(com.watabou.pixeldungeon.items.Item) Gold(com.watabou.pixeldungeon.items.Gold) Belongings(com.watabou.pixeldungeon.actors.hero.Belongings)

Aggregations

Belongings (com.watabou.pixeldungeon.actors.hero.Belongings)1 Gold (com.watabou.pixeldungeon.items.Gold)1 Item (com.watabou.pixeldungeon.items.Item)1