Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions datasources/tasks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,21 @@ class TasksAPI extends WorkerKV {
}
return Promise.reject(new GraphQLError(`No achievement with id ${id} found`));
}

async getPrestiges(context, info) {
const { cache } = await this.getCache(context, info);
return cache.Prestige;
}

async getPrestige(context, info, id) {
const prestiges = await this.getPrestiges(context, info);
for (const prestige of prestiges) {
if (prestige.id === id) {
return prestige;
}
}
return Promise.reject(new GraphQLError(`No prestiges with id ${id} found`));
}
}

export default TasksAPI;
18 changes: 9 additions & 9 deletions http/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"dependencies": {
"@graphql-tools/merge": "9.1.1",
"@graphql-tools/schema": "10.0.25",
"graphql-yoga": "^5.15.1",
"graphql-yoga": "^5.16.0",
"dotenv": "^16.4.5",
"uuid": "^11.1.0"
"uuid": "^13.0.0"
},
"nodemonConfig": {
"watch": ["../", "*.mjs", ".env"],
Expand Down
83 changes: 80 additions & 3 deletions resolvers/taskResolver.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ export default {
achievements(obj, args, context, info) {
return context.util.paginate(context.data.worker.task.getAchievements(context, info), args);
},
prestige(obj, args, context, info) {
return context.util.paginate(context.data.worker.task.getPrestiges(context, info), args);
},
async tasks(obj, args, context, info) {
let tasks = await context.data.worker.task.getList(context, info);
if (args.faction) {
Expand Down Expand Up @@ -40,6 +43,33 @@ export default {
return context.data.worker.task.getLocale(data.rarity, context, info);
},
},
CustomizationItem: {
__resolveType(data, args, context) {
return data.__typename;
},
},
CustomizationItemBasic: {
name(data, args, context, info) {
return context.data.worker.task.getLocale(data.name, context, info);
},
customizationTypeName(data, args, context, info) {
return context.data.worker.task.getLocale(data.customizationTypeName, context, info);
},
},
CustomizationItems: {
name(data, args, context, info) {
return context.data.worker.task.getLocale(data.name, context, info);
},
customizationTypeName(data, args, context, info) {
return context.data.worker.task.getLocale(data.customizationTypeName, context, info);
},
items(data, args, context, info) {
if (!data.items?.length) {
return [];
}
return data.items.map(id => context.data.worker.item.getItem(context, info, id));
},
},
HealthEffect: {
bodyParts(data, args, context, info) {
if (data.bodyParts.length === 0) {
Expand All @@ -59,6 +89,24 @@ export default {
return context.data.worker.map.get(context, info, data.map);
},
},
Prestige: {
name(data, args, context, info) {
return context.data.worker.task.getLocale(data.name, context, info);
},
},
PrestigeTransferSettings: {
__resolveType(data, args, context) {
if (data.gridWidth) {
return 'PrestigeTransferSettingsStash';
}
return 'PrestigeTransferSettingsSkill';
},
},
PrestigeTransferSettingsSkill: {
name(data, args, context, info) {
return context.data.worker.task.getLocale(data.name, context, info);
},
},
SkillLevel: {
skill(data, args, context, info) {
return context.data.worker.handbook.getSkill(context, info, data.name);
Expand All @@ -77,7 +125,13 @@ export default {
map(data, args, context, info) {
if (data.location_id) return context.data.worker.map.get(context, info, data.location_id);
return null;
}
},
requiredPrestige(data, args, context, info) {
if (!data.requiredPrestige) {
return null;
}
return context.data.worker.task.getPrestige(context, info, data.requiredPrestige)
},
},
TaskKey: {
keys(data, args, context, info) {
Expand All @@ -95,12 +149,14 @@ export default {
//return data.gql_type;
if (data.type === 'findQuestItem' || data.type === 'giveQuestItem' || data.type === 'plantQuestItem') {
return 'TaskObjectiveQuestItem';
} else if (data.type === 'findItem' || data.type === 'giveItem' || data.type === 'plantItem' || data.type === 'sellItem') {
} else if (data.type === 'findItem' || data.type === 'giveItem' || data.type === 'plantItem' || data.type === 'sellItem' || data.type === 'haveItem') {
return 'TaskObjectiveItem';
} else if (data.type === 'mark') {
return 'TaskObjectiveMark';
} else if (data.type === 'extract') {
return 'TaskObjectiveExtract';
} else if (data.type === 'hideoutStation') {
return 'TaskObjectiveHideoutStation';
} else if (data.type === 'skill') {
return 'TaskObjectiveSkill';
} else if (data.type === 'traderLevel') {
Expand Down Expand Up @@ -210,6 +266,14 @@ export default {
return data.requiredKeys.map(keyIds => keyIds.map(keyId => context.data.worker.item.getItem(context, info, keyId)));
},
},
TaskObjectiveHideoutStation: {
hideoutStation(data, args, context, info) {
return context.data.worker.hideout.getStation(context, info, data.station);
},
maps(data, args, context, info) {
return [];
}
},
TaskObjectiveItem: {
item(data, args, context, info) {
return context.data.worker.item.getItem(context, info, data.item);
Expand Down Expand Up @@ -449,7 +513,20 @@ export default {
return true;
});
}).filter(Boolean);
}
},
async achievement(data, args, context, info) {
if (!data.achievement?.length) {
return [];
}
const achievements = await context.data.worker.task.getAchievements(context, info);
return data.achievement.map(id => {
const achievement = achievements.find(a => a.id === id);
if (!achievement) {
return false;
}
return achievement;
}).filter(Boolean);
},
},
TaskStatusRequirement: {
task(data, args, context, info) {
Expand Down
65 changes: 65 additions & 0 deletions schema-static.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,31 @@ type Craft {
requirements: [PriceRequirement]! @deprecated(reason: "Use stationLevel instead.")
}

interface CustomizationItem {
id: ID!
name: String!
customizationType: String!
customizationTypeName: String!
imageLink: String
}

type CustomizationItemBasic implements CustomizationItem {
id: ID!
name: String!
customizationType: String!
customizationTypeName: String!
imageLink: String
}

type CustomizationItems implements CustomizationItem {
id: ID!
name: String!
customizationType: String!
customizationTypeName: String!
imageLink: String
items: [Item]!
}

type GameProperty {
key: String!
numericValue: Float
Expand Down Expand Up @@ -935,6 +960,31 @@ type PlayerLevel {
levelBadgeImageLink: String
}

type Prestige {
id: ID!
name: String
prestigeLevel: Int
imageLink: String
iconLink: String
conditions: [TaskObjective]
rewards: TaskRewards
transferSettings: [PrestigeTransferSettings]
}

union PrestigeTransferSettings = PrestigeTransferSettingsStash | PrestigeTransferSettingsSkill

type PrestigeTransferSettingsStash {
gridWidth: Int
gridHeight: Int
itemFilters: ItemFilters
}

type PrestigeTransferSettingsSkill {
name: String
skillType: String
transferRate: Float
}

type PriceRequirement {
type: RequirementType!
value: Int
Expand Down Expand Up @@ -1084,6 +1134,7 @@ type Task {
failureOutcome: TaskRewards
restartable: Boolean
factionName: String
requiredPrestige: Prestige
neededKeys: [TaskKey] @deprecated(reason: "Use requiredKeys on objectives instead.")
kappaRequired: Boolean
lightkeeperRequired: Boolean
Expand Down Expand Up @@ -1158,6 +1209,17 @@ type TaskObjectiveExtract implements TaskObjective {
requiredKeys: [[Item]]
}

type TaskObjectiveHideoutStation implements TaskObjective {
id: ID
type: String!
description: String!
#locationNames: [String]!
maps: [Map]!
optional: Boolean!
hideoutStation: HideoutStation
stationLevel: Int
}

type TaskObjectiveItem implements TaskObjective {
id: ID
type: String!
Expand Down Expand Up @@ -1304,6 +1366,8 @@ type TaskRewards {
skillLevelReward: [SkillLevel]!
traderUnlock: [Trader]!
craftUnlock: [Craft]!
achievement: [Achievement]!
customization: [CustomizationItem]
}

type TaskStatusRequirement {
Expand Down Expand Up @@ -1452,6 +1516,7 @@ type Query {
fleaMarket(lang: LanguageCode, gameMode: GameMode): FleaMarket!
armorMaterials(lang: LanguageCode): [ArmorMaterial]!
playerLevels: [PlayerLevel]!
prestige(lang: LanguageCode, gameMode: GameMode): [Prestige]!
skills(lang: LanguageCode): [Skill]!
mastering(lang: LanguageCode): [Mastering]!
hideoutModules: [HideoutModule] @deprecated(reason: "Use hideoutStations instead.")
Expand Down
Loading