the-hideout / tarkov-dev

The official site for tarkov.dev - A web app to track item prices, view trader barters, quests, maps, and much more!
https://tarkov.dev
MIT License
131 stars 48 forks source link

How to extract Task Objective count from the tarkov.dev API? #855

Closed Discoded closed 4 months ago

Discoded commented 4 months ago

I'm currently trying to bring tarkovdata to parity with the tarkov.dev API. How did you guys obtain the objective counts for each task?

As an example I will use the quest Shortage where we require 3 Salewas From https://tarkov.dev/task/shortage: chrome_BkFQaH8c4y

tarkov.dev API result:

{
    "id": "5967733e86f774602332fc84",
    "name": "Shortage",
    "taskRequirements": [
      {
        "task": {
          "id": "657315ddab5a49b71f098853",
          "name": "First in Line"
        },
        "status": [
          "complete",
          "failed"
        ]
      }
    ],
    "traderRequirements": [],
    "trader": {
      "id": "54cb57776803fa99248b456e",
      "name": "Therapist",
      "normalizedName": "therapist"
    },
    "finishRewards": {
      "traderStanding": [
        {
          "trader": {
            "id": "54cb57776803fa99248b456e",
            "normalizedName": "therapist"
          },
          "standing": 0.03
        }
      ]
    },
    "objectives": [
      {
        "id": "5968edc086f77420d2328014",
        "type": "findItem",
        "description": "Find Salewa first aid kits in raid",
        "maps": [],
        "optional": false
      },
      {
        "id": "59689eb886f7740d137ebfc3",
        "type": "giveItem",
        "description": "Hand over the first aid kits",
        "maps": [],
        "optional": false
      }
    ]
}

Specifically objectives:

"objectives": [
  {
    "id": "5968edc086f77420d2328014",
    "type": "findItem",
    "description": "Find Salewa first aid kits in raid",
    "maps": [],
    "optional": false
  },
  {
    "id": "59689eb886f7740d137ebfc3",
    "type": "giveItem",
    "description": "Hand over the first aid kits",
    "maps": [],
    "optional": false
  }
    ]

There are currently no ways that I have seen from the API to determine the count but I'm new so I may have missed it. If so, please direct me.

For reference this is tarkovdata's objectives for the same quest:

"objectives": [
      {
        "type": "find",
        "target": "544fb45d4bdc2dee738b4568",
        "number": 3,
        "location": -1,
        "id": 39
      }
    ]

Everything else is on the API so it's just a simple map operation. Thanks in advance

Discoded commented 4 months ago

Should be under tarkov-api.

It seems like there was an API Overhaul https://github.com/the-hideout/tarkov-api/pull/29.

Deprecated QuestObjective:

type QuestObjective {
  id: String
  type: String!
  target: [String!]
  targetItem: Item
  number: Int
  location: String
}

TaskObjective available on the api:

interface TaskObjective {
  id: ID
  type: String!
  description: String!
  locationNames: [String]!
  optional: Boolean!
}

Not available on the api but in progress(?):


type TaskObjectiveItem implements TaskObjective {
  id: ID
  type: String!
  description: String!
  locationNames: [String]!
  optional: Boolean!
  questi: Item!
  count: Int!
  foundInRaid: Boolean!
  dogTagLevel: Int
  maxDurability: Int
  minDurability: Int
}