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:
75
src/Nonemm.Contests/Rules/IaruHf.cs
Normal file
75
src/Nonemm.Contests/Rules/IaruHf.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests.Rules;
|
||||
|
||||
/// IARU HF World Championship. The exchange is an ITU zone or, for a society
|
||||
/// headquarters station, its abbreviation; both count as multipliers per band.
|
||||
public sealed class IaruHf : Contest
|
||||
{
|
||||
public string Name => "IARUHF";
|
||||
|
||||
public string DisplayName => "IARU HF World Championship";
|
||||
|
||||
public string CabrilloName => "IARU-HF";
|
||||
|
||||
public IReadOnlyList<ExchangeField> ExchangeFieldsFor(StationInfo me) =>
|
||||
[
|
||||
new ExchangeField("RST", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report),
|
||||
new ExchangeField("Zone/HQ", ExchangeSlot.Exchange1, ExchangeFieldKind.Text) { Width = 6 },
|
||||
];
|
||||
|
||||
public IReadOnlyList<string> MultiplierNames => ["Zones", "HQ"];
|
||||
|
||||
public DupeScope DupeScope => DupeScope.PerBandAndMode;
|
||||
|
||||
public bool HasSerialNumbers => false;
|
||||
|
||||
public IReadOnlyList<ModeCategory> Modes => [ModeCategory.Cw, ModeCategory.Phone];
|
||||
|
||||
public string SentExchangeFor(StationInfo me) => $"599 {me.ItuZone}";
|
||||
|
||||
public int PointsFor(QsoContext qso)
|
||||
{
|
||||
string exchange = Exchange(qso);
|
||||
if (!IsZone(exchange))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (int.TryParse(exchange, out int zone) && zone == qso.Me.ItuZone)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return qso.IsSameContinent ? 3 : 5;
|
||||
}
|
||||
|
||||
public IReadOnlyList<Multiplier> MultipliersFor(QsoContext qso)
|
||||
{
|
||||
string exchange = Exchange(qso);
|
||||
if (exchange.Length == 0)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
string band = qso.Band?.Name ?? "";
|
||||
return [new Multiplier(IsZone(exchange) ? 1 : 2, exchange, band)];
|
||||
}
|
||||
|
||||
public int TotalScore(ScoreTally tally) => tally.Points * tally.TotalMultipliers;
|
||||
|
||||
public CabrilloExchange CabrilloExchange(Qso qso, StationInfo me) =>
|
||||
new(
|
||||
[
|
||||
new CabrilloField(me.Callsign, 13),
|
||||
new CabrilloField(qso.SentReport, 3),
|
||||
new CabrilloField(me.ItuZone.ToString(), 6),
|
||||
],
|
||||
[
|
||||
new CabrilloField(qso.Call.Text, 13),
|
||||
new CabrilloField(qso.ReceivedReport, 3),
|
||||
new CabrilloField(qso.Exchange1, 6),
|
||||
]);
|
||||
|
||||
private static string Exchange(QsoContext qso) => qso.Qso.Exchange1.Trim().ToUpperInvariant();
|
||||
|
||||
private static bool IsZone(string exchange) =>
|
||||
exchange.Length > 0 && exchange.All(char.IsAsciiDigit);
|
||||
}
|
||||
Reference in New Issue
Block a user