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

Duplicate quests after I died #55195

Closed
hexagonrecursion opened this issue Feb 7, 2022 · 2 comments · Fixed by #63125
Closed

Duplicate quests after I died #55195

hexagonrecursion opened this issue Feb 7, 2022 · 2 comments · Fixed by #63125
Labels
Missions Quests and missions (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@hexagonrecursion
Copy link
Contributor

Describe the bug

#53606 introduced the ability to continue the game as one of your follower NPCs after you die. Unfortunately this breaks the active quests somehow - the quest giver forgets she or he gave you the quest and gives it to you again.

Steps to reproduce

  1. Spawn an NPC and debug mind control her or him
  2. Spawn a second NPC and get a mission from him or her
  3. Die the slow and painful way (otherwise continuing as a follower does not trigger)
  4. Continue the game as your follower
  5. Talk to the other NPC
  6. Notice that she or he reacts as if you did not accept the mission
  7. Accept the mission
  8. Now you have two identical missions
    DeepinScreenshot_select-area_20220207204655
  9. Complete the mission
  10. Now you have one completed mission and one permanently stuck "active"

Expected behavior

I expected to pick up where I left off - active missions stay active and can be continued and completed as normal

Screenshots

No response

Versions and configuration

  • OS: Linux
    • OS Version: LSB Version: :core-4.1-amd64:core-4.1-noarch; Distributor ID: Fedora; Description: Fedora release 34 (Thirty Four); Release: 34; Codename: ThirtyFour;
  • Game Version: ea101df [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Graphical Overmap [Graphical_Overmap]
    ]

Additional context

No response

@hexagonrecursion
Copy link
Contributor Author

Here is what happens in the save JSON (note: the first quest giver refused to talk to me so I had to spawn a second one):

save-diff.sh
#!/usr/bin/env bash

set -euo pipefail

OLD="$1"  # e.g. ./save/foo.bac
NEW="$2"  # e.g. ./save/foo
PLAYER="$3"  # e.g. #cGxheWVy.sav
OVERMAP="$4"  # e.g. o.-1.1


WORKDIR="$(mktemp -d --suffix .save-diff)"
mkdir "$WORKDIR"/old "$WORKDIR"/new

function master_gsav() {
	sed 1d "$1"/master.gsav \
	| jq '
		.active_missions
		| sort_by(.type_id)
		| .[]
		| {type_id, status, uid, npc_id, player_id}
	'
}
master_gsav "$OLD" > "$WORKDIR"/old/master.gsav
master_gsav "$NEW" > "$WORKDIR"/new/master.gsav

function sav() {
	sed 1d "$1" \
	| jq '
		.player
		| { id, name, active_missions, completed_missions, failed_missions }
	'
}
sav "$OLD/$PLAYER" > "$WORKDIR/old/$PLAYER"
sav "$NEW/$PLAYER" > "$WORKDIR/new/$PLAYER"

function overmap() {
	sed 1d "$1" \
	| jq '
		.npcs
		| sort_by(.id)
		| .[]
		| {
			id,
			name,
			chatbin: .chatbin | {
				missions, missions_assigned
			}
		}
	'
}
overmap "$OLD/$OVERMAP" > "$WORKDIR/old/$OVERMAP"
overmap "$NEW/$OVERMAP" > "$WORKDIR/new/$OVERMAP"

(cd "$WORKDIR" && diff -u100 old new)

The save files I used to reproduce this

$ ~/save-diff.sh 0.spawn-2-npcs/ 1.accept-a-quest/ '#cGxheWVy.sav' 'o.-1.1'
diff -u100 old/#cGxheWVy.sav new/#cGxheWVy.sav
--- old/#cGxheWVy.sav	2022-02-09 11:50:46.138000000 +0300
+++ new/#cGxheWVy.sav	2022-02-09 11:50:46.185000000 +0300
@@ -1,7 +1,9 @@
 {
   "id": 1,
   "name": "player",
-  "active_missions": [],
+  "active_missions": [
+    3
+  ],
   "completed_missions": [],
   "failed_missions": []
 }
diff -u100 old/master.gsav new/master.gsav
--- old/master.gsav	2022-02-09 11:50:46.039000000 +0300
+++ new/master.gsav	2022-02-09 11:50:46.089000000 +0300
@@ -1,21 +1,21 @@
 {
   "type_id": "MISSION_GET_INHALER",
-  "status": "yet_to_start",
+  "status": "in_progress",
   "uid": 3,
   "npc_id": 4,
-  "player_id": -1
+  "player_id": 1
 }
 {
   "type_id": "MISSION_LEARN_ABOUT_CATTAIL_JELLY",
   "status": "yet_to_start",
   "uid": 2,
   "npc_id": 3,
   "player_id": -1
 }
 {
   "type_id": "MISSION_PYROMANIAC",
   "status": "yet_to_start",
   "uid": 1,
   "npc_id": 2,
   "player_id": -1
 }
diff -u100 old/o.-1.1 new/o.-1.1
--- old/o.-1.1	2022-02-09 11:50:46.288000000 +0300
+++ new/o.-1.1	2022-02-09 11:50:46.390000000 +0300
@@ -1,20 +1,20 @@
 {
   "id": 2,
   "name": "follower",
   "chatbin": {
     "missions": [
       1
     ],
     "missions_assigned": []
   }
 }
 {
   "id": 4,
   "name": "quest giver",
   "chatbin": {
-    "missions": [
+    "missions": [],
+    "missions_assigned": [
       3
-    ],
-    "missions_assigned": []
+    ]
   }
 }
$ ~/save-diff.sh 1.accept-a-quest/ 2.die/ '#cGxheWVy.sav' 'o.-1.1'
diff -u100 old/#cGxheWVy.sav new/#cGxheWVy.sav
--- old/#cGxheWVy.sav	2022-02-09 11:50:57.114000000 +0300
+++ new/#cGxheWVy.sav	2022-02-09 11:50:57.165000000 +0300
@@ -1,9 +1,9 @@
 {
-  "id": 1,
-  "name": "player",
+  "id": 2,
+  "name": "follower",
   "active_missions": [
     3
   ],
   "completed_missions": [],
   "failed_missions": []
 }
diff -u100 old/master.gsav new/master.gsav
--- old/master.gsav	2022-02-09 11:50:57.015000000 +0300
+++ new/master.gsav	2022-02-09 11:50:57.067000000 +0300
@@ -1,21 +1,21 @@
 {
   "type_id": "MISSION_GET_INHALER",
   "status": "in_progress",
   "uid": 3,
   "npc_id": 4,
-  "player_id": 1
+  "player_id": -1
 }
 {
   "type_id": "MISSION_LEARN_ABOUT_CATTAIL_JELLY",
   "status": "yet_to_start",
   "uid": 2,
   "npc_id": 3,
   "player_id": -1
 }
 {
   "type_id": "MISSION_PYROMANIAC",
   "status": "yet_to_start",
   "uid": 1,
   "npc_id": 2,
   "player_id": -1
 }
diff -u100 old/o.-1.1 new/o.-1.1
--- old/o.-1.1	2022-02-09 11:50:57.271000000 +0300
+++ new/o.-1.1	2022-02-09 11:50:57.377000000 +0300
@@ -1,20 +1,10 @@
 {
-  "id": 2,
-  "name": "follower",
-  "chatbin": {
-    "missions": [
-      1
-    ],
-    "missions_assigned": []
-  }
-}
-{
   "id": 4,
   "name": "quest giver",
   "chatbin": {
     "missions": [],
     "missions_assigned": [
       3
     ]
   }
 }
$ ~/save-diff.sh 2.die/ 3.accept-again/ '#cGxheWVy.sav' 'o.-1.1'
diff -u100 old/#cGxheWVy.sav new/#cGxheWVy.sav
--- old/#cGxheWVy.sav	2022-02-09 11:51:04.810000000 +0300
+++ new/#cGxheWVy.sav	2022-02-09 11:51:04.864000000 +0300
@@ -1,9 +1,10 @@
 {
   "id": 2,
   "name": "follower",
   "active_missions": [
+    3,
     3
   ],
   "completed_missions": [],
   "failed_missions": []
 }
diff -u100 old/master.gsav new/master.gsav
--- old/master.gsav	2022-02-09 11:51:04.707000000 +0300
+++ new/master.gsav	2022-02-09 11:51:04.758000000 +0300
@@ -1,21 +1,21 @@
 {
   "type_id": "MISSION_GET_INHALER",
   "status": "in_progress",
   "uid": 3,
   "npc_id": 4,
-  "player_id": -1
+  "player_id": 2
 }
 {
   "type_id": "MISSION_LEARN_ABOUT_CATTAIL_JELLY",
   "status": "yet_to_start",
   "uid": 2,
   "npc_id": 3,
   "player_id": -1
 }
 {
   "type_id": "MISSION_PYROMANIAC",
   "status": "yet_to_start",
   "uid": 1,
   "npc_id": 2,
   "player_id": -1
 }
$ ~/save-diff.sh 3.accept-again/ 4.complete/ '#cGxheWVy.sav' 'o.-1.1'
diff -u100 old/#cGxheWVy.sav new/#cGxheWVy.sav
--- old/#cGxheWVy.sav	2022-02-09 11:51:14.154000000 +0300
+++ new/#cGxheWVy.sav	2022-02-09 11:51:14.208000000 +0300
@@ -1,10 +1,11 @@
 {
   "id": 2,
   "name": "follower",
   "active_missions": [
-    3,
     3
   ],
-  "completed_missions": [],
+  "completed_missions": [
+    3
+  ],
   "failed_missions": []
 }
diff -u100 old/master.gsav new/master.gsav
--- old/master.gsav	2022-02-09 11:51:14.043000000 +0300
+++ new/master.gsav	2022-02-09 11:51:14.105000000 +0300
@@ -1,21 +1,21 @@
 {
   "type_id": "MISSION_GET_INHALER",
-  "status": "in_progress",
+  "status": "success",
   "uid": 3,
   "npc_id": 4,
   "player_id": 2
 }
 {
   "type_id": "MISSION_LEARN_ABOUT_CATTAIL_JELLY",
   "status": "yet_to_start",
   "uid": 2,
   "npc_id": 3,
   "player_id": -1
 }
 {
   "type_id": "MISSION_PYROMANIAC",
   "status": "yet_to_start",
   "uid": 1,
   "npc_id": 2,
   "player_id": -1
 }
diff -u100 old/o.-1.1 new/o.-1.1
--- old/o.-1.1	2022-02-09 11:51:14.317000000 +0300
+++ new/o.-1.1	2022-02-09 11:51:14.434000000 +0300
@@ -1,10 +1,8 @@
 {
   "id": 4,
   "name": "quest giver",
   "chatbin": {
     "missions": [],
-    "missions_assigned": [
-      3
-    ]
+    "missions_assigned": []
   }
 }

@Maleclypse Maleclypse added Missions Quests and missions (S2 - Confirmed) Bug that's been confirmed to exist labels Feb 14, 2022
@Maleclypse
Copy link
Member

@Ramza13 I tagged you since you were the last person I saw working on transferring to NPC on death.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missions Quests and missions (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants