diff --git a/datasources/maps.js b/datasources/maps.js index c01dd37f..ff0951a9 100644 --- a/datasources/maps.js +++ b/datasources/maps.js @@ -88,6 +88,16 @@ class MapAPI extends WorkerKV { return false; }); } + + async getLootContainer(context, id) { + await this.init(context); + return this.cache.LootContainer[id]; + } + + async getAllLootContainers(context) { + await this.init(context); + return Object.values(this.cache.LootContainer); + } } module.exports = MapAPI; diff --git a/resolvers/mapResolver.js b/resolvers/mapResolver.js index f2582e55..d86b6872 100644 --- a/resolvers/mapResolver.js +++ b/resolvers/mapResolver.js @@ -18,6 +18,10 @@ module.exports = { } return context.util.paginate(bosses, args); }, + async lootContainers(obj, args, context, info) { + let containers = context.data.map.getAllLootContainers(context); + return context.util.paginate(containers, args); + }, async maps(obj, args, context, info) { let maps = false; let filters = { @@ -50,6 +54,16 @@ module.exports = { return context.data.item.getItem(context, data.key); }, }, + LootContainer: { + name(data, args, context, info) { + return context.data.map.getLocale(data.name, context, info); + }, + }, + LootContainerPosition: { + lootContainer(data, args, context, info) { + return context.data.map.getLootContainer(context, data.lootContainer); + }, + }, Map: { accessKeys(data, args, context, info) { return context.data.item.getItemsByIDs(context, data.accessKeys); diff --git a/schema.js b/schema.js index d6e2bf03..923a4dc3 100644 --- a/schema.js +++ b/schema.js @@ -659,6 +659,17 @@ type Lock { #terrainElevation: Float } +type LootContainer { + id: ID! + name: String! + normalizedName: String! +} + +type LootContainerPosition { + lootContainer: LootContainer + position: MapPosition +} + type Map { id: ID! tarkovDataId: ID @@ -677,6 +688,7 @@ type Map { extracts: [MapExtract] locks: [Lock] hazards: [MapHazard] + lootContainers: [LootContainerPosition] #svg: MapSvg } @@ -1220,6 +1232,7 @@ type Query { items(ids: [ID], name: String, names: [String], type: ItemType, types: [ItemType], categoryNames: [ItemCategoryName], handbookCategoryNames: [HandbookCategoryName] bsgCategoryId: String, bsgCategoryIds: [String], bsgCategory: String, lang: LanguageCode, limit: Int, offset: Int): [Item]! itemCategories(lang: LanguageCode, limit: Int, offset: Int): [ItemCategory]! handbookCategories(lang: LanguageCode, limit: Int, offset: Int): [ItemCategory]! + lootContainers(lang: LanguageCode, limit: Int, offset: Int): [LootContainer] maps(lang: LanguageCode, name: [String!], enemies: [String!], limit: Int, offset: Int): [Map]! questItems(lang: LanguageCode): [QuestItem] status: ServerStatus!