Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions documentation/manual-test-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ should give the same NPCs.
- [ ] Port Alveus Market (map 146): Sarakael, Leika Passage, Isalin, Lilith and the other stall
keepers all stand on the map, and the minimap shows them
- [ ] The shops, skill shops and teleporters of the NPCs above still open and work
- [ ] Rerun the parser on a filled database: the town teleporter in NosVille takes 1 000 gold for
its second destination and 2 000 for its third, as before
- [ ] Rerun the parser on a filled database: the town teleporter in NosVille takes no gold for
any destination, as its menu's "(Free)" labels say
- [ ] Priestess Serizad's trip to Grenigas Temple uses one Rune Piece and says so; without one the
player stays
- [ ] The champion area tower does not answer a player without a champion level; the volunteers'
Expand Down Expand Up @@ -1960,10 +1960,10 @@ Run the parser's teleporter import first (the full import does it), then stand n
of teleporter NPC with at least 10 000 gold. A database imported before teleporters recorded their
menu needs the import run again: until then those destinations take nobody anywhere.

- [ ] NosVille, Western Krem and Port Alveus Square teleporters: the NosVille option is free,
Krem costs 1 000 gold and Port Alveus 2 000, and each lands in the town the menu names
- [ ] Act V teleporters (Mortaz Desert Port and the other two Act V camps): 0, 5 000 and
10 000 gold for the first, second and third destination
- [ ] NosVille, Western Krem and Port Alveus Square teleporters: every option is labelled "(Free)",
takes no gold, and lands in the town the menu names
- [ ] Act V teleporters (Mortaz Desert Port and the other two Act V camps): every option is
labelled "(Free)" and takes no gold
- [ ] Port Alveus butler, "Go to Wedding Gazebo. (500 Gold)": 500 gold and the gazebo
- [ ] The Water Grotto guide, the ferry to the Forgotten Archipelago and the ship back from
the Mortaz Desert Port are free and land on their map
Expand Down
3 changes: 1 addition & 2 deletions src/NosCore.Parser/Parsers/TeleporterFares.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace NosCore.Parser.Parsers
{
// What each teleport menu charges and asks of the player, as its buttons and the NPC's lines name it.
// The town and Act V teleporter menus label every destination "(Free)" in npctalk.dat, so they are not listed.
public static class TeleporterFares
{
public const short CelestialLairJourneyDialog = 540;
Expand All @@ -27,8 +28,6 @@ public static class TeleporterFares

public static (long Gold, short? ItemVNum) Of(NrunRunnerType? runner, short index, short? npcDialog) => runner switch
{
NrunRunnerType.Teleport => (1000L * index, null),
NrunRunnerType.TeleportActV => (5000L * index, null),
NrunRunnerType.GoToWeddingGazebo => (500, null),
NrunRunnerType.MoveToMap when npcDialog is CelestialLairJourneyDialog or VolunteerDialog => (25_000, null),
NrunRunnerType.GoToGrenigasTemple => (0, RunePieceVNum),
Expand Down
13 changes: 7 additions & 6 deletions test/NosCore.Parser.Tests/TeleporterParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,35 +203,36 @@ public async Task AStoredTeleporterTakesTheCapturedDestinationInPlace()
}

[TestMethod]
public async Task TheTownTeleporterChargesAThousandGoldPerOption()
public async Task TheTownTeleporterIsFree()
{
await _parser.InsertTeleportersAsync([
Captured.Talk(NrunRunnerType.Teleport, 2, 1899),
Captured.Arrival(20, 8, 87),
]);

var teleporter = _saved.Single(s => s.MapNpcId == 1899);
Assert.AreEqual(2_000L, teleporter.Fare);
Assert.AreEqual(0L, teleporter.Fare);
Assert.IsNull(teleporter.FareItemVNum);
Assert.AreEqual((byte)0, teleporter.MinimumHeroLevel);
}

[TestMethod]
public async Task AStoredTeleporterWithoutItsFareTakesItInPlace()
public async Task AStoredTeleporterWithAStaleFareTakesItsFareInPlace()
{
_existing.Add(new TeleporterDto { TeleporterId = 7, MapNpcId = 1899, Runner = NrunRunnerType.Teleport, Index = 1, MapId = 20, MapX = 8, MapY = 87 });
_existing.Add(new TeleporterDto { TeleporterId = 7, MapNpcId = 1899, Runner = NrunRunnerType.Teleport, Index = 1, MapId = 20, MapX = 8, MapY = 87, Fare = 1_000 });

await _parser.InsertTeleportersAsync([Captured.Npc(330, 1899, 10, 10), Captured.Talk(NrunRunnerType.Teleport, 1, 1899), Captured.Arrival(20, 8, 87)]);

var teleporter = _saved.Single(s => s.MapNpcId == 1899);
Assert.AreEqual((short)7, teleporter.TeleporterId);
Assert.AreEqual(1_000L, teleporter.Fare);
Assert.AreEqual(0L, teleporter.Fare);
}

[TestMethod]
public void EachMenuChargesWhatItsButtonsName()
{
Assert.AreEqual((5_000L, (short?)null), TeleporterFares.Of(NrunRunnerType.TeleportActV, 1, null));
Assert.AreEqual((0L, (short?)null), TeleporterFares.Of(NrunRunnerType.TeleportActV, 1, null));
Assert.AreEqual((0L, (short?)null), TeleporterFares.Of(NrunRunnerType.Teleport, 2, null));
Assert.AreEqual((500L, (short?)null), TeleporterFares.Of(NrunRunnerType.GoToWeddingGazebo, 0, null));
Assert.AreEqual((0L, (short?)null), TeleporterFares.Of(NrunRunnerType.GoToGlacerusCave, 2, null));
Assert.AreEqual((25_000L, (short?)null), TeleporterFares.Of(NrunRunnerType.MoveToMap, 2700, TeleporterFares.CelestialLairJourneyDialog));
Expand Down