Example #1
0
    public LeagueOptions(int standardGames, int gamesToDraft, int counterPicks, int counterPicksToDraft, int freeDroppableGames, int willNotReleaseDroppableGames, int willReleaseDroppableGames,
                         bool dropOnlyDraftGames, bool counterPicksBlockDrops, int minimumBidAmount, IEnumerable <LeagueTagStatus> leagueTags, IEnumerable <SpecialGameSlot> specialGameSlots,
                         DraftSystem draftSystem, PickupSystem pickupSystem, ScoringSystem scoringSystem, TradingSystem tradingSystem, TiebreakSystem tiebreakSystem, AnnualDate counterPickDeadline)
    {
        StandardGames                = standardGames;
        GamesToDraft                 = gamesToDraft;
        CounterPicks                 = counterPicks;
        CounterPicksToDraft          = counterPicksToDraft;
        FreeDroppableGames           = freeDroppableGames;
        WillNotReleaseDroppableGames = willNotReleaseDroppableGames;
        WillReleaseDroppableGames    = willReleaseDroppableGames;
        DropOnlyDraftGames           = dropOnlyDraftGames;
        CounterPicksBlockDrops       = counterPicksBlockDrops;
        MinimumBidAmount             = minimumBidAmount;
        LeagueTags          = leagueTags.ToList();
        SpecialGameSlots    = specialGameSlots.OrderBy(x => x.SpecialSlotPosition).ToList();
        DraftSystem         = draftSystem;
        PickupSystem        = pickupSystem;
        ScoringSystem       = scoringSystem;
        TradingSystem       = tradingSystem;
        TiebreakSystem      = tiebreakSystem;
        CounterPickDeadline = counterPickDeadline;

        _specialSlotDictionary = SpecialGameSlots.ToDictionary(specialGameSlot => StandardGames - SpecialGameSlots.Count + specialGameSlot.SpecialSlotPosition);
    }
Example #2
0
 public LeagueYearParameters(Guid leagueID, int year, int standardGames, int gamesToDraft, int counterPicks, int counterPicksToDraft,
                             int freeDroppableGames, int willNotReleaseDroppableGames, int willReleaseDroppableGames, bool dropOnlyDraftGames, bool counterPicksBlockDrops, int minimumBidAmount,
                             IEnumerable <LeagueTagStatus> leagueTags, IEnumerable <SpecialGameSlot> specialGameSlots,
                             DraftSystem draftSystem, PickupSystem pickupSystem, ScoringSystem scoringSystem, TradingSystem tradingSystem, TiebreakSystem tiebreakSystem, AnnualDate counterPickDeadline)
 {
     LeagueID                     = leagueID;
     Year                         = year;
     StandardGames                = standardGames;
     GamesToDraft                 = gamesToDraft;
     CounterPicks                 = counterPicks;
     CounterPicksToDraft          = counterPicksToDraft;
     FreeDroppableGames           = freeDroppableGames;
     WillNotReleaseDroppableGames = willNotReleaseDroppableGames;
     WillReleaseDroppableGames    = willReleaseDroppableGames;
     DropOnlyDraftGames           = dropOnlyDraftGames;
     CounterPicksBlockDrops       = counterPicksBlockDrops;
     MinimumBidAmount             = minimumBidAmount;
     LeagueTags                   = leagueTags.ToList();
     SpecialGameSlots             = specialGameSlots.ToList();
     DraftSystem                  = draftSystem;
     PickupSystem                 = pickupSystem;
     ScoringSystem                = scoringSystem;
     TradingSystem                = tradingSystem;
     TiebreakSystem               = tiebreakSystem;
     CounterPickDeadline          = counterPickDeadline;
 }
Example #3
0
    public LeagueYear ToDomain(League league, SupportedYear year, IEnumerable <EligibilityOverride> eligibilityOverrides,
                               IEnumerable <TagOverride> tagOverrides, IEnumerable <LeagueTagStatus> leagueTags, IEnumerable <SpecialGameSlot> specialGameSlots,
                               FantasyCriticUser?winningUser, IEnumerable <Publisher> publishersInLeague)
    {
        DraftSystem    draftSystem    = Lib.Enums.DraftSystem.FromValue(DraftSystem);
        PickupSystem   pickupSystem   = Lib.Enums.PickupSystem.FromValue(PickupSystem);
        TradingSystem  tradingSystem  = Lib.Enums.TradingSystem.FromValue(TradingSystem);
        TiebreakSystem tiebreakSystem = Lib.Enums.TiebreakSystem.FromValue(TiebreakSystem);
        ScoringSystem  scoringSystem  = Lib.Domain.ScoringSystems.ScoringSystem.GetScoringSystem(ScoringSystem);

        AnnualDate counterPickDeadline = new AnnualDate(CounterPickDeadlineMonth, CounterPickDeadlineDay);

        LeagueOptions options = new LeagueOptions(StandardGames, GamesToDraft, CounterPicks, CounterPicksToDraft, FreeDroppableGames, WillNotReleaseDroppableGames, WillReleaseDroppableGames,
                                                  DropOnlyDraftGames, CounterPicksBlockDrops, MinimumBidAmount, leagueTags, specialGameSlots, draftSystem, pickupSystem, scoringSystem, tradingSystem, tiebreakSystem, counterPickDeadline);

        return(new LeagueYear(league, year, options, Lib.Enums.PlayStatus.FromValue(PlayStatus), eligibilityOverrides, tagOverrides, DraftStartedTimestamp, winningUser, publishersInLeague));
    }
Example #4
0
    public LeagueYearParameters ToDomain(IReadOnlyDictionary <string, MasterGameTag> tagDictionary)
    {
        DraftSystem    draftSystem    = Lib.Enums.DraftSystem.FromValue(DraftSystem);
        PickupSystem   pickupSystem   = Lib.Enums.PickupSystem.FromValue(PickupSystem);
        TradingSystem  tradingSystem  = Lib.Enums.TradingSystem.FromValue(TradingSystem);
        TiebreakSystem tiebreakSystem = Lib.Enums.TiebreakSystem.FromValue(TiebreakSystem);
        ScoringSystem  scoringSystem  = Lib.Domain.ScoringSystems.ScoringSystem.GetScoringSystem(ScoringSystem);

        int freeDroppableGames = FreeDroppableGames;

        if (UnlimitedFreeDroppableGames)
        {
            freeDroppableGames = -1;
        }
        int willNotReleaseDroppableGames = WillNotReleaseDroppableGames;

        if (UnlimitedWillNotReleaseDroppableGames)
        {
            willNotReleaseDroppableGames = -1;
        }
        int willReleaseDroppableGames = WillReleaseDroppableGames;

        if (UnlimitedWillReleaseDroppableGames)
        {
            willReleaseDroppableGames = -1;
        }

        var counterPickDeadline = new AnnualDate(CounterPickDeadline.Month, CounterPickDeadline.Day);

        var leagueTags       = Tags.ToDomain(tagDictionary);
        var specialGameSlots = SpecialGameSlots.Select(x => x.ToDomain(tagDictionary));

        LeagueYearParameters parameters = new LeagueYearParameters(LeagueID, Year, StandardGames, GamesToDraft, CounterPicks, CounterPicksToDraft,
                                                                   freeDroppableGames, willNotReleaseDroppableGames, willReleaseDroppableGames, DropOnlyDraftGames, CounterPicksBlockDrops, MinimumBidAmount,
                                                                   leagueTags, specialGameSlots, draftSystem, pickupSystem, scoringSystem, tradingSystem, tiebreakSystem, counterPickDeadline);

        return(parameters);
    }
Example #5
0
    public string?GetDifferenceString(LeagueOptions existingOptions)
    {
        List <string> differences = new List <string>();

        if (StandardGames != existingOptions.StandardGames)
        {
            differences.Add($"Number of standard games per publisher changed from {existingOptions.StandardGames} to {StandardGames}.");
        }

        if (GamesToDraft != existingOptions.GamesToDraft)
        {
            differences.Add($"Number of games to draft per publisher changed from {existingOptions.GamesToDraft} to {GamesToDraft}.");
        }

        if (CounterPicks != existingOptions.CounterPicks)
        {
            differences.Add($"Number of counter picks per publisher changed from {existingOptions.CounterPicks} to {CounterPicks}.");
        }

        if (CounterPicksToDraft != existingOptions.CounterPicksToDraft)
        {
            differences.Add($"Number of counter picks to draft per publisher changed from {existingOptions.CounterPicksToDraft} to {CounterPicksToDraft}.");
        }

        if (FreeDroppableGames != existingOptions.FreeDroppableGames)
        {
            differences.Add($"Number of 'any unreleased' droppable games per publisher changed from {existingOptions.FreeDroppableGames} to {FreeDroppableGames}.");
        }

        if (WillNotReleaseDroppableGames != existingOptions.WillNotReleaseDroppableGames)
        {
            differences.Add($"Number of 'will not release' droppable games per publisher changed from {existingOptions.WillNotReleaseDroppableGames} to {WillNotReleaseDroppableGames}.");
        }

        if (WillReleaseDroppableGames != existingOptions.WillReleaseDroppableGames)
        {
            differences.Add($"Number of 'will release' droppable games per publisher changed from {existingOptions.WillReleaseDroppableGames} to {WillReleaseDroppableGames}.");
        }

        if (DropOnlyDraftGames != existingOptions.DropOnlyDraftGames)
        {
            differences.Add($"'Drop Only Drafted Games' from '{existingOptions.DropOnlyDraftGames.ToYesNoString()}' to '{DropOnlyDraftGames.ToYesNoString()}'.");
        }

        if (CounterPicksBlockDrops != existingOptions.CounterPicksBlockDrops)
        {
            differences.Add($"'Counter Picks Block Drops' from '{existingOptions.CounterPicksBlockDrops.ToYesNoString()}' to '{CounterPicksBlockDrops.ToYesNoString()}'.");
        }

        if (MinimumBidAmount != existingOptions.MinimumBidAmount)
        {
            differences.Add($"'Minimum Bid Amount' changed from {existingOptions.MinimumBidAmount} to {MinimumBidAmount}.");
        }

        if (!DraftSystem.Equals(existingOptions.DraftSystem))
        {
            differences.Add($"Draft System changed from {existingOptions.DraftSystem} to {DraftSystem}.");
        }

        if (!PickupSystem.Equals(existingOptions.PickupSystem))
        {
            differences.Add($"Pickup System changed from {existingOptions.PickupSystem.ReadableName} to {PickupSystem.ReadableName}.");
        }

        if (!TiebreakSystem.Equals(existingOptions.TiebreakSystem))
        {
            differences.Add($"Tiebreak System changed from {existingOptions.TiebreakSystem.Value.CamelCaseToSpaces()} to {TiebreakSystem.Value.CamelCaseToSpaces()}.");
        }

        if (!ScoringSystem.Equals(existingOptions.ScoringSystem))
        {
            differences.Add($"Scoring System changed from {existingOptions.ScoringSystem} to {ScoringSystem}.");
        }

        if (!TradingSystem.Equals(existingOptions.TradingSystem))
        {
            differences.Add($"Trading System changed from {existingOptions.TradingSystem.ReadableName} to {TradingSystem.ReadableName}.");
        }

        if (!CounterPickDeadline.Equals(existingOptions.CounterPickDeadline))
        {
            differences.Add($"Counter pick deadline changed from {existingOptions.CounterPickDeadline} to {CounterPickDeadline}.");
        }

        var orderedExistingTags = existingOptions.LeagueTags.OrderBy(t => t.Tag.Name).ToList();
        var orderedNewTags      = LeagueTags.OrderBy(t => t.Tag.Name).ToList();

        if (!orderedNewTags.SequenceEqual(orderedExistingTags))
        {
            differences.Add($"Banned tags changed from {string.Join(",", orderedExistingTags.Select(x => x.Tag.ReadableName))} to {string.Join(",", orderedNewTags.Select(x => x.Tag.ReadableName))}.");
        }

        var orderedExistingSpecialSlots = existingOptions.SpecialGameSlots.OrderBy(t => t.SpecialSlotPosition).ToList();
        var orderedNewSpecialSlots      = SpecialGameSlots.OrderBy(t => t.SpecialSlotPosition).ToList();

        if (!orderedNewSpecialSlots.SequenceEqual(orderedExistingSpecialSlots))
        {
            differences.Add($"Special slots changed from \n {string.Join("\n", orderedExistingSpecialSlots.Select(x => x.ToString()))} \n TO \n {string.Join("\n", orderedExistingSpecialSlots.Select(x => x.ToString()))}");
        }

        if (!differences.Any())
        {
            return(null);
        }

        string finalString = string.Join("\n", differences.Select(x => $"• {x}"));

        return(finalString);
    }