Files
discord-decomp/modules/quests/BountyStore.tsx
T
2026-11-01 12:12:55 +02:00

113 lines
3.0 KiB
TypeScript

// Metro module 5984 (f5985).
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c3779_0 = false;
const bounties = [];
let c3779_2 = new Set();
let c3779_3 = new Set();
let c3779_4 = new Map();
let c3779_5 = new Map();
class BountyStore extends Module589.Store {
static displayName = "BountyStore";
get isFetchingQuestHomeBounties() {
return c3779_0;
}
get questHomeBounties() {
return bounties;
}
isBountyCompleted(a0) {
return c3779_2.has(a0);
}
getCompletedBountyCount(a0) {
let r0 = 0;
for (const item of a0) {
if (c3779_2.has(item.id)) {
r0 = r0 + 1;
}
}
return r0;
}
isClaimingBountyReward(a0) {
return c3779_3.has(a0);
}
areAllBountiesCompleted() {
return bounties.every((bounty) => c3779_2.has(bounty.id));
}
getAdDecisionByPlacementAndAdCreativeId(a0, a1) {
const r5 = c3779_4.get(a0);
let r7 = r5 == null ? void 0 : r5.get(a1);
if (r7 == null) {
r7 = null;
}
return r7;
}
getBountyVideoProgress(a0) {
let r5 = c3779_5.get(a0);
if (r5 == null) {
r5 = null;
}
return r5;
}
}
const bountyStore = new BountyStore(Dispatcher, {
LOGOUT: function handleLogout() {
c3779_0 = false;
bounties = [];
c3779_2 = new Set();
c3779_3 = new Set();
c3779_4 = new Map();
c3779_5 = new Map();
},
BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_BEGIN: function handleFetchQuestHomeBountiesBegin() {
c3779_0 = true;
},
BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_SUCCESS: function handleFetchQuestHomeBountiesSuccess({ bounties: bounties2, placement, adDecisionsByAdCreativeId }) {
c3779_0 = false;
bounties = bounties2;
c3779_2 = new Set();
c3779_5 = new Map();
const map = new Map(c3779_4);
c3779_4 = map;
map.set(placement, adDecisionsByAdCreativeId);
},
BOUNTIES_FETCH_QUEST_HOME_BOUNTIES_FAILURE: function handleFetchQuestHomeBountiesFailure({ placement }) {
c3779_0 = false;
bounties = [];
c3779_2 = new Set();
const map = new Map(c3779_4);
c3779_4 = map;
map.delete(placement);
},
BOUNTIES_CLAIM_REWARD_BEGIN: function handleClaimBountyRewardBegin({ bountyId }) {
const set = new Set(c3779_3);
set.add(bountyId);
c3779_3 = set;
},
BOUNTIES_CLAIM_REWARD_SUCCESS: function handleClaimBountyRewardSuccess({ bountyId }) {
const set = new Set(c3779_3);
set.delete(bountyId);
c3779_3 = set;
const set2 = new Set(c3779_2);
set2.add(bountyId);
c3779_2 = set2;
},
BOUNTIES_CLAIM_REWARD_FAILURE: function handleClaimBountyRewardFailure({ bountyId }) {
const set = new Set(c3779_3);
set.delete(bountyId);
c3779_3 = set;
},
BOUNTIES_VIDEO_PROGRESS_UPDATE: function handleBountyVideoProgressUpdate({ bountyId, timestampSec, maxTimestampSec, duration }) {
const map = new Map(c3779_5);
map.set(bountyId, {
timestampSec,
maxTimestampSec,
duration
});
c3779_5 = map;
},
AD_SESSION_RESET: function handleAdSessionReset() {
c3779_5 = new Map();
}
});
export default bountyStore;