diff --git a/jars/DynamicTariffs.jar b/jars/DynamicTariffs.jar index b34a3c6..6b33bf6 100644 Binary files a/jars/DynamicTariffs.jar and b/jars/DynamicTariffs.jar differ diff --git a/src/dynamictariffs/util/TariffUtil.java b/src/dynamictariffs/util/TariffUtil.java index 82925bb..a2cedc3 100644 --- a/src/dynamictariffs/util/TariffUtil.java +++ b/src/dynamictariffs/util/TariffUtil.java @@ -87,7 +87,7 @@ public static void modTariff(MarketAPI market) { String[] RepArr = { "SUSPICIOUS", "NEUTRAL", "FAVORABLE", "WELCOMING", "FRIENDLY", "COOPERATIVE" }; List RepLevels = Arrays.asList(RepArr); - Float[] RepValues = new Float[] { -0.25f, -0.10f, 0.10f, 0.25f, 0.50f, 0.75f, 1.0f }; + Float[] RepValues = new Float[] { -0.24f, -0.11f, 0.10f, 0.25f, 0.50f, 0.75f, 1.0f }; String repLevel = market.getFaction().getRelationshipLevel(Factions.PLAYER).toString(); Float repValue = market.getFaction().getRelationship(Factions.PLAYER); @@ -95,19 +95,20 @@ public static void modTariff(MarketAPI market) { Float tariff = 0f; int i = RepLevels.indexOf(repLevel); - - if (SettingsUtil.useGranular) { - float stepAmt = Math.abs(RepValues[i + 1] - RepValues[i]) / Math.abs(percents[i] - percents[i + 1]); - tariff = percents[i] - ((1 / stepAmt) * (repValue - RepValues[i])); - if (isCommissioned(market) && SettingsUtil.commission) { - tariff -= SettingsUtil.commDiscount; - tariff = tariff < 0f ? -0.3f : tariff; + if (i > -1) { + if (SettingsUtil.useGranular) { + float stepAmt = Math.abs(RepValues[i + 1] - RepValues[i]) / Math.abs(percents[i] - percents[i + 1]); + tariff = percents[i] - ((1 / stepAmt) * (repValue - RepValues[i])); + if (isCommissioned(market) && SettingsUtil.commission) { + tariff -= SettingsUtil.commDiscount; + tariff = tariff < 0f ? -0.3f : tariff; + } + tariff = -(0.3f - tariff); + market.getTariff().modifyFlat("dynamictariffs", tariff); + } else { + tariff = -(0.3f - percents[i]); + market.getTariff().modifyFlat("dynamictariffs", tariff); } - tariff = -(0.3f - tariff); - market.getTariff().modifyFlat("dynamictariffs", tariff); - } else { - tariff = -(0.3f - percents[i]); - market.getTariff().modifyFlat("dynamictariffs", tariff); } }