mirror of
https://github.com/thepeacockproject/Peacock
synced 2025-02-16 16:34:28 +01:00
refactor: clean up
Removing pointless spread operators and removes some unsafe stuff
This commit is contained in:
parent
705ad8cfed
commit
20948671dc
@ -533,8 +533,8 @@ export abstract class ChallengeRegistry {
|
||||
return parseContextListeners(
|
||||
challenge.Definition?.ContextListeners || {},
|
||||
{
|
||||
...(Context || challenge.Definition?.Context || {}),
|
||||
...(challenge.Definition?.Constants || {}),
|
||||
...(Context || challenge.Definition?.Context),
|
||||
...challenge.Definition?.Constants,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -105,10 +105,8 @@ contractRoutingRouter.post(
|
||||
req.gameVersion,
|
||||
)
|
||||
: {}),
|
||||
...(loadoutData || {}),
|
||||
...{
|
||||
OpportunityData: getContractOpportunityData(req, contractData),
|
||||
},
|
||||
...loadoutData,
|
||||
OpportunityData: getContractOpportunityData(req, contractData),
|
||||
}
|
||||
|
||||
// Edit usercreated contract data HERE
|
||||
|
@ -95,7 +95,7 @@ async function findEndpoint(tries = 0): Promise<string> {
|
||||
}
|
||||
|
||||
return findEndpoint(tries + 1)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
return findEndpoint(tries + 1)
|
||||
}
|
||||
}
|
||||
@ -138,7 +138,7 @@ function decode(socket: net.Socket, callback): void {
|
||||
callback({ op, data })
|
||||
working.full = ""
|
||||
working.op = undefined
|
||||
} catch (err) {
|
||||
} catch {
|
||||
working.full += raw
|
||||
}
|
||||
|
||||
|
@ -205,10 +205,8 @@ menuDataRouter.get(
|
||||
|
||||
data = {
|
||||
...data,
|
||||
...{
|
||||
Name: pack ? pack.Name : location.DisplayNameLocKey,
|
||||
Location: location,
|
||||
},
|
||||
Name: pack ? pack.Name : location.DisplayNameLocKey,
|
||||
Location: location,
|
||||
}
|
||||
} else {
|
||||
data = {
|
||||
|
@ -209,13 +209,11 @@ export function getAllGameDestinations(
|
||||
|
||||
const template: GameFacingDestination = {
|
||||
...getDestinationCompletion(parent, undefined, gameVersion, userId),
|
||||
...{
|
||||
CompletionData: generateCompletionData(
|
||||
destination,
|
||||
userId,
|
||||
gameVersion,
|
||||
),
|
||||
},
|
||||
CompletionData: generateCompletionData(
|
||||
destination,
|
||||
userId,
|
||||
gameVersion,
|
||||
),
|
||||
}
|
||||
|
||||
// TODO: THIS IS NOT CORRECT FOR 2016!
|
||||
@ -379,7 +377,7 @@ export function getDestination(
|
||||
gameVersion,
|
||||
userId,
|
||||
),
|
||||
...{ SubLocationMissionsData: [] },
|
||||
SubLocationMissionsData: [],
|
||||
},
|
||||
ChallengeData: {
|
||||
Children:
|
||||
@ -510,16 +508,14 @@ export function getDestination(
|
||||
}
|
||||
|
||||
const types = [
|
||||
...[
|
||||
[undefined, "Missions"],
|
||||
["elusive", "ElusiveMissions"],
|
||||
],
|
||||
...((gameVersion === "h1" &&
|
||||
// @ts-expect-error Hack.
|
||||
missionsInLocations.sarajevo["h2016enabled"]) ||
|
||||
gameVersion === "h3"
|
||||
? [["sarajevo", "SarajevoSixMissions"]]
|
||||
: []),
|
||||
[undefined, "Missions"],
|
||||
["elusive", "ElusiveMissions"],
|
||||
]
|
||||
|
||||
for (const t of types) {
|
||||
|
@ -187,7 +187,7 @@ export async function handleOAuthToken(
|
||||
gameVersion,
|
||||
)
|
||||
).toString()
|
||||
} catch (e) {
|
||||
} catch {
|
||||
req.body.pId = randomUUID()
|
||||
await writeExternalUserData(
|
||||
external_userid,
|
||||
|
@ -432,7 +432,7 @@ export function calculateSniperScore(
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const baseScore = (contractSession.scoring?.Context as any)["TotalScore"]
|
||||
const baseScore = (contractSession.scoring?.Context as any)?.["TotalScore"]
|
||||
// @ts-expect-error it's a number
|
||||
const challengeMultiplier = contractSession.scoring?.Settings["challenges"][
|
||||
"Unlockables"
|
||||
|
@ -100,7 +100,7 @@ export async function checkForUpdates(): Promise<void> {
|
||||
"updates",
|
||||
)
|
||||
}
|
||||
} catch (e) {
|
||||
} catch {
|
||||
log(LogLevel.WARN, "Failed to check for updates!", "updates")
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ webFeaturesRouter.get(
|
||||
|
||||
try {
|
||||
await loadUserData(req.query.user, req.query.gv)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
formErrorMessage(res, "Failed to load user data.")
|
||||
return
|
||||
}
|
||||
@ -253,7 +253,7 @@ webFeaturesRouter.get(
|
||||
async (req: CommonRequest, res) => {
|
||||
try {
|
||||
await loadUserData(req.query.user, req.query.gv)
|
||||
} catch (e) {
|
||||
} catch {
|
||||
formErrorMessage(res, "Failed to load user data.")
|
||||
return
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ import axios from "axios"
|
||||
* @param gameVersion
|
||||
* @returns {Promise<*>}
|
||||
*/
|
||||
async function fetchHitsCategoryPage(axiosClient, type, page, gameVersion) {
|
||||
async function fetchHitsCategoryPage(axiosClient, type, page) {
|
||||
console.log(`${pc.blue`Fetching hits category `}${type} page ${page}...`)
|
||||
|
||||
const url = `/profiles/page/HitsCategory?page=${page}&type=${type}&mode=dataonly`
|
||||
|
@ -204,7 +204,11 @@ export function EscalationLevelPicker({
|
||||
<section className="app-grid">
|
||||
{Object.keys(final).map((val) => {
|
||||
return (
|
||||
<div className="container" style={{ padding: "15px" }}>
|
||||
<div
|
||||
className="container"
|
||||
style={{ padding: "15px" }}
|
||||
key={val}
|
||||
>
|
||||
<h1>{val}</h1>
|
||||
{final[val].map((row, index) => (
|
||||
<div className="row" key={index}>
|
||||
|
Loading…
Reference in New Issue
Block a user