From 37de198774383a27e81555d2f6047d526b2a0854 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 15 Apr 2024 23:35:40 -0700 Subject: [PATCH] Track completions of Chocolate for Elisabeth & Ice Cream for Annie quests --- .../server/entity/player/UpdateConverter.java | 11 +++++ .../maps/quests/ChocolateForElisabeth.java | 38 +++++++++--------- .../server/maps/quests/IcecreamForAnnie.java | 40 ++++++++++--------- .../quests/ChocolateForElisabethTest.java | 40 +++++++++---------- .../maps/quests/IcecreamForAnnieTest.java | 12 +++--- 5 files changed, 78 insertions(+), 63 deletions(-) diff --git a/src/games/stendhal/server/entity/player/UpdateConverter.java b/src/games/stendhal/server/entity/player/UpdateConverter.java index bc704299597..3c69ab45458 100644 --- a/src/games/stendhal/server/entity/player/UpdateConverter.java +++ b/src/games/stendhal/server/entity/player/UpdateConverter.java @@ -662,6 +662,17 @@ public static void updateQuests(final Player player) { if (player.hasQuest(questSlot) && !slotState.startsWith(";")) { player.setQuest(questSlot, ";" + slotState); } + + // 1.47: support completions tracking + for (String slot: Arrays.asList("chocolate_for_elisabeth", "icecream_for_annie")) { + if (!player.hasQuest(slot)) { + continue; + } + final String[] state = player.getQuest(slot).split(";"); + if ("eating".equals(player.getQuest(slot, 0)) && "".equals(player.getQuest(slot, 2))) { + player.setQuest(slot, 2, "1"); + } + } } diff --git a/src/games/stendhal/server/maps/quests/ChocolateForElisabeth.java b/src/games/stendhal/server/maps/quests/ChocolateForElisabeth.java index 6a6fe66aac9..b2c9d745852 100644 --- a/src/games/stendhal/server/maps/quests/ChocolateForElisabeth.java +++ b/src/games/stendhal/server/maps/quests/ChocolateForElisabeth.java @@ -1,6 +1,6 @@ /* $Id$ */ /*************************************************************************** - * (C) Copyright 2003-2023 - Stendhal * + * (C) Copyright 2003-2024 - Stendhal * *************************************************************************** *************************************************************************** * * @@ -30,6 +30,7 @@ import games.stendhal.server.entity.npc.action.DropItemAction; import games.stendhal.server.entity.npc.action.IncreaseKarmaAction; import games.stendhal.server.entity.npc.action.IncreaseXPAction; +import games.stendhal.server.entity.npc.action.IncrementQuestAction; import games.stendhal.server.entity.npc.action.InflictStatusOnNPCAction; import games.stendhal.server.entity.npc.action.MultipleActions; import games.stendhal.server.entity.npc.action.SetQuestAction; @@ -104,7 +105,7 @@ private void chocolateStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestNotStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, "rejected")), + new QuestNotStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, 0, "rejected")), ConversationStates.ATTENDING, "I can't remember when I smelt the good taste of #chocolate the last time...", null); @@ -117,7 +118,7 @@ private void chocolateStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "start"), new PlayerHasItemWithHimCondition("chocolate bar")), + new QuestInStateCondition(QUEST_SLOT, 0, "start"), new PlayerHasItemWithHimCondition("chocolate bar")), ConversationStates.IDLE, "My mum wants to know who I was asking for chocolate from now :(", null); @@ -126,7 +127,7 @@ private void chocolateStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "start"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))), + new QuestInStateCondition(QUEST_SLOT, 0, "start"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))), ConversationStates.ATTENDING, "I hope that someone will bring me some chocolate soon...:(", null); @@ -135,7 +136,7 @@ private void chocolateStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "mummy"), new PlayerHasItemWithHimCondition("chocolate bar")), + new QuestInStateCondition(QUEST_SLOT, 0, "mummy"), new PlayerHasItemWithHimCondition("chocolate bar")), ConversationStates.QUESTION_1, "Awesome! Is that chocolate for me?", null); @@ -144,7 +145,7 @@ private void chocolateStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "mummy"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))), + new QuestInStateCondition(QUEST_SLOT, 0, "mummy"), new NotCondition(new PlayerHasItemWithHimCondition("chocolate bar"))), ConversationStates.ATTENDING, "I hope that someone will bring me some chocolate soon...:(", null); @@ -153,7 +154,7 @@ private void chocolateStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, "start"), new QuestNotInStateCondition(QUEST_SLOT, "mummy")), + new QuestStartedCondition(QUEST_SLOT), new QuestNotInStateCondition(QUEST_SLOT, 0, "start"), new QuestNotInStateCondition(QUEST_SLOT, 0, "mummy")), ConversationStates.ATTENDING, "Hello.", null); @@ -162,7 +163,7 @@ private void chocolateStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "rejected")), + new QuestInStateCondition(QUEST_SLOT, 0, "rejected")), ConversationStates.ATTENDING, "Hello.", null); @@ -213,7 +214,7 @@ private void chocolateStep() { null, ConversationStates.ATTENDING, "Thank you!", - new SetQuestAction(QUEST_SLOT, "start")); + new SetQuestAction(QUEST_SLOT, 0, "start")); // Player says no, they've lost karma npc.add(ConversationStates.QUEST_OFFERED, @@ -221,7 +222,7 @@ private void chocolateStep() { null, ConversationStates.IDLE, "Ok, I'll wait till mommy finds some helpers...", - new SetQuestAndModifyKarmaAction(QUEST_SLOT, "rejected", -5.0)); + new SetQuestAndModifyKarmaAction(QUEST_SLOT, 0, "rejected", -5.0)); // Player has got chocolate bar and spoken to mummy final List reward = new LinkedList(); @@ -239,8 +240,9 @@ public void fire(final Player player, final Sentence sentence, final EventRaiser } }); reward.add(new IncreaseXPAction(500)); - reward.add(new SetQuestAction(QUEST_SLOT, "eating;")); - reward.add(new SetQuestToTimeStampAction(QUEST_SLOT,1)); + reward.add(new SetQuestAction(QUEST_SLOT, 0, "eating;")); + reward.add(new SetQuestToTimeStampAction(QUEST_SLOT, 1)); + reward.add(new IncrementQuestAction(QUEST_SLOT, 2, 1)); reward.add(new IncreaseKarmaAction(10.0)); reward.add(new InflictStatusOnNPCAction("chocolate bar")); @@ -284,10 +286,10 @@ private void meetMummyStep() { mummyNPC.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(mummyNPC.getName()), - new QuestInStateCondition(QUEST_SLOT, "start")), + new QuestInStateCondition(QUEST_SLOT, 0, "start")), ConversationStates.ATTENDING, "Oh you met my daughter Elisabeth already. You seem like a nice person so it would be really kind, if you can bring her a chocolate bar because I'm not #strong enough for that.", - new SetQuestAction(QUEST_SLOT, "mummy")); + new SetQuestAction(QUEST_SLOT, 0, "mummy")); mummyNPC.addReply("strong", "I tried to get some chocolate for Elisabeth a few times, but I couldn't make my way through the assassins and bandits running around #there."); @@ -305,7 +307,7 @@ public void addToWorld() { fillQuestInfo( "Chocolate for Elisabeth", "Sweet, sweet chocolate! No one can live without it! And Elisabeth loooves to have some...", - true); + true, 2); chocolateStep(); meetMummyStep(); } @@ -318,14 +320,14 @@ public List getHistory(final Player player) { return res; } res.add("Elisabeth is a sweet little girl who lives in Kirdneh together with her family."); - final String questState = player.getQuest(QUEST_SLOT); + final String questState = player.getQuest(QUEST_SLOT, 0); if ("rejected".equals(questState)) { res.add("I don't like sweet little girls."); } - if (player.isQuestInState(QUEST_SLOT, "start","mummy") || isCompleted(player)) { + if (player.isQuestInState(QUEST_SLOT, 0, "start","mummy") || isCompleted(player)) { res.add("Little Elisabeth wants a chocolate bar."); } - if (player.isQuestInState(QUEST_SLOT, "start","mummy") && player.isEquipped("chocolate bar") || isCompleted(player)) { + if (player.isQuestInState(QUEST_SLOT, 0, "start","mummy") && player.isEquipped("chocolate bar") || isCompleted(player)) { res.add("I found a tasty chocolate bar for Elisabeth."); } if ("mummy".equals(questState) || isCompleted(player)) { diff --git a/src/games/stendhal/server/maps/quests/IcecreamForAnnie.java b/src/games/stendhal/server/maps/quests/IcecreamForAnnie.java index 4d670b366a2..2ba405ebe4d 100644 --- a/src/games/stendhal/server/maps/quests/IcecreamForAnnie.java +++ b/src/games/stendhal/server/maps/quests/IcecreamForAnnie.java @@ -1,6 +1,6 @@ /* $Id$ */ /*************************************************************************** - * (C) Copyright 2003-2023 - Stendhal * + * (C) Copyright 2003-2024 - Stendhal * *************************************************************************** *************************************************************************** * * @@ -25,6 +25,7 @@ import games.stendhal.server.entity.npc.action.EquipItemAction; import games.stendhal.server.entity.npc.action.IncreaseKarmaAction; import games.stendhal.server.entity.npc.action.IncreaseXPAction; +import games.stendhal.server.entity.npc.action.IncrementQuestAction; import games.stendhal.server.entity.npc.action.InflictStatusOnNPCAction; import games.stendhal.server.entity.npc.action.MultipleActions; import games.stendhal.server.entity.npc.action.SetQuestAction; @@ -100,7 +101,7 @@ private void icecreamStep() { ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), new QuestNotStartedCondition(QUEST_SLOT), - new QuestNotInStateCondition(QUEST_SLOT, "rejected")), + new QuestNotInStateCondition(QUEST_SLOT, 0, "rejected")), ConversationStates.ATTENDING, "Hello, my name is Annie. I am five years old.", null); @@ -109,7 +110,7 @@ private void icecreamStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "start"), + new QuestInStateCondition(QUEST_SLOT, 0, "start"), new PlayerHasItemWithHimCondition("icecream")), ConversationStates.IDLE, "Mummy says I mustn't talk to you any more. You're a stranger.", @@ -119,7 +120,7 @@ private void icecreamStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "start"), + new QuestInStateCondition(QUEST_SLOT, 0, "start"), new NotCondition(new PlayerHasItemWithHimCondition("icecream"))), ConversationStates.ATTENDING, "Hello. I'm hungry.", @@ -129,7 +130,7 @@ private void icecreamStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "mummy"), + new QuestInStateCondition(QUEST_SLOT, 0, "mummy"), new PlayerHasItemWithHimCondition("icecream")), ConversationStates.QUESTION_1, "Yummy! Is that ice cream for me?", @@ -139,7 +140,7 @@ private void icecreamStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "mummy"), + new QuestInStateCondition(QUEST_SLOT, 0, "mummy"), new NotCondition(new PlayerHasItemWithHimCondition("icecream"))), ConversationStates.ATTENDING, "Hello. I'm hungry.", @@ -150,8 +151,8 @@ private void icecreamStep() { ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), new QuestStartedCondition(QUEST_SLOT), - new QuestNotInStateCondition(QUEST_SLOT, "start"), - new QuestNotInStateCondition(QUEST_SLOT, "mummy")), + new QuestNotInStateCondition(QUEST_SLOT, 0, "start"), + new QuestNotInStateCondition(QUEST_SLOT, 0, "mummy")), ConversationStates.ATTENDING, "Hello.", null); @@ -160,7 +161,7 @@ private void icecreamStep() { npc.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(npc.getName()), - new QuestInStateCondition(QUEST_SLOT, "rejected")), + new QuestInStateCondition(QUEST_SLOT, 0, "rejected")), ConversationStates.ATTENDING, "Hello.", null); @@ -211,7 +212,7 @@ private void icecreamStep() { null, ConversationStates.ATTENDING, "Thank you!", - new SetQuestAction(QUEST_SLOT, "start")); + new SetQuestAction(QUEST_SLOT, 0, "start")); // Player says no, they've lost karma npc.add(ConversationStates.QUEST_OFFERED, @@ -219,15 +220,16 @@ private void icecreamStep() { null, ConversationStates.IDLE, "Ok, I'll ask my mummy instead.", - new SetQuestAndModifyKarmaAction(QUEST_SLOT, "rejected", -5.0)); + new SetQuestAndModifyKarmaAction(QUEST_SLOT, 0, "rejected", -5.0)); // Player has got ice cream and spoken to mummy final List reward = new LinkedList(); reward.add(new DropItemAction("icecream")); reward.add(new EquipItemAction("present")); reward.add(new IncreaseXPAction(500)); - reward.add(new SetQuestAction(QUEST_SLOT, "eating;")); - reward.add(new SetQuestToTimeStampAction(QUEST_SLOT,1)); + reward.add(new SetQuestAction(QUEST_SLOT, 0, "eating")); + reward.add(new SetQuestToTimeStampAction(QUEST_SLOT, 1)); + reward.add(new IncrementQuestAction(QUEST_SLOT, 2, 1)); reward.add(new IncreaseKarmaAction(10.0)); reward.add(new InflictStatusOnNPCAction("icecream")); @@ -270,10 +272,10 @@ private void meetMummyStep() { mummyNPC.add(ConversationStates.IDLE, ConversationPhrases.GREETING_MESSAGES, new AndCondition(new GreetingMatchesNameCondition(mummyNPC.getName()), - new QuestInStateCondition(QUEST_SLOT, "start")), + new QuestInStateCondition(QUEST_SLOT, 0, "start")), ConversationStates.ATTENDING, "Hello, I see you've met my daughter Annie. I hope she wasn't too demanding. You seem like a nice person.", - new SetQuestAction(QUEST_SLOT, "mummy")); + new SetQuestAction(QUEST_SLOT, 0, "mummy")); // any other state mummyNPC.add(ConversationStates.IDLE, @@ -287,7 +289,7 @@ public void addToWorld() { fillQuestInfo( "Ice Cream for Annie", "The best surprise for a litte girl like Annie is a cool ice cream on summer days while playing on the playground.", - true); + true, 2); icecreamStep(); meetMummyStep(); } @@ -300,14 +302,14 @@ public List getHistory(final Player player) { return res; } res.add("Annie Jones is a sweet little girl playing in Kalavan city gardens."); - final String questState = player.getQuest(QUEST_SLOT); + final String questState = player.getQuest(QUEST_SLOT, 0); if ("rejected".equals(questState)) { res.add("I don't like sweet little girls."); } - if (player.isQuestInState(QUEST_SLOT, "start","mummy") || isCompleted(player)) { + if (player.isQuestInState(QUEST_SLOT, 0, "start","mummy") || isCompleted(player)) { res.add("Little Annie wants an ice cream."); } - if (player.isQuestInState(QUEST_SLOT, "start","mummy") && player.isEquipped("icecream") || isCompleted(player)) { + if (player.isQuestInState(QUEST_SLOT, 0, "start","mummy") && player.isEquipped("icecream") || isCompleted(player)) { res.add("I found a tasty ice cream for Annie."); } if ("mummy".equals(questState) || isCompleted(player)) { diff --git a/tests/games/stendhal/server/maps/quests/ChocolateForElisabethTest.java b/tests/games/stendhal/server/maps/quests/ChocolateForElisabethTest.java index aa07f259d2a..8eb48ee35f3 100644 --- a/tests/games/stendhal/server/maps/quests/ChocolateForElisabethTest.java +++ b/tests/games/stendhal/server/maps/quests/ChocolateForElisabethTest.java @@ -1,5 +1,5 @@ /*************************************************************************** - * (C) Copyright 2003-2016 - Stendhal * + * (C) Copyright 2003-2024 - Stendhal * *************************************************************************** *************************************************************************** * * @@ -106,7 +106,7 @@ public void testRefuseQuest() { en.step(player, "no"); assertEquals(LIZ_TALK_QUEST_REJECT, getReply(npc)); - assertEquals("rejected", player.getQuest(questSlot)); + assertEquals("rejected", player.getQuest(questSlot, 0)); assertFalse(npc.isTalking()); assertLoseKarma(5); assertHistory(HISTORY_DEFAULT, HISTORY_REJECTED); @@ -123,13 +123,13 @@ public void testAcceptQuest() { en.step(player, "yes"); assertEquals(LIZ_TALK_QUEST_ACCEPT, getReply(npc)); - assertEquals("start", player.getQuest(questSlot)); + assertEquals("start", player.getQuest(questSlot, 0)); assertHistory(HISTORY_DEFAULT, HISTORY_START); } @Test public void testAskForQuestAlreadyAccepted() { - player.setQuest(questSlot, "start"); + player.setQuest(questSlot, 0, "start"); String responseToGreeting = startTalkingToNpc(ELISABETH); assertEquals(LIZ_TALK_GREETING_WITHOUT_CHOCOLATE, responseToGreeting); @@ -137,23 +137,23 @@ public void testAskForQuestAlreadyAccepted() { en.step(player, "quest"); assertEquals(LIZ_TALK_QUEST_ALREADY_OFFERED, getReply(npc)); - assertEquals("start", player.getQuest(questSlot)); + assertEquals("start", player.getQuest(questSlot, 0)); assertHistory(HISTORY_DEFAULT, HISTORY_START); } @Test public void testFoundChocolate() { - player.setQuest(questSlot, "start"); + player.setQuest(questSlot, 0, "start"); equipWithItem(player, CHOCOLATE); - assertEquals("start", player.getQuest(questSlot)); + assertEquals("start", player.getQuest(questSlot, 0)); assertHistory(HISTORY_DEFAULT, HISTORY_START, HISTORY_GOT_CHOCOLATE); } @Test public void testBringChocolateBeforeTalkingToMum() { - player.setQuest(questSlot, "start"); + player.setQuest(questSlot, 0, "start"); equipWithItem(player, CHOCOLATE); @@ -161,18 +161,18 @@ public void testBringChocolateBeforeTalkingToMum() { assertEquals(LIZ_TALK_GREETING_WITH_CHOCOLATE_NOT_ALLOWED, responseToGreeting); assertTrue(player.isEquipped(CHOCOLATE)); - assertEquals("start", player.getQuest(questSlot)); + assertEquals("start", player.getQuest(questSlot, 0)); assertHistory(HISTORY_DEFAULT, HISTORY_START, HISTORY_GOT_CHOCOLATE); } @Test public void testTalkToMumAfterQuestStart() { - player.setQuest(questSlot, "start"); + player.setQuest(questSlot, 0, "start"); String responseToGreeting = startTalkingToNpc(CAREY); assertEquals(MUM_TALK_GREET_AND_APPROVE, responseToGreeting); - assertEquals("mummy", player.getQuest(questSlot)); + assertEquals("mummy", player.getQuest(questSlot, 0)); assertHistory(HISTORY_DEFAULT, HISTORY_START, HISTORY_MUM_APPROVES); } @@ -189,7 +189,7 @@ public void testTalkToMumBeforeQuestStart() { @Test public void testBringChocolateAfterTalkingToMum() { - player.setQuest(questSlot, "mummy"); + player.setQuest(questSlot, 0, "mummy"); equipWithItem(player, CHOCOLATE); @@ -208,7 +208,7 @@ public void testBringChocolateAfterTalkingToMum() { @Test public void testRefuseToGiveChocolate() { - player.setQuest(questSlot, "mummy"); + player.setQuest(questSlot, 0, "mummy"); equipWithItem(player, CHOCOLATE); @@ -221,13 +221,13 @@ public void testRefuseToGiveChocolate() { assertTrue(player.isEquipped(CHOCOLATE)); assertFalse(isEquippedWithFlower()); assertLoseKarma(5); - assertEquals("mummy", player.getQuest(questSlot)); + assertEquals("mummy", player.getQuest(questSlot, 0)); assertHistory(HISTORY_DEFAULT, HISTORY_START, HISTORY_GOT_CHOCOLATE, HISTORY_MUM_APPROVES); } @Test public void testAskQuestAgain() { - player.setQuest(questSlot, "eating"); + player.setQuest(questSlot, 0, "eating"); PlayerTestHelper.setPastTime(player, questSlot, 1, TimeUnit.HOURS.toSeconds(1)); String responseToGreeting = startTalkingToNpc(ELISABETH); @@ -236,13 +236,13 @@ public void testAskQuestAgain() { en.step(player, "quest"); assertEquals(LIZ_TALK_QUEST_OFFER_AGAIN, getReply(npc)); - assertTrue(player.getQuest(questSlot).startsWith("eating")); + assertTrue(player.getQuest(questSlot).startsWith("eating;")); assertHistory(HISTORY_DEFAULT, HISTORY_START, HISTORY_GOT_CHOCOLATE, HISTORY_MUM_APPROVES, HISTORY_REPEATABLE); } @Test public void testAskQuestAgaintTooSoon() { - player.setQuest(questSlot, "eating"); + player.setQuest(questSlot, 0, "eating"); PlayerTestHelper.setPastTime(player, questSlot, 1, TimeUnit.MINUTES.toSeconds(30)); String responseToGreeting = startTalkingToNpc(ELISABETH); @@ -251,13 +251,13 @@ public void testAskQuestAgaintTooSoon() { en.step(player, "quest"); assertEquals(LIZ_TALK_QUEST_NOT_NOW, getReply(npc)); - assertTrue(player.getQuest(questSlot).startsWith("eating")); + assertTrue(player.getQuest(questSlot).startsWith("eating;")); assertHistory(HISTORY_DEFAULT, HISTORY_START, HISTORY_GOT_CHOCOLATE, HISTORY_MUM_APPROVES, HISTORY_DONE); } @Test public void testAskQuestAgainAndAccept() { - player.setQuest(questSlot, "eating"); + player.setQuest(questSlot, 0, "eating"); PlayerTestHelper.setPastTime(player, questSlot, 1, TimeUnit.HOURS.toSeconds(1)); String responseToGreeting = startTalkingToNpc(ELISABETH); @@ -268,7 +268,7 @@ public void testAskQuestAgainAndAccept() { en.step(player, "yes"); - assertEquals("start", player.getQuest(questSlot)); + assertEquals("start", player.getQuest(questSlot, 0)); assertHistory(HISTORY_DEFAULT, HISTORY_START); } diff --git a/tests/games/stendhal/server/maps/quests/IcecreamForAnnieTest.java b/tests/games/stendhal/server/maps/quests/IcecreamForAnnieTest.java index 98dff3e9f36..3f9198fffcf 100644 --- a/tests/games/stendhal/server/maps/quests/IcecreamForAnnieTest.java +++ b/tests/games/stendhal/server/maps/quests/IcecreamForAnnieTest.java @@ -1,6 +1,6 @@ /* $Id$ */ /*************************************************************************** - * (C) Copyright 2003-2023 - Stendhal * + * (C) Copyright 2003-2024 - Stendhal * *************************************************************************** *************************************************************************** * * @@ -89,7 +89,7 @@ public void testQuest() { assertEquals("I'm hungry! I'd like an ice cream, please. Vanilla, with a chocolate flake. Will you get me one?", getReply(npc)); en.step(player, "ok"); assertEquals("Thank you!", getReply(npc)); - assertThat(player.getQuest(questSlot), is("start")); + assertThat(player.getQuest(questSlot, 0), is("start")); en.step(player, "bye"); assertEquals("Ta ta.", getReply(npc)); @@ -137,7 +137,7 @@ public void testQuest() { en.step(player, "hi"); assertEquals("Hello, I see you've met my daughter Annie. I hope she wasn't too demanding. You seem like a nice person.", getReply(npc)); - assertThat(player.getQuest(questSlot), is("mummy")); + assertThat(player.getQuest(questSlot, 0), is("mummy")); en.step(player, "task"); assertEquals("Nothing, thank you.", getReply(npc)); en.step(player, "bye"); @@ -156,7 +156,7 @@ public void testQuest() { assertTrue(player.isEquipped("present")); assertThat(player.getXP(), greaterThan(xp)); assertThat(player.getKarma(), greaterThan(karma)); - assertTrue(player.getQuest(questSlot).startsWith("eating")); + assertTrue(player.getQuest(questSlot).startsWith("eating;")); assertEquals("Thank you EVER so much! You are very kind. Here, take this present.", getReply(npc)); en.step(player, "bye"); assertEquals("Ta ta.", getReply(npc)); @@ -174,13 +174,13 @@ public void testQuest() { // ----------------------------------------------- final double newKarma = player.getKarma(); // [15:07] Changed the state of quest 'icecream_for_annie' from 'eating;1219676807283' to 'eating;0' - player.setQuest(questSlot, "eating;0"); + player.setQuest(questSlot, 1, "0"); en.step(player, "hi"); assertEquals("Hello.", getReply(npc)); en.step(player, "task"); assertEquals("I hope another ice cream wouldn't be greedy. Can you get me one?", getReply(npc)); en.step(player, "no"); - assertThat(player.getQuest(questSlot), is("rejected")); + assertThat(player.getQuest(questSlot, 0), is("rejected")); assertThat(player.getKarma(), lessThan(newKarma)); assertEquals("Ok, I'll ask my mummy instead.", getReply(npc));