Skip to content

Commit

Permalink
Merge pull request #557 from the-hideout/add-ro
Browse files Browse the repository at this point in the history
Add Romanian
  • Loading branch information
Razzmatazzz authored Aug 29, 2024
2 parents 4fb08b8 + 724db5e commit 727cc0a
Show file tree
Hide file tree
Showing 16 changed files with 195 additions and 60 deletions.
90 changes: 90 additions & 0 deletions src/tarkov-data-manager/data/changed_quests.json
Original file line number Diff line number Diff line change
Expand Up @@ -1333,5 +1333,95 @@
"zoneKeys": ["bunker1"]
}
}
},
"639872fc93ae507d5858c3a6": {
"name": "Gunsmith - Part 11",
"finishRewardsAdded": {
"offerUnlock": [
{
"id": "66c46c37f7ca8a539f08613a1",
"trader_id": "6617beeaa9cfa777ca915b7c",
"trader_name": "Ref",
"level": 2,
"item": "5dd800eae49222636663133b",
"item_name": "M4A1 SAI",
"count": 1,
"contains": [],
"attributes": []
}
]
}
},
"6179b3bdc7560e13d23eeb8d": {
"name": "Corporate Secrets",
"finishRewardsAdded": {
"offerUnlock": [
{
"id": "66c1beadfa6e5a0c120f0c481",
"trader_id": "6617beeaa9cfa777ca915b7c",
"trader_name": "Ref",
"level": 2,
"item": "618ab04934aa2e47480fba2b",
"item_name": "AK-104 RPKT mod.1",
"count": 1,
"contains": [],
"attributes": []
}
]
}
},
"6179b3a12153c15e937d52bc": {
"name": "Energy Crisis",
"finishRewardsAdded": {
"offerUnlock": [
{
"id": "66c1beaffa6e5a0c120f0dff1",
"trader_id": "6617beeaa9cfa777ca915b7c",
"trader_name": "Ref",
"level": 3,
"item": "619e61e70459e93c12392ba7",
"item_name": "FN SCAR-L 5.56x45 assault rifle (FDE) Contract Wars",
"count": 1,
"contains": [],
"attributes": []
}
]
}
},
"639872f9decada40426d3447": {
"name": "Gunsmith - Part 4",
"finishRewardsAdded": {
"offerUnlock": [
{
"id": "66c1beb0fa6e5a0c120f0e461",
"trader_id": "6617beeaa9cfa777ca915b7c",
"trader_name": "Ref",
"level": 1,
"item": "5a8ae65f86f774377a23ed55",
"item_name": "PP-19-01 Vityaz 9x19 submachine gun Zenit",
"count": 1,
"contains": [],
"attributes": []
}
]
}
},
"5b47891f86f7744d1b23c571": {
"name": "Living High Is Not a Crime - Part 1",
"finishRewardsAdded": {
"offerUnlock": [
{
"id": "66c46c36f7ca8a539f08600d5",
"trader_id": "6617beeaa9cfa777ca915b7c",
"trader_name": "Ref",
"level": 4,
"item": "65766582234b9f6e050a42c1",
"item_name": "IOTV Gen4 body armor (High Mobility Kit, MultiCam) Default",
"count": 1,
"contains": [],
"attributes": []
}
]
}
}
}
2 changes: 1 addition & 1 deletion src/tarkov-data-manager/data/missing_quests.json
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@
"tarkovDataId": null,
"factionName": "Any"
},
"6574e0dedc0d635f633a5805": {
"_6574e0dedc0d635f633a5805": {
"id": "6574e0dedc0d635f633a5805",
"name": "Test Drive - Part 4",
"trader": "54cb50c76803fa8b248b4571",
Expand Down
8 changes: 0 additions & 8 deletions src/tarkov-data-manager/jobs/archive-prices.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ class ArchivePricesJob extends DataJob {
const today = new Date();
let cutoff = new Date(new Date().setDate(today.getDate() - 30));
cutoff.setUTCHours(0, 0, 0, 0);
// if we wanted to keep all prices since start of wipe
/*const wipes = await this.query('SELECT * FROM wipe ORDER BY start_date desc limit 1');
if (wipes.length > 0) {
const currentWipe = wipes[0];
if (currentWipe.start_date < cutoff) {
cutoff = currentWipe.start_date;
}
}*/

// archive max_days_per_run number of days
for (let i = 0; i < max_days_per_run; i++) {
Expand Down
63 changes: 31 additions & 32 deletions src/tarkov-data-manager/jobs/check-scanners.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,41 @@ class CheckScansJob extends DataJob {
return;
}

const scanTypes = {
player: '',
trader: 'trader_',
};

const scanCutoff = new Date() - (1000 * 60 * 15);
const dateNow = DateTime.now();
for (const scanner of scanners) {
for (const gameMode of gameModes) {
let prefix = '';
if (gameMode.name !== 'regular') {
prefix = 'pve_';
}
if (scanner[`${prefix}last_scan`]?.getTime() ?? 0 < scanCutoff) {
this.logger.log(`${scanner.name} hasn't scanned ${gameMode.name} player prices ${dateNow.toRelative({ base: DateTime.fromJSDate(scanner[`${prefix}last_scan`]) })}; releasing any batches`);
this.query(`
UPDATE
item_data
SET
${prefix}checkout_scanner_id = NULL
WHERE
${prefix}checkout_scanner_id = ?;
`, [scanner.id]).catch(error => {
this.logger.error(`Error clearing ${gameMode.name} player batches for ${scanner.name}: ${error.message}`);
});
}
if (scanner[`${prefix}_trader_last_scan`]?.getTime() < scanCutoff) {
this.logger.log(`${scanner.name} hasn't scanned ${gameMode.name} trader prices ${dateNow.toRelative({ base: DateTime.fromJSDate(scanner[`${prefix}_trader_last_scan`]) })}; releasing any batches`);
this.query(`
UPDATE
item_data
SET
trader_checkout_scanner_id = NULL
WHERE
trader_checkout_scanner_id = ?;
`, [scanner.id]).catch(error => {
this.logger.error(`Error clearing ${gameMode.name} trader batches for ${scanner.name}: ${error.message}`);
});
const activeTraderScan = activeTraderScans.find(s => s.game_mode === gameMode.value);
if (activeTraderScan?.scanner_id === scanner.id) {
scannerApi.setTraderScanScanner(gameMode.name, null);
for (const scanTypeName in scanTypes) {
let prefix = '';
if (gameMode.name !== 'regular') {
prefix = 'pve_';
}
prefix += scanTypes[scanTypeName];
if (scanner[`${prefix}last_scan`]?.getTime() < scanCutoff) {
this.logger.log(`${scanner.name} hasn't scanned ${gameMode.name} ${scanTypeName} prices ${dateNow.toRelative({ base: DateTime.fromJSDate(scanner[`${prefix}last_scan`]) })}; releasing any batches`);
this.query(`
UPDATE
item_data
SET
${prefix}checkout_scanner_id = NULL
WHERE
${prefix}checkout_scanner_id = ?;
`, [scanner.id]).catch(error => {
this.logger.error(`Error clearing ${gameMode.name} ${scanTypeName} batches for ${scanner.name}: ${error.message}`);
});
if (scanTypeName === 'trader') {
const activeTraderScan = activeTraderScans[gameMode.name];
if (activeTraderScan?.scanner_id === scanner.id) {
scannerApi.setTraderScanScanner(gameMode.name, null);
}
}
} else {
this.logger.log(`${scanner.name} last scanned ${gameMode.name} ${scanTypeName} prices ${dateNow.toRelative({ base: DateTime.fromJSDate(scanner[`${prefix}last_scan`]) })}`);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tarkov-data-manager/jobs/start-trader-scan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class StartTraderScanJob extends DataJob {
}

async run() {
const traderScanGameModes = ['pve'];
const traderScanGameModes = ['regular', 'pve'];
for (const gameMode of this.gameModes) {
if (!traderScanGameModes.includes(gameMode.name)) {
continue;
Expand Down
13 changes: 12 additions & 1 deletion src/tarkov-data-manager/jobs/update-crafts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@ class UpdateCraftsJob extends DataJob {
for (const gameMode of this.gameModes) {
const areas = await this.jobOutput('update-hideout', {gameMode: gameMode.name});
const tasks = await this.jobOutput('update-quests', {gameMode: gameMode.name});
const json = await tarkovData.crafts({gameMode: gameMode.name});
const json = await tarkovData.crafts({gameMode: gameMode.name}).then(recipes => {
if (recipes.recipes) {
return recipes.recipes.reduce((crafts, craft) => {
crafts[craft._id] = craft;
return crafts;
}, {});
}
return recipes;
});
this.kvData[gameMode.name] = {
Craft: [],
};
Expand Down Expand Up @@ -218,6 +226,9 @@ class UpdateCraftsJob extends DataJob {
this.logger.log(`❌ ${stationName}: ${inactiveStations[stationName]}`);
}
this.logger.log(`Processed ${this.kvData[gameMode.name].Craft.length} active ${gameMode.name} crafts`);
if (this.kvData[gameMode.name].Craft.length === 0) {
this.discordAlert({ title: 'update-crafts job warning', message: `Found 0 ${gameMode.name} crafts`});
}

let kvName = this.kvName;
if (gameMode.name !== 'regular') {
Expand Down
21 changes: 21 additions & 0 deletions src/tarkov-data-manager/jobs/update-maps.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,27 @@ class UpdateMapsJob extends DataJob {
...extract.location,
};
}),
transits: map.transits.map(transit => {
if (!transit.active) {
return false;
}
const locationData = this.mapDetails[id].transits.find(t => t.id === transit.id);
if (!locationData) {
this.logger.warn(`Could not find location data for ${this.locales.en[transit.description]}`);
return false;
}
let conditions;
if (this.locales.en[transit.conditions ?? '']?.trim()) {
conditions = this.addTranslation(transit.conditions);
}
return {
id: `${transit.id}`,
description: this.addTranslation(`${transit.name}_DESC`),
map: transit.target,
conditions,
...locationData.location,
};
}).filter(Boolean),
locks: this.mapDetails[id].locks.map(lock => {
const keyItem = this.items.get(lock.key);
if (!keyItem || keyItem.types.includes('disabled')) {
Expand Down
14 changes: 11 additions & 3 deletions src/tarkov-data-manager/jobs/update-quests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ class UpdateQuestsJob extends DataJob {
}
await this.loadRewards(questData, 'finishRewards', quest.rewards.Success);
await this.loadRewards(questData, 'startRewards', quest.rewards.Started);
this.loadRewards(questData, 'failureOutcome', quest.rewards.Fail);
await this.loadRewards(questData, 'failureOutcome', quest.rewards.Fail);
if (factionMap[questData.id]) questData.factionName = factionMap[questData.id];
//if (this.missingQuests[questData.id]) delete this.missingQuests[questData.id];

Expand Down Expand Up @@ -1229,12 +1229,15 @@ class UpdateQuestsJob extends DataJob {
zoneKeys: [],
zoneNames: [],
};
if (objective.conditionType === 'FindItem' || objective.conditionType === 'HandoverItem') {
if (objective.conditionType === 'FindItem' || objective.conditionType === 'HandoverItem' || objective.conditionType === 'SellItemToTrader') {
const targetItem = this.items[objective.target[0]];
let verb = 'give';
if (objective.conditionType === 'FindItem' || (objective.conditionType === 'HandoverItem' && obj.optional)) {
verb = 'find';
}
if (objective.conditionType === 'SellItemToTrader') {
verb = 'sell';
}
obj.item_id = objective.target[0];
obj.item_name = this.locales.en[`${objective.target[0]} Name`];
//obj.count = parseInt(objective.value);
Expand All @@ -1248,7 +1251,7 @@ class UpdateQuestsJob extends DataJob {
} else {
obj.type = `${verb}Item`;
obj.item = objective.target[0];
obj.items = objective.target.filter(id => this.itemResults.has(id) && !this.itemResults.get(id).types.includes('disabled'));
obj.items = objective.target.filter(id => this.itemResults.has(id) && !this.itemResults.get(id).types.includes('disabled') && !this.itemResults.get(id).types.includes('quest'));
obj.dogTagLevel = objective.dogtagLevel;
obj.maxDurability = objective.maxDurability;
obj.minDurability = objective.minDurability;
Expand Down Expand Up @@ -1715,6 +1718,11 @@ const skipQuests = [
'6603fe74e773dcf3b0099f88', // The Tarkov Mystery
'6658a15615cbb1b2c6014d5b', // Hustle 2024
'6672ec2a2b6f3b71be794cc5', // A Key to Salvation
'668bcccc167d507eb01a268b', // Import Control
'66a78dada472ad7f845b71f7', // Supply and Demand
'66a74c628410476dd65543be', // Gunsmith - Special Order
'66a75b44243a6548ff5e5ff9', // Gun Connoisseur
'66a77394243a6548ff5e601d', // Customer Communication
];

// Secure Folder 0013 appears on multiple maps
Expand Down
7 changes: 5 additions & 2 deletions src/tarkov-data-manager/jobs/update-trader-assorts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ class UpdateTraderAssortsJob extends DataJob {
cost: assort.barter_scheme[offer._id][0].map(req => {
let reqId = req._tpl;
if (req.side) {
reqId = dogTagSideMap[req.side];
reqId = dogTagSideMap[req.side] ?? reqId;
if (!dogTagSideMap[req.side]) {
console.log(`Invalid side ${req.side} for item ${reqId}`, req);
}
}
return {
item: reqId,
Expand All @@ -109,7 +112,7 @@ class UpdateTraderAssortsJob extends DataJob {
dogTagLevel: req.level,
dogTagSide: req.side,
};
}),
}).filter(Boolean),
};
});
}));
Expand Down
10 changes: 10 additions & 0 deletions src/tarkov-data-manager/jobs/update-traders.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class UpdateTradersJob extends DataJob {
};
this.kvData = {};
const s3Images = s3.getLocalBucketContents();
const staleTraderInterval = 1000 * 60 * 15;
for (const gameMode of this.gameModes) {
this.logger.log(`Processing ${gameMode.name} traders...`);
[this.tradersData, this.globals] = await Promise.all([
Expand All @@ -30,6 +31,7 @@ class UpdateTradersJob extends DataJob {
this.kvData[gameMode.name] = {
Trader: []
};
let staleTraderCount = 0;
for (const traderId in this.tradersData) {
if (skipTraders[gameMode.name]?.includes(traderId)) {
continue;
Expand Down Expand Up @@ -130,8 +132,16 @@ class UpdateTradersJob extends DataJob {
traderData.tarkovDataId = this.tdTraders[traderData.name.toLowerCase()].id;
}
this.kvData[gameMode.name].Trader.push(traderData);
if (date < new Date() && new Date() - date > staleTraderInterval) {
staleTraderCount++;
}
}
this.logger.log(`Processed ${this.kvData[gameMode.name].Trader.length} ${gameMode.name} traders`);

if (staleTraderCount > 0) {
this.logger.warn(`${staleTraderCount} stale traders`);
this.discordAlert({title: 'Stale traders', message: `Running update-traders found ${staleTraderCount} stale ${gameMode.name} traders`});
}

let kvName = this.kvName;
if (gameMode.name !== 'regular') {
Expand Down
2 changes: 1 addition & 1 deletion src/tarkov-data-manager/jobs/update-types.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class UpdateTypesJob extends DataJob {
this.logger.warn(`${itemId} ${item.name} lacks item properties`);
continue;
}
if (item.types.includes('no-flea') && this.bsgData[itemId]._props.CanSellOnRagfair && !this.bsgData[itemId]._parent === '6575ea719c7cad336508e418') {
if (item.types.includes('no-flea') && this.bsgData[itemId]._props.CanSellOnRagfair && this.bsgData[itemId]._parent !== '6575ea719c7cad336508e418') {
this.logger.warn(`You can sell ${itemId} ${item.name} on flea, but it is marked as noFlea`);

await remoteData.removeType(itemId, 'no-flea').then(results => {
Expand Down
7 changes: 1 addition & 6 deletions src/tarkov-data-manager/modules/remote-data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ const methods = {

try {
const itemsPromise = methods.get(refreshItems);

const wipes = await query('SELECT * FROM wipe ORDER BY start_date desc limit 1');
const currentWipe = wipes[0];

const price24hTimer = timer('item-24h-price-query');
const price24hPromise = new Promise(async (resolve, reject) => {
Expand Down Expand Up @@ -166,16 +163,14 @@ const methods = {
game_mode
FROM
price_data
WHERE
timestamp > ?
GROUP BY
item_id, game_mode
) b
ON
a.item_id = b.item_id AND a.timestamp = b.max_timestamp AND a.game_mode = b.game_mode
GROUP BY
a.item_id, a.timestamp, a.game_mode;
`, [currentWipe.start_date]).then(results => {
`).then(results => {
lastLowPriceTimer.end();
return results;
});
Expand Down
Loading

0 comments on commit 727cc0a

Please sign in to comment.