using Nonemm.Core; namespace Nonemm.Contests.Rules; /// The SARTG World Wide RTTY contest. A contact inside your own country is 5 /// points, one on your own continent 10 and one from another 15. The countries /// count once per band, and so do the US, Canadian and Japanese call areas. public sealed class SartgRtty : Contest { public string Name => "SARTGRTTY"; public string DisplayName => "SARTG World Wide RTTY"; public string CabrilloName => "SARTG-RTTY"; public IReadOnlyList ExchangeFieldsFor(StationInfo me) => [ new ExchangeField("Snt", ExchangeSlot.SentReport, ExchangeFieldKind.Report, IsRequired: false), new ExchangeField("Rcv", ExchangeSlot.ReceivedReport, ExchangeFieldKind.Report), new ExchangeField("SntNR", ExchangeSlot.SentNumber, ExchangeFieldKind.Number, IsRequired: false), new ExchangeField("RcvNr", ExchangeSlot.SerialNumber, ExchangeFieldKind.Number), ]; public IReadOnlyList MultiplierNamesFor(StationInfo me) => ["Countries", "Areas"]; public DupeScope DupeScope => DupeScope.PerBand; public bool HasSerialNumbers => true; public IReadOnlyList Modes => [ModeCategory.Digital]; public string SentExchangeFor(StationInfo me) => "001"; public int PointsFor(QsoContext qso) => qso.IsSameCountry ? 5 : qso.IsSameContinent ? 10 : 15; public IReadOnlyList MultipliersFor(QsoContext qso) { string band = qso.Band?.Name ?? ""; List found = []; if (qso.CountryPrefix.Length > 0) { found.Add(new Multiplier(1, qso.CountryPrefix, band)); } string area = qso.Qso.Section.Trim().ToUpperInvariant(); if (area.Length > 0) { found.Add(new Multiplier(2, area, band)); } return found; } public int TotalScore(ScoreTally tally, ContestEntry entry) => tally.Points * tally.TotalMultipliers; public CabrilloExchange CabrilloExchange(Qso qso, StationInfo me, ContestEntry entry) => new( [ new CabrilloField(me.Callsign, 13), new CabrilloField(qso.SentReport, 3), new CabrilloField($"{qso.SentNumber:000}", 4), ], [ new CabrilloField(qso.Call.Text, 13), new CabrilloField(qso.ReceivedReport, 3), new CabrilloField($"{qso.ReceivedNumber:000}", 4), ]); }