@Override public boolean collect( Bag container ) { if (super.collect( container )) { if (owner != null) { for (Item item : items) { if (item instanceof Wand) { ((Wand) item).charge(owner, HOLSTER_SCALE_FACTOR); } else if (item instanceof MissileWeapon){ ((MissileWeapon) item).holster = true; } } } return true; } else { return false; } }
public boolean contains( Item item ) { for (Item i : items) { if (i == item) { return true; } else if (i instanceof Bag && ((Bag)i).contains( item )) { return true; } } return false; }
@Override public Item next() { if (nested != null && nested.hasNext()) { return nested.next(); } else { nested = null; Item item = items.get( index++ ); if (item instanceof Bag) { nested = ((Bag)item).iterator(); } return item; } }
backpack.clear(); backpack.restoreFromBundle( bundle );
@Override public boolean collect( Bag container ) { for (Item item : container.items.toArray( new Item[0] )) { if (grab( item )) { int slot = Dungeon.quickslot.getSlot(item); item.detachAll(container); if (!item.collect(this)) { item.collect(container); } if (slot != -1) { Dungeon.quickslot.setSlot(slot, item); } } } if (super.collect( container )) { owner = container.owner; Badges.validateAllBagsBought( this ); return true; } else { return false; } }
public void storeInBundle( Bundle bundle ) { backpack.storeInBundle( bundle ); bundle.put( WEAPON, weapon ); bundle.put( ARMOR, armor ); bundle.put( MISC1, misc1); bundle.put( MISC2, misc2); }
@Override public void onDetach( ) { super.onDetach(); for (Item item : items) { if (item instanceof Wand) { ((Wand)item).stopCharging(); } else if (item instanceof MissileWeapon){ ((MissileWeapon) item).holster = false; } } }
protected void placeTitle( Bag bag, int width ){ RenderedText txtTitle = PixelScene.renderText( title != null ? Messages.titleCase(title) : Messages.titleCase( bag.name() ), 9 ); txtTitle.hardlight( TITLE_COLOR ); txtTitle.x = 1; txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.baseLine()) / 2f - 1; PixelScene.align(txtTitle); add( txtTitle ); ItemSprite gold = new ItemSprite(ItemSpriteSheet.GOLD, null); gold.x = width - gold.width() - 1; gold.y = (TITLE_HEIGHT - gold.height())/2f - 1; PixelScene.align(gold); add(gold); BitmapText amt = new BitmapText( Integer.toString(Dungeon.gold), PixelScene.pixelFont ); amt.hardlight(TITLE_COLOR); amt.measure(); amt.x = width - gold.width() - amt.width() - 2; amt.y = (TITLE_HEIGHT - amt.baseLine())/2f - 1; PixelScene.align(amt); add(amt); }
((Bag)item).resurrect();
backpack.clear(); backpack.restoreFromBundle( bundle );
@Override public boolean collect( Bag container ) { for (Item item : container.items.toArray( new Item[0] )) { if (grab( item )) { int slot = Dungeon.quickslot.getSlot(item); item.detachAll(container); if (!item.collect(this)) { item.collect(container); } if (slot != -1) { Dungeon.quickslot.setSlot(slot, item); } } } if (super.collect( container )) { owner = container.owner; Badges.validateAllBagsBought( this ); return true; } else { return false; } }
public void storeInBundle( Bundle bundle ) { backpack.storeInBundle( bundle ); bundle.put( WEAPON, weapon ); bundle.put( ARMOR, armor ); bundle.put( MISC1, misc1); bundle.put( MISC2, misc2); }
@Override public void onDetach( ) { super.onDetach(); for (Item item : items) { if (item instanceof Wand) { ((Wand)item).stopCharging(); } else if (item instanceof MissileWeapon){ ((MissileWeapon) item).holster = false; } } }
protected void placeTitle( Bag bag, int width ){ RenderedText txtTitle = PixelScene.renderText( title != null ? Messages.titleCase(title) : Messages.titleCase( bag.name() ), 9 ); txtTitle.hardlight( TITLE_COLOR ); txtTitle.x = 1; txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.baseLine()) / 2f - 1; PixelScene.align(txtTitle); add( txtTitle ); ItemSprite gold = new ItemSprite(ItemSpriteSheet.GOLD, null); gold.x = width - gold.width() - 1; gold.y = (TITLE_HEIGHT - gold.height())/2f - 1; PixelScene.align(gold); add(gold); BitmapText amt = new BitmapText( Integer.toString(Dungeon.gold), PixelScene.pixelFont ); amt.hardlight(TITLE_COLOR); amt.measure(); amt.x = width - gold.width() - amt.width() - 2; amt.y = (TITLE_HEIGHT - amt.baseLine())/2f - 1; PixelScene.align(amt); add(amt); }
((Bag)item).resurrect();
public boolean contains( Item item ) { for (Item i : items) { if (i == item) { return true; } else if (i instanceof Bag && ((Bag)i).contains( item )) { return true; } } return false; }
@Override public Item next() { if (nested != null && nested.hasNext()) { return nested.next(); } else { nested = null; Item item = items.get( index++ ); if (item instanceof Bag) { nested = ((Bag)item).iterator(); } return item; } }
if (item instanceof Bag && ((Bag)item).grab( this )) { return collect( (Bag)item );
@Override public boolean collect( Bag container ) { if (super.collect( container )) { if (owner != null) { for (Item item : items) { if (item instanceof Wand) { ((Wand) item).charge(owner, HOLSTER_SCALE_FACTOR); } else if (item instanceof MissileWeapon){ ((MissileWeapon) item).holster = true; } } } return true; } else { return false; } }
public static WndBag lastBag( Listener listener, Mode mode, String title ) { if (mode == lastMode && lastBag != null && Dungeon.hero.belongings.backpack.contains( lastBag )) { return new WndBag( lastBag, listener, mode, title ); } else { return new WndBag( Dungeon.hero.belongings.backpack, listener, mode, title ); } }