mirror of
https://github.com/chase-manning/pokemon-js.git
synced 2025-11-05 18:38:59 +00:00
🚀 add quest for entering museum
This commit is contained in:
parent
b97af4798c
commit
7861ebe37f
1 changed files with 35 additions and 3 deletions
|
|
@ -1,8 +1,14 @@
|
|||
import { useDispatch } from "react-redux";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { MapId } from "../maps/map-types";
|
||||
import useBadges from "./use-badges";
|
||||
import { setPos } from "../state/gameSlice";
|
||||
import { setBlackScreen } from "../state/uiSlice";
|
||||
import {
|
||||
completeQuest,
|
||||
selectCompletedQuests,
|
||||
selectPos,
|
||||
setPos,
|
||||
takeMoney,
|
||||
} from "../state/gameSlice";
|
||||
import { setBlackScreen, showConfirmationMenu } from "../state/uiSlice";
|
||||
|
||||
export interface QuestType {
|
||||
trigger: "talk" | "walk";
|
||||
|
|
@ -21,6 +27,8 @@ export const useActiveMapQuests = (map: MapId) => {
|
|||
const useQuests = () => {
|
||||
const dispatch = useDispatch();
|
||||
const badges = useBadges();
|
||||
const completedQuests = useSelector(selectCompletedQuests);
|
||||
const pos = useSelector(selectPos);
|
||||
|
||||
const quests: QuestType[] = [
|
||||
// Pewter City
|
||||
|
|
@ -48,6 +56,30 @@ const useQuests = () => {
|
|||
}, 600);
|
||||
},
|
||||
},
|
||||
{
|
||||
trigger: "walk",
|
||||
map: MapId.PewterCityMuseum1f,
|
||||
positions: {
|
||||
4: [9, 10],
|
||||
},
|
||||
active: () => !completedQuests.includes("pewter-museum-1f-paid"),
|
||||
text: ["It's $50 for a child's ticket."],
|
||||
action: () => {
|
||||
dispatch(
|
||||
showConfirmationMenu({
|
||||
preMessage: "Would you like to come in?",
|
||||
postMessage: "Right $50! Thank you!",
|
||||
confirm: () => {
|
||||
dispatch(completeQuest("pewter-museum-1f-paid"));
|
||||
dispatch(takeMoney(50));
|
||||
},
|
||||
cancel: () => {
|
||||
dispatch(setPos({ x: pos.x, y: pos.y + 1 }));
|
||||
},
|
||||
})
|
||||
);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
return quests;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue