@@ -49,7 +49,12 @@ import {
4949 HandleEventOptions ,
5050} from "@peacockproject/statemachine-parser"
5151import { ChallengeContext , SavedChallengeGroup } from "../types/challenges"
52- import { fastClone , gameDifficulty , isSniperLocation } from "../utils"
52+ import {
53+ fastClone ,
54+ gameDifficulty ,
55+ isSniperLocation ,
56+ ServerVer ,
57+ } from "../utils"
5358import {
5459 ChallengeFilterOptions ,
5560 ChallengeFilterType ,
@@ -64,6 +69,8 @@ import { SyncHook } from "../hooksImpl"
6469import { getUserEscalationProgress } from "../contracts/escalations/escalationService"
6570
6671import { getUnlockableById } from "../inventory"
72+ import { enqueueEvent } from "../eventHandler"
73+ import { randomUUID } from "crypto"
6774
6875type ChallengeDefinitionLike = {
6976 Context ?: Record < string , unknown >
@@ -1820,19 +1827,25 @@ export class ChallengeService extends ChallengeRegistry {
18201827 log ( LogLevel . DEBUG , `Challenge ${ challenge . Id } completed` )
18211828 }
18221829
1823- this . onContractEvent (
1824- {
1825- Value : {
1826- ChallengeId : challenge . Id ,
1827- } ,
1828- ContractSessionId : session . Id ,
1829- ContractId : session . contractId ,
1830- Name : "ChallengeCompleted" ,
1831- // The timestamp (used for timers) is not important here, since it's not an event sent by the game.
1832- Timestamp : 0 ,
1830+ const event = {
1831+ Value : {
1832+ ChallengeId : challenge . Id ,
1833+ ChallengeTags : challenge . Tags ,
18331834 } ,
1834- session ,
1835- )
1835+ ContractSessionId : session . Id ,
1836+ ContractId : session . contractId ,
1837+ Name : "ChallengeCompleted" ,
1838+ // The timestamp (used for timers) is not important here, since it's not an event sent by the game.
1839+ Timestamp : 0 ,
1840+ }
1841+
1842+ this . onContractEvent ( event , session )
1843+
1844+ enqueueEvent ( userId , {
1845+ ...event ,
1846+ Id : randomUUID ( ) ,
1847+ Version : ServerVer ,
1848+ } )
18361849
18371850 const userData = getUserData ( userId , gameVersion )
18381851
0 commit comments