Skip to content

Commit

Permalink
New achievement: 30 Minutes or Less
Browse files Browse the repository at this point in the history
Deliver 5 hot pizzas
  • Loading branch information
AntumDeluge committed Apr 26, 2024
1 parent be279d4 commit f71d98c
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 45 deletions.
2 changes: 2 additions & 0 deletions doc/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Changelog

*world*
- renamed chef Patrick to Preston
- new achievements:
- 30 Minutes or Less: Deliver 5 hot pizzas

*web client*
- fixed text extending past edge of notification bubbles
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ public Collection<Achievement> createAchievements() {
Achievement.MEDIUM_BASE_SCORE, true,
new QuestCountCompletedCondition(80)));

// deliver 5 hot pizzas
achievements.add(createAchievement(
"quest.pizza_delivery.hot.0005", "30 Minutes or Less",
"Deliver 5 hot pizzas",
Achievement.EASY_BASE_SCORE, true,
new QuestStateGreaterThanCondition("pizza_delivery", 3, 4)));

return achievements;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,58 @@ private void loadConfigurators(final ZoneConfigurator... zc) {
setupZone("testzone", zc);
}

private void preparePizzaDelivery() {
loadConfigurators(
// Balduin
new games.stendhal.server.maps.ados.rock.WeaponsCollectorNPC(),
// Eliza
new games.stendhal.server.maps.ados.coast.FerryConveyerNPC(),
// Fidorea
new games.stendhal.server.maps.ados.city.MakeupArtistNPC(),
// Haizen
new games.stendhal.server.maps.ados.magician_house.WizardNPC(),
// Jenny
new games.stendhal.server.maps.semos.plains.MillerNPC(),
// Jynath
new games.stendhal.server.maps.orril.magician_house.WitchNPC(),
// Katinka
new games.stendhal.server.maps.ados.outside.AnimalKeeperNPC(),
// Leander
new games.stendhal.server.maps.semos.bakery.ChefNPC(),
// Marcus
new games.stendhal.server.maps.semos.jail.GuardNPC(),
// Martin Farmer
new games.stendhal.server.maps.ados.wall.HolidayingManNPC(),
// Nishiya
new games.stendhal.server.maps.semos.village.SheepSellerNPC(),
// Ouchit
new games.stendhal.server.maps.semos.tavern.BowAndArrowSellerNPC(),
// Tor'Koom
new games.stendhal.server.maps.semos.dungeon.SheepBuyerNPC()
);
// Cyk
new HouseBuyingMain().createAthorNPC(testzone);
// Ramon
setupZone("-1_athor_ship_w2");
loadQuests(new Blackjack());

loadQuests(new BuiltQuest(new PizzaDelivery().story()));

assertNotNull(getSpeakerNPC("Leander"));
assertNotNull(getSpeakerNPC("Jenny"));
assertNotNull(getSpeakerNPC("Jynath"));
assertNotNull(getSpeakerNPC("Tor'Koom"));
assertNotNull(getSpeakerNPC("Martin Farmer"));
assertNotNull(getSpeakerNPC("Haizen"));
assertNotNull(getSpeakerNPC("Fidorea"));
assertNotNull(getSpeakerNPC("Eliza"));
assertNotNull(getSpeakerNPC("Katinka"));
assertNotNull(getSpeakerNPC("Cyk"));
assertNotNull(getSpeakerNPC("Marcus"));
assertNotNull(getSpeakerNPC("Ramon"));
assertNotNull(getSpeakerNPC("Balduin"));
}

/* TODO:
* - Helper of Ados City Dwellers
*/
Expand Down Expand Up @@ -254,71 +306,41 @@ public void testPatientlyWaitingOnGrumpy() {
@Test
public void testAideToSemosFolk() {
final String id = "quest.special.semos";
preparePizzaDelivery();
loadConfigurators(
// Balduin
new games.stendhal.server.maps.ados.rock.WeaponsCollectorNPC(),
// Carmen
new games.stendhal.server.maps.semos.city.HealerNPC(),
// Ceryl
new games.stendhal.server.maps.semos.library.LibrarianNPC(),
// Eliza
new games.stendhal.server.maps.ados.coast.FerryConveyerNPC(),
// Fidorea
new games.stendhal.server.maps.ados.city.MakeupArtistNPC(),
// Hackim Easso
new games.stendhal.server.maps.semos.blacksmith.BlacksmithAssistantNPC(),
// Haizen
new games.stendhal.server.maps.ados.magician_house.WizardNPC(),
// Hayunn Naratha
new games.stendhal.server.maps.semos.guardhouse.RetiredAdventurerNPC(),
// Ilisa
new games.stendhal.server.maps.semos.temple.HealerNPC(),
// Io Flotto
new games.stendhal.server.maps.semos.temple.TelepathNPC(),
// Jenny
new games.stendhal.server.maps.semos.plains.MillerNPC(),
// Joshua
new games.stendhal.server.maps.ados.goldsmith.GoldsmithNPC(),
// Jynath
new games.stendhal.server.maps.orril.magician_house.WitchNPC(),
// Karl
new games.stendhal.server.maps.ados.forest.FarmerNPC(),
// Katinka
new games.stendhal.server.maps.ados.outside.AnimalKeeperNPC(),
// Ketteh Wehoh
new games.stendhal.server.maps.semos.townhall.DecencyAndMannersWardenNPC(),
// Leander
new games.stendhal.server.maps.semos.bakery.ChefNPC(),
// Marcus
new games.stendhal.server.maps.semos.jail.GuardNPC(),
// Martin Farmer
new games.stendhal.server.maps.ados.wall.HolidayingManNPC(),
// Mayor Sakhs
new games.stendhal.server.maps.semos.townhall.MayorNPC(),
// Monogenes
new games.stendhal.server.maps.semos.city.GreeterNPC(),
// Nishiya
new games.stendhal.server.maps.semos.village.SheepSellerNPC(),
// Ouchit
new games.stendhal.server.maps.semos.tavern.BowAndArrowSellerNPC(),
// Rudolph
new games.stendhal.server.maps.semos.city.RudolphNPC(),
// Sato
new games.stendhal.server.maps.semos.city.SheepBuyerNPC(),
// Tad
new games.stendhal.server.maps.semos.hostel.BoyNPC(),
// Tor'Koom
new games.stendhal.server.maps.semos.dungeon.SheepBuyerNPC(),
// Xin Blanca
new games.stendhal.server.maps.semos.tavern.TraderNPC(),
// Xoderos
new games.stendhal.server.maps.semos.blacksmith.BlacksmithNPC()
);
// Cyk
new HouseBuyingMain().createAthorNPC(testzone);
// Ramon
setupZone("-1_athor_ship_w2");
loadQuests(new Blackjack());

// FIXME: loading quests from resource broken
//~ qloaded.addAll(QuestHelper.loadRegionalQuests(Region.SEMOS_CITY));
Expand All @@ -337,7 +359,6 @@ public void testAideToSemosFolk() {
new HungryJoshua(),
new BuiltQuest(new LookBookforCeryl().story()),
new MeetKetteh(),
new BuiltQuest(new PizzaDelivery().story()),
new HerbsForCarmen(),
new LearnAboutOrbs(),
new DailyMonsterQuest(),
Expand Down Expand Up @@ -433,18 +454,6 @@ public void testAideToSemosFolk() {
assertFalse(achievementReached(player, id));

// Pizza Delivery
assertNotNull(getSpeakerNPC("Leander"));
assertNotNull(getSpeakerNPC("Jenny"));
assertNotNull(getSpeakerNPC("Tor'Koom"));
assertNotNull(getSpeakerNPC("Martin Farmer"));
assertNotNull(getSpeakerNPC("Haizen"));
assertNotNull(getSpeakerNPC("Fidorea"));
assertNotNull(getSpeakerNPC("Eliza"));
assertNotNull(getSpeakerNPC("Katinka"));
assertNotNull(getSpeakerNPC("Cyk"));
assertNotNull(getSpeakerNPC("Marcus"));
assertNotNull(getSpeakerNPC("Ramon"));
assertNotNull(getSpeakerNPC("Balduin"));
//~ assertTrue(QuestHelper.isLoaded("pizza_delivery"));
QuestRunner.doQuestPizzaDelivery(player);
assertFalse(achievementReached(player, id));
Expand Down Expand Up @@ -498,6 +507,24 @@ public void testQuestJunkie() {
assertTrue(achievementReached(player, id));
}

@Test
public void test30MinutesOrLess() {
final String id = "quest.pizza_delivery.hot.0005";
preparePizzaDelivery();

for (int idx = 0; idx < 10; idx++) {
QuestRunner.doQuestPizzaDelivery(player, false);
}
assertFalse(achievementReached(player, id));

for (int idx = 0; idx < 10; idx++) {
assertFalse(achievementReached(player, id));
boolean fast = idx != 0 && idx % 2 != 0;
QuestRunner.doQuestPizzaDelivery(player, fast);
}
assertTrue(achievementReached(player, id));
}

private class DummyQuest extends AbstractQuest {
private final String slotName;

Expand Down
9 changes: 8 additions & 1 deletion tests/utilities/QuestRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,20 +395,27 @@ public static void doQuestPlinksToy(final Player player) {
ChildrensFriendStub.doQuestPlink(player);
}

public static void doQuestPizzaDelivery(final Player player) {
public static void doQuestPizzaDelivery(final Player player, final boolean fast) {
final String questSlot = "pizza_delivery";
Engine en = getSpeakerNPC("Leander").getEngine();
en.step(player, "hi");
en.step(player, "quest");
en.step(player, "yes");
en.step(player, "bye");
if (!fast) {
player.setQuest(questSlot, 1, "0");
}
en = getSpeakerNPC(player.getQuest(questSlot, 0)).getEngine();
en.step(player, "hi");
en.step(player, "pizza");
en.step(player, "bye");
assertEquals("done", player.getQuest(questSlot, 0));
}

public static void doQuestPizzaDelivery(final Player player) {
QuestRunner.doQuestPizzaDelivery(player, true);
}

public static void doQuestMeetSanta(final Player player) {
StillBelievingStub.doQuestSanta(player);
}
Expand Down

0 comments on commit f71d98c

Please sign in to comment.