Add the rest of the major contests, .udc files and the registry

ARRL DX, IARU HF, Sweepstakes, RTTY Roundup, NAQP and general logging join
CQ WW and CQ WPX. The Cabrillo QSO line is now built column by column by the
contest, because Sweepstakes puts the callsign after the serial number where
everyone else puts it first.

User-defined contests read the subset of N1MM's .udc settings that covers the
exchange, the dupe rule, points and up to three multipliers.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik
2026-08-27 10:35:28 +00:00
parent 0f84bc8972
commit ef631f1dc4
26 changed files with 1162 additions and 13 deletions

View File

@@ -0,0 +1,69 @@
using Nonemm.Contests.Multipliers;
using Nonemm.Core;
namespace Nonemm.Contests.Rules;
/// ARRL November Sweepstakes. A station counts once for the whole contest
/// whatever the band, and the multiplier is the ARRL or RAC section.
public sealed class Sweepstakes : Contest
{
private readonly ModeCategory mode;
public Sweepstakes(ModeCategory mode) => this.mode = mode;
public string Name => "SS";
public string DisplayName => $"ARRL Sweepstakes {ModeLabel()}";
public string CabrilloName => mode == ModeCategory.Cw ? "ARRL-SS-CW" : "ARRL-SS-SSB";
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
[
new ExchangeField("Nr", ExchangeSlot.SerialNumber, ExchangeFieldKind.Number),
new ExchangeField("Prec", ExchangeSlot.Precedence, ExchangeFieldKind.Precedence),
new ExchangeField("Ck", ExchangeSlot.Check, ExchangeFieldKind.Check),
new ExchangeField("Sec", ExchangeSlot.Section, ExchangeFieldKind.ArrlSection),
];
public IReadOnlyList<string> MultiplierNames => ["Sections"];
public DupeScope DupeScope => DupeScope.Once;
public bool HasSerialNumbers => true;
public IReadOnlyList<ModeCategory> Modes => [mode];
public string SentExchangeFor(StationInfo me) =>
$"{me.Precedence} {me.Callsign} {me.Check:00} {me.ArrlSection}";
public int PointsFor(QsoContext qso) => 2;
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso)
{
string section = qso.Qso.Section.Trim().ToUpperInvariant();
return ArrlSections.IsSection(section) ? [new Multiplier(1, section, "")] : [];
}
public int TotalScore(ScoreTally tally) => tally.Points * tally.TotalMultipliers;
/// Sweepstakes puts the callsign after the serial number and precedence
/// rather than first, which is why the writer takes the whole column list.
public CabrilloExchange CabrilloExchange(Qso qso, StationInfo me) =>
new(
[
new CabrilloField($"{qso.SentNumber}", 4),
new CabrilloField(me.Precedence, 1),
new CabrilloField(me.Callsign, 13),
new CabrilloField($"{me.Check:00}", 2),
new CabrilloField(me.ArrlSection, 3),
],
[
new CabrilloField($"{qso.ReceivedNumber}", 4),
new CabrilloField(qso.Precedence, 1),
new CabrilloField(qso.Call.Text, 13),
new CabrilloField($"{qso.Check:00}", 2),
new CabrilloField(qso.Section, 3),
]);
private string ModeLabel() => mode == ModeCategory.Cw ? "CW" : "SSB";
}