private void resetPoints() { this.m_inventory.reset(); this.m_modifications.clear(); for (final AptitudeBonusCategoryView c : this.m_categories) { c.fireAllChanged(); } }
public boolean hasAvailablePoints() { for (final AptitudeBonusCategoryView categoryView : this.m_categories) { if (categoryView.availablePointsForCategory() > 0) { return true; } } return false; }
public void incrementBonus(final AptitudeBonusView bonus) { if (!bonus.canBeIncreased()) { return; } this.m_inventory.addLevel(bonus.getId(), (short) 1); this.m_inventory.removePointsFor(bonus.getId(), (short) 1); this.m_modifications.adjustOrPutValue(bonus.getId(), (short) 1, (short) 1); bonus.fireLevelChanged(); final AptitudeBonusCategoryView category = this.m_categoriesById.get( AptitudeCategoryModelManager.INSTANCE.getBonusCategoryId(bonus.getId())); category.fireAvailablePointsChanged(); }
public void decrementBonus(final AptitudeBonusView bonus) { if (!bonus.canBeDecreased()) { return; } final int categoryId = AptitudeCategoryModelManager.INSTANCE.getBonusCategoryId(bonus.getId()); this.m_inventory.addLevel(bonus.getId(), (short) (-1)); this.m_inventory.incPointFor(categoryId); final short previousValue = this.m_modifications.get(bonus.getId()); if (previousValue == 1) { this.m_modifications.remove(bonus.getId()); } else { this.m_modifications.put(bonus.getId(), (short) (previousValue - 1)); } bonus.fireLevelChanged(); final AptitudeBonusCategoryView category = this.m_categoriesById.get(categoryId); category.fireAvailablePointsChanged(); }