Quick trade incorrect unity cost

Fixed World Map & Ships
deagato [discord] · 1 year ago

Quick trade validates the transaction with the current step unity cost but it deductes the next tier unity cost.
Below you can find the commented code that explains why, the problem is pretty obvious (tested by trading cargo ship, 20 unity base cost).

This bug was found by @RealisticOptimist.

QuickTradeProvider.QuickBuy

public ProductQuantity QuickTradeProvider.QuickBuy()
{
    // Unity price is checked here
    if (!this.CanAfford()) 
        return ProductQuantity.None;

    // ...

    // Moving to the next step (which increases unity cost)
    this.setStep(this.CurrentStep + 1);

    // UpointsCost was updated by setStep, so we are actually paying for the next step 
    // 24 instead of 20 
    // 28 instead of 24
    this.m_upointsManager.ConsumeExactly(IdsCore.UpointsCategories.QuickTrade, this.UpointsCost);
}

Closed as ✅ Fixed

6 Showing 1–1 of 1