Skip to content

Commit

Permalink
Merge 8483d6a into ec2c04f
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno committed Dec 17, 2021
2 parents ec2c04f + 8483d6a commit 55dc6e6
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 5,907 deletions.
36 changes: 30 additions & 6 deletions lib/SyndicateJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const fetch = require('node-fetch');
const WorldstateObject = require('./WorldstateObject');

const apiBase = process.env.API_BASE_URL || 'https://api.warframestat.us';
const bountyRewardRegex = /Tier([ABCDE])Table([ABC])Rewards/i;
const bountyRewardRegex = /(?:Tier([ABCDE])|Narmer)Table([ABC])Rewards/i;
const ghoulRewardRegex = /GhoulBountyTable([AB])Rewards/i;

/**
Expand Down Expand Up @@ -75,17 +75,20 @@ const getBountyRewards = async (i18n, isVault, raw) => {
return [];
};

const FIFTY_MINUTES = 3000000;

/**
* Represents a syndicate daily mission
* @extends {WorldstateObject}
*/
class SyndicateJob extends WorldstateObject {
/**
* @param {Object} data The syndicate mission data
* @param {Date} expiry The syndicate job expiration
* @param {Object} deps The dependencies object
* @param {Translator} deps.translator The string translator
* @param {string} deps.locale Locale to use for translations
* @param {Object} data The syndicate mission data
* @param {Date} expiry The syndicate job expiration
* @param {Object} deps The dependencies object
* @param {Object} timeDate Time/Date functions
* @param {Translator} translator The string translator
* @param {string} locale Locale to use for translations
*/
constructor(data, expiry, { translator, timeDate, locale }) {
super({ _id: { $oid: data.JobCurrentVersion ? data.JobCurrentVersion.$oid : `${(data.jobType || '').split('/').slice(-1)[0]}${expiry.getTime()}` } }, { timeDate });
Expand Down Expand Up @@ -141,6 +144,27 @@ class SyndicateJob extends WorldstateObject {
* @type {string|null}
*/
this.locationTag = data.locationTag;

/**
* End time for the syndicate mission.
* Should be inherited from the Syndicate, but some are timebound.
* @type {Date}
*/
this.expiry = expiry;

/**
* What time phase this bounty is bound to
* @type {string}
*/
this.timeBound = undefined;
if (data.jobType && data.jobType.toLowerCase().includes('narmer')) {
if (data.jobType.toLowerCase().includes('eidolon')) {
this.timeBound = 'day';
this.expiry = new Date(this.expiry.getTime() - FIFTY_MINUTES);
} else {
this.timeBoound = 'night';
}
}
}
}

Expand Down
Loading

0 comments on commit 55dc6e6

Please sign in to comment.