The player's contract reputation also seems to vary randomly -- a savegame I have with 0 reputation reports having 1-3 reputation after loading and/or jumping. It's like the variable isn't initializing correctly when I reload from savegame.
Expected, and has been this way for a long time. It's the "unknown" parts of the reputation sometimes being interpreted as "good". The function gives the current perceived reputation as a single number, not the contents of the good/bad/unknown array, so...
I was also seeing the reputation drop 1-2 points with almost every hyperspace jump.
As for my Cargo Contracts modifications...
The destination systems are chosen from a sampling of systems inside a limited LY radius (100 LY - 10 LY per reputation point, which can be >100 LY at negative rep.) from your current location rather than always any random system in the Galaxy Chart.
Someone with a great reputation should not need to take low-paying, extremely long ranged deliveries...it would be beneath them!
Even at max reputation, the distance is 30 LY and the actual route needed may be more than that due to voids you have to go around. I had a few that were 40-52 LY in Galaxy Chart 1 because of this.
Any system with the same economy as the current one is ruled out as a destination (except at max reputation, when you can get Gold/Plat/Gem contracts) simply because profitability is effectively nil there.
The commodity to be chosen is based on the differences between the start and destination economies rather than purely randomly chosen. This serves in needing FAR fewer looping attempts to create a reasonably profitable contract.
Both player.contractReputation and player.bounty were given an effect on which commodity is chosen. A max reputation trader shouldn't have to suffer very poor-paying contracts such as those with only 0.4 credits difference per economy change. A high bounty trader is probably not "trustworthy", but might be more suited for contraband cargo like narcotics.
The amount of cargo in a contract increases on average with higher reputation. This gives "bulk freighter" types slightly more purpose.
You are far more likely to get monster-sized contracts IF you have a ship with enough free cargo space (at the time it arrived in the system) to carry it. No need to reduce contract sizes if the player is in a mostly-empty Anaconda!
The deposit is the buying price for the contract and represents both the cost of the cargo at the starting point and a tiny "negotiations" cost associated with gaining the contract. I assume the cargo contracts represent requests for these bulk goods by some organization or group in the destination system as consumers, rather than resellers...therefore their "reward" is gaining bulk amounts of these goods to be used/consumed...which they seek to do as quickly, cheaply, and reliably as possible.
The lowest possible buying price for a cargo contract's commodity is the lowest price at which that item is ever sold at that system's main station, however if you have a rather negative reputation you will ALWAYS pay the maximum price for that item at that system's main station. If your reputation is barely above the starting point of 0, the cargo contract's commodity will still cost you at least the current price for that item...and is still likely to cost the maximum price for that item.
If you have a good reputation, the cargo contract's commodity max possible cost may be reduced to the current cost. At the very best reputation, you will always pay minimum cost for the commodity.
On top of that, the discount amount can force the commodity price to the minimum allowed value based on current reputation if the amount is large, the route is long, and/or you have a higher reputation. A high bounty reduces the discount amount.
The contract's selling price at the destination is tied to the destination's market price for that commodity. This means profit is absolutely marginal if the buying and selling systems only differ by 1 economic point, such as rich industrial to average industrial. The variable amount that does not depend on the economy is also changed based on discount and reputation at the time the cargo contract was created. A badly negative reputation always sells at minimum market price for that commodity. A high reputation always sells at maximum market price for that commodity.
To give this some numbers, computers are at their cheapest at a Rich Industrial system -- 61.6 credits minimum, 62.8 credits max...with only 62 and 62.4 credits being possible intermediate values. Assume current computer price is 62 credits. Computers are at their most expensive at a Poor Agricultural system -- 100.8 credits minimum, 102 credits maximum...with 101.2 and 101.6 credits being possible intermediate values.
A cargo contract for computers between these 2 locations would have to be from the Rich Industrial system to the Poor Agricultural system, because the other way is always unprofitable. Assuming the amount of computers is 100 TC...
If the trader has a very negative reputation (like -7 max), they would have to pay 62.8 credits for each TC of computers and would get 100.8 credits for each TC computer at delivery system. The buying price for the cargo contract would be 6280 credits (62.8 x 100) and the selling price at destination would be 10080 credits (100.8 x 100). Since the price is forced to max by the very negative reputation, the discount is always 0. The profit would be 3800 credits.
If the trader has the best possible reputation (+7 max), they would have to pay 61.6 credits for each TC of computers and would get 102 credits for each TC computer at delivery system. The buying price for the cargo contract would be 6160 credits (61.6 x 100) and the selling price at destination would be 10200 credits (102 x 100). Since the prices are already at minimum, the discount (which is likely 100%) does nothing. The profit would be 4040 credits.
Only 240 credits profit are "lost" (dropping from the best reputation to the worst) because computers have very little price variation per system.
This example represents almost the absolute best TC cargo contract - computers between best system combo.
If the starting system is an Average Industrial and the destination system is a Rich Agricultural, then the profit even with the best possible reputation is only 2240 credits and the deposit for the cargo would have increased to 6720 credits.