Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for 9.9.0 release #646

Merged
merged 10 commits into from
Jan 6, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public interface ITrackerBossService
/// <param name="admittedGuilt">
/// <see langword="true"/> if the command implies the boss was killed;
/// <see langword="false"/> if the boss was simply "tracked".
/// <param name="force">If the boss should be forced to be tracked while auto tracking</param>
/// </param>
/// <param name="force">If the boss should be forced to be tracked while auto tracking</param>
public void MarkBossAsDefeated(IHasBoss region, float? confidence = null, bool autoTracked = false, bool admittedGuilt = false, bool force = false);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.11" />
<PackageReference Include="MattEqualsCoder.DynamicForms.Core" Version="1.0.1" />
<PackageReference Include="MattEqualsCoder.DynamicForms.Core" Version="1.0.2" />
<PackageReference Include="MattEqualsCoder.GitHubReleaseChecker" Version="1.1.2" />
<PackageReference Include="MattEqualsCoder.MSURandomizer.Library" Version="3.0.1" />
<PackageReference Include="NAudio.Wasapi" Version="2.2.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public string TwitchStatusText
[DynamicFormFieldCheckBox("Enable poll creation", order: 60)]
public bool EnablePollCreation { get; set; }

[DynamicFormFieldNumericUpDown(minValue: 0, label: "Chat response time limit (in minutes):", groupName: "Bottom", order: 70)]
[DynamicFormFieldNumericUpDown(minValue: 0, label: "Chat greeting time period (in minutes):", groupName: "Bottom", order: 70, toolTipText: "How long before tracker will stop responding to messages from chat greeting her.")]
public int ChatGreetingTimeLimit { get; set; }

[DynamicFormFieldComboBox(label: "GT guessing game style:", order: 80)]
Expand Down
4 changes: 4 additions & 0 deletions src/TrackerCouncil.Smz3.Data/WorldData/Regions/IHasReward.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public void SetRewardType(RewardType rewardType)
Reward = region.World.Rewards.First(x => x.Type == rewardType && x.Region == null);
Reward.Region = this;
RewardState.RewardType = rewardType;
if (rewardType.IsInCategory(RewardCategory.NonRandomized))
{
RewardState.MarkedReward = RewardType;
}
}

public RewardType MarkedReward
Expand Down
16 changes: 13 additions & 3 deletions src/TrackerCouncil.Smz3.Data/WorldData/Regions/Region.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ protected Region(World world, Config config, IMetadataService? metadata, Tracker
public ILogic Logic => World.Logic;

/// <summary>
/// Gets the list of region-specific items, e.g. keys, maps, compasses.
/// Gets the map of generic items to region-specific items, e.g. keys, maps, compasses
/// </summary>
protected IList<ItemType> RegionItems { get; init; } = new List<ItemType>();
protected IDictionary<ItemType, ItemType> RegionItems { get; init; } = new Dictionary<ItemType, ItemType>();

/// <summary>
/// Name of the map to display when in this region
Expand All @@ -102,7 +102,17 @@ protected Region(World world, Config config, IMetadataService? metadata, Tracker
/// </returns>
public bool IsRegionItem(Item item)
{
return RegionItems.Contains(item.Type);
return RegionItems.Values.Contains(item.Type);
}

/// <summary>
/// Takes a generic item (e.g. key, compass, etc.) and returns the regional specific version of it if found
/// </summary>
/// <param name="originalType">The generic item that is desired to be replaced</param>
/// <returns>The regional version of the item, if found. Returns the originalType passed in if not found.</returns>
public ItemType ConvertToRegionItemType(ItemType originalType)
{
return RegionItems.TryGetValue(originalType, out var itemType) ? itemType : originalType;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public class CastleTower : Z3Region, IHasReward, IHasTreasure, IHasBoss
public CastleTower(World world, Config config, IMetadataService? metadata, TrackerState? trackerState)
: base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyCT];
RegionItems = new Dictionary<ItemType, ItemType>()
{
{ ItemType.Key, ItemType.KeyCT }
};

Foyer = new FoyerRoom(this, metadata, trackerState);
DarkMaze = new DarkMazeRoom(this, metadata, trackerState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class DesertPalace : Z3Region, IHasReward, IHasTreasure, IHasBoss
{
public DesertPalace(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyDP, ItemType.BigKeyDP, ItemType.MapDP, ItemType.CompassDP];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyDP },
{ ItemType.BigKey, ItemType.BigKeyDP },
{ ItemType.Map, ItemType.MapDP },
{ ItemType.Compass, ItemType.CompassDP },
};

BigChest = new Location(this, LocationId.DesertPalaceBigChest, 0x1E98F, LocationType.Regular,
name: "Big Chest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ public class EasternPalace : Z3Region, IHasReward, IHasTreasure, IHasBoss
{
public EasternPalace(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.BigKeyEP, ItemType.MapEP, ItemType.CompassEP];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.BigKey, ItemType.BigKeyEP },
{ ItemType.Map, ItemType.MapEP },
{ ItemType.Compass, ItemType.CompassEP },
};

CannonballChest = new Location(this, LocationId.EasternPalaceCannonballChest, 0x1E9B3, LocationType.Regular,
name: "Cannonball Chest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class GanonsTower : Z3Region, IHasTreasure, IHasBoss
{
public GanonsTower(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyGT, ItemType.BigKeyGT, ItemType.MapGT, ItemType.CompassGT];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyGT },
{ ItemType.BigKey, ItemType.BigKeyGT },
{ ItemType.Map, ItemType.MapGT },
{ ItemType.Compass, ItemType.CompassGT },
};

BobsTorch = new Location(this, LocationId.GanonsTowerBobsTorch, 0x308161, LocationType.Regular,
name: "Bob's Torch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public class HyruleCastle : Z3Region, IHasTreasure, IHasBoss

public HyruleCastle(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyHC, ItemType.MapHC];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyHC },
{ ItemType.Map, ItemType.MapHC },
};

Sanctuary = new Location(this, LocationId.Sanctuary, 0x1EA79, LocationType.Regular,
name: "Sanctuary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class IcePalace : Z3Region, IHasReward, IHasTreasure, IHasBoss
{
public IcePalace(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyIP, ItemType.BigKeyIP, ItemType.MapIP, ItemType.CompassIP];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyIP },
{ ItemType.BigKey, ItemType.BigKeyIP },
{ ItemType.Map, ItemType.MapIP },
{ ItemType.Compass, ItemType.CompassIP },
};

CompassChest = new Location(this, LocationId.IcePalaceCompassChest, 0x1E9D4, LocationType.Regular,
name: "Compass Chest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class MiseryMire : Z3Region, IHasReward, IHasPrerequisite, IHasTreasure,
{
public MiseryMire(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyMM, ItemType.BigKeyMM, ItemType.MapMM, ItemType.CompassMM];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyMM },
{ ItemType.BigKey, ItemType.BigKeyMM },
{ ItemType.Map, ItemType.MapMM },
{ ItemType.Compass, ItemType.CompassMM },
};

MainLobby = new Location(this, LocationId.MiseryMireMainLobby, 0x1EA5E, LocationType.Regular,
name: "Main Lobby",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class PalaceOfDarkness : Z3Region, IHasReward, IHasTreasure, IHasBoss
{
public PalaceOfDarkness(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyPD, ItemType.BigKeyPD, ItemType.MapPD, ItemType.CompassPD];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyPD },
{ ItemType.BigKey, ItemType.BigKeyPD },
{ ItemType.Map, ItemType.MapPD },
{ ItemType.Compass, ItemType.CompassPD },
};

ShooterRoom = new Location(this, LocationId.PalaceOfDarknessShooterRoom, 0x1EA5B, LocationType.Regular,
name: "Shooter Room",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class SkullWoods : Z3Region, IHasReward, IHasTreasure, IHasBoss
{
public SkullWoods(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeySW, ItemType.BigKeySW, ItemType.MapSW, ItemType.CompassSW];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeySW },
{ ItemType.BigKey, ItemType.BigKeySW },
{ ItemType.Map, ItemType.MapSW },
{ ItemType.Compass, ItemType.CompassSW },
};

PotPrison = new Location(this, LocationId.SkullWoodsPotPrison, 0x1E9A1, LocationType.Regular,
name: "Pot Prison",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class SwampPalace : Z3Region, IHasReward, IHasTreasure, IHasBoss
{
public SwampPalace(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeySP, ItemType.BigKeySP, ItemType.MapSP, ItemType.CompassSP];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeySP },
{ ItemType.BigKey, ItemType.BigKeySP },
{ ItemType.Map, ItemType.MapSP },
{ ItemType.Compass, ItemType.CompassSP },
};

Entrance = new Location(this, LocationId.SwampPalaceEntrance, 0x1EA9D, LocationType.Regular,
name: "Entrance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class ThievesTown : Z3Region, IHasReward, IHasTreasure, IHasBoss
{
public ThievesTown(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyTT, ItemType.BigKeyTT, ItemType.MapTT, ItemType.CompassTT];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyTT },
{ ItemType.BigKey, ItemType.BigKeyTT },
{ ItemType.Map, ItemType.MapTT },
{ ItemType.Compass, ItemType.CompassTT },
};

MapChest = new Location(this, LocationId.ThievesTownMapChest, 0x1EA01, LocationType.Regular,
name: "Map Chest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class TowerOfHera : Z3Region, IHasReward, IHasTreasure, IHasBoss
{
public TowerOfHera(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyTH, ItemType.BigKeyTH, ItemType.MapTH, ItemType.CompassTH];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyTH },
{ ItemType.BigKey, ItemType.BigKeyTH },
{ ItemType.Map, ItemType.MapTH },
{ ItemType.Compass, ItemType.CompassTH },
};

BasementCage = new Location(this, LocationId.TowerOfHeraBasementCage, 0x308162, LocationType.HeraStandingKey,
name: "Basement Cage",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ public class TurtleRock : Z3Region, IHasReward, IHasPrerequisite, IHasTreasure,
{
public TurtleRock(World world, Config config, IMetadataService? metadata, TrackerState? trackerState) : base(world, config, metadata, trackerState)
{
RegionItems = [ItemType.KeyTR, ItemType.BigKeyTR, ItemType.MapTR, ItemType.CompassTR];
RegionItems = new Dictionary<ItemType, ItemType>
{
{ ItemType.Key, ItemType.KeyTR },
{ ItemType.BigKey, ItemType.BigKeyTR },
{ ItemType.Map, ItemType.MapTR },
{ ItemType.Compass, ItemType.CompassTR },
};

CompassChest = new Location(this, LocationId.TurtleRockCompassChest, 0x1EA22, LocationType.Regular,
name: "Compass Chest",
Expand Down
2 changes: 1 addition & 1 deletion src/TrackerCouncil.Smz3.LegacyLogic/LegacyWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void Setup(LegacyWorldState state) {
}

void SetRewards(IEnumerable<LegacyRewardType> rewards) {
var regions = Regions.OfType<ILegacyReward>().Where(x => x.LegacyReward == None);
var regions = Regions.OfType<ILegacyReward>().Where(x => x.LegacyReward != Agahnim);
foreach (var (region, reward) in regions.Zip(rewards)) {
region.LegacyReward = reward;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using TrackerCouncil.Smz3.Data.ParsedRom;
Expand Down Expand Up @@ -212,6 +211,11 @@ private static ParsedRomLocationDetails GetParsedLocationDetails(byte[] rom, Loc
isProgression = true;
}

if (itemType is ItemType.Key or ItemType.BigKey or ItemType.Compass or ItemType.Map)
{
var originalItemType = itemType;
itemType = location.Region.ConvertToRegionItemType(originalItemType);
}

return new ParsedRomLocationDetails()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

public static class MultiplayerVersion
{
public const int Id = 5;
public const int Id = 6;
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void MarkGreenPendantDungeons()
private void MarkRedCrystalDungeons()
{
var dungeons = World.RewardRegions.Where(x =>
x is { RewardType: RewardType.PendantGreen, HasCorrectlyMarkedReward: false }).ToList();
x is { RewardType: RewardType.CrystalRed, HasCorrectlyMarkedReward: false }).ToList();

if (dungeons.Count == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public bool TrackItem(Item item, string? trackedAs = null, float? confidence = n
Tracker.Say(response: Responses.TrackedItemByStage, args: [itemName, stageName]);
}
}
else
else if (!autoTracked)
{
Tracker.Say(response: Responses.TrackedOlderProgressiveItem, args: [itemName, item.Metadata.Stages[item.TrackingState].ToString()]);
}
Expand All @@ -111,7 +111,7 @@ public bool TrackItem(Item item, string? trackedAs = null, float? confidence = n
Tracker.Say(response: Responses.TrackedProgressiveItem, args: [itemName, stageName]);
}
}
else
else if (!autoTracked)
{
Tracker.Say(response: Responses.TrackedTooManyOfAnItem, args: [itemName]);
}
Expand All @@ -123,27 +123,28 @@ public bool TrackItem(Item item, string? trackedAs = null, float? confidence = n
logger.LogInformation("Tracking local player multiple item {ItemType}", item.Type.GetDescription());

didTrack = item.Track();
if (item.TryGetTrackingResponse(out var response))

if (stateResponse)
{
if (stateResponse)
if (item.TryGetTrackingResponse(out var response))
{
Tracker.Say(response: response, args: [item.Counter]);
}
else if (item.Counter == 1)
{
if (stateResponse)
}
else if (item.Counter == 1)
{
Tracker.Say(response: Responses.TrackedItem, args: [itemName, item.Metadata.NameWithArticle]);
}
else if (item.Counter > 1)
{
if (stateResponse)
}
else if (item.Counter > 1)
{
Tracker.Say(response: Responses.TrackedItemMultiple, args: [item.Metadata.Plural ?? $"{itemName}s", item.Counter, item.Name]);
}
else
{
logger.LogWarning("Encountered multiple item with counter 0: {Item} has counter {Counter}", item, item.Counter);
if (stateResponse)
}
else if (!autoTracked)
{
logger.LogWarning("Encountered multiple item with counter 0: {Item} has counter {Counter}", item, item.Counter);
Tracker.Say(response: Responses.TrackedAlreadyTrackedItem, args: [itemName]);
}
}

}
else
{
Expand All @@ -163,7 +164,7 @@ public bool TrackItem(Item item, string? trackedAs = null, float? confidence = n
Tracker.Say(response: Responses.TrackedItem, args: [itemName, item.Metadata.NameWithArticle]);
}
}
else
else if (!autoTracked)
{
Tracker.Say(response: Responses.TrackedAlreadyTrackedItem, args: [itemName]);
}
Expand Down Expand Up @@ -199,6 +200,13 @@ public bool TrackItem(Item item, string? trackedAs = null, float? confidence = n

if (!didTrack)
{
// If we couldn't track the item for some reason (e.g. an AP seed where you had starting items), but this
// is an uncleared auto tracked location, we should still clear it
if (location != null && autoTracked && !location.Cleared)
{
Tracker.LocationTracker.Clear(location, confidence, autoTracked, stateResponse: false, allowLocationComments: true, updateTreasureCount: true);
}

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void Clear(Location location, float? confidence = null, bool autoTracked
var isKeysanityForLocation = (location.Region is Z3Region && World.Config.ZeldaKeysanity) || (location.Region is SMRegion && World.Config.MetroidKeysanity);
var items = playerProgressionService.GetProgression(!isKeysanityForLocation);

if (previousAccessibility is not (Accessibility.Available or Accessibility.AvailableWithKeys) && (confidence >= Options.MinimumSassConfidence || autoTracked))
if (previousAccessibility is Accessibility.OutOfLogic && (confidence >= Options.MinimumSassConfidence || autoTracked))
{
var locationInfo = location.Metadata;
var roomInfo = location.Room?.Metadata;
Expand Down
Loading