/** * Sets the equipment bonuses * * @param player The player instance * @return The equipment container */ public Equipment setBonus(Player player) { player.resetBonuses(); for (Item item : player.getEquipment().items()) { for (int i = 0; i < player.getBonuses().length; i++) { if (item != null && item.getIndex() < 8000) { player.setBonuses( i, player.getBonuses()[i] + ItemDefinition.get(item.getIndex()).bonus(i)); } } } sendBonusToInterface(player); return this; }
/** * Sends to bonus to the equipment interface * * @param player The player instance * @return The equipment container */ public Equipment sendBonusToInterface(Player player) { int offset = 0; String toSend = null; String operator = null; for (int i = 0; i < player.getBonuses().length; i++) { if (i == 10) { offset = 1; } operator = player.getBonuses()[i] > 0 ? " +" : " -"; toSend = BONUS_NAME[i] + operator + " " + player.getBonuses()[i]; player.getPacketDispatcher().sendString((1675 + i + offset), toSend); } return this; }