Skip to content

Commit

Permalink
tested, bugfixed
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbursik committed Aug 24, 2023
1 parent d861ce0 commit cfb6c82
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
Binary file modified jars/DynamicTariffs.jar
Binary file not shown.
27 changes: 14 additions & 13 deletions src/dynamictariffs/util/TariffUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,27 +87,28 @@ public static void modTariff(MarketAPI market) {
String[] RepArr = { "SUSPICIOUS", "NEUTRAL", "FAVORABLE", "WELCOMING", "FRIENDLY", "COOPERATIVE" };
List<String> 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);

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);
}
}

Expand Down

0 comments on commit cfb6c82

Please sign in to comment.