예제 #1
0
 private static float GetTotalDebtForFeeValidationTypeExistingLocos(DisplayableDebt debt)
 {
     if (debt is ExistingLocoDebt)
     {
         DebugLog($"Locomotive {debt.ID} still exists; ignoring its fees.");
         return(0);
     }
     return(debt.GetTotalPrice());
 }
예제 #2
0
        public static float GetTotalDebtForJobPurposes(DisplayableDebt debt)
        {
            if (!enabled)
            {
                return(debt.GetTotalPrice());
            }

            switch (settings.selectedValidationType)
            {
            case FeeValidationType.LastLoco:
                return(GetTotalDebtForFeeValidationTypeLastLoco(debt));

            case FeeValidationType.ExistingLocos:
                return(GetTotalDebtForFeeValidationTypeExistingLocos(debt));
            }

            DebugLog($"This should never happen. In case it does, the selected fee type is {settings.selectedValidationType}.");
            return(debt.GetTotalPrice());
        }
예제 #3
0
 private static float GetTotalDebtForFeeValidationTypeLastLoco(DisplayableDebt debt)
 {
     if (debt is ExistingLocoDebt)
     {
         var locoInTrainset = PlayerManager.LastLoco?.trainset?.cars?.Find(car => car.ID == debt.ID);
         if (locoInTrainset != null)
         {
             float fees = debt.GetTotalPriceOfResources(nonConsumableTypes);
             DebugLog($"Locomotive {locoInTrainset.ID} is in player's last trainset. Fees without consumables = {fees}.");
             return(fees);
         }
         DebugLog($"Locomotive {debt.ID} not found in last trainset.");
     }
     return(debt.GetTotalPrice());
 }