Skip to content

Contract block profile ignores MinContracts and MaxContracts #427

Open

Description

@Blaylock1988

Problem

On master 5899d09, the contract block profile declares MinContracts and MaxContracts, sets both to 10 by default and parses them, but nothing reads them. ApplyProfileToBlock goes through every entry in MissionIds and tries to post each one:

for (int i = 0; i < MissionIds.Count; i++)
{
MissionProfile missionprofile = null;
if (!ProfileManager.MissionProfiles.TryGetValue(MissionIds[i], out missionprofile))
{
BehaviorLogger.Write(ProfileSubtypeId + ": Couldn't find Mission Profile With Name: " + MissionIds[i], BehaviorDebugEnum.Action);
continue;
}
var mission = new Mission(MissionIds[i], npcData);
if (!mission.Init(block))
{
//MyVisualScriptLogicProvider.ShowNotificationToAll($"Failed {MissionIds[i]}", 5000);
}

So a profile with six mission ids and [MinContracts:2] [MaxContracts:3] still posts all six. Searching the code and the wiki docs for both names only finds the declaration, the defaults and the tag parsing. They have been there since alpha v1 (July 2024).

Fix

Before the loop, pick how many contracts to post, a random number from MinContracts to MaxContracts limited to the number of mission ids, and post that many of the ids, picked at random. MinTime and MaxTime in the chat profile are used the same way:

The default of 10 would then cap profiles that list more than 10 ids. If that is a problem the defaults could change to a value that means no limit. If you would rather not support the tags, removing them is the other option.

Happy to open a PR for this.

Activity

  1. enenra commented on Oct 19, 2026

    @enenra
    Collaborator

    We'll hold with this one for now as I've got some larger changes incoming to anything involving contracts and missions that I want to put through first.

  2. added
    Bug ConfirmedThis label indicates that a bug has been confirmed to have been found in code.
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug ConfirmedThis label indicates that a bug has been confirmed to have been found in code.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions