-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
123 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
const Command = require('../../models/Command'); | ||
const CambionEmbed = require('../../embeds/CambionEmbed'); | ||
const { captures } = require('../../CommonFunctions'); | ||
|
||
class Cambion extends Command { | ||
constructor(bot) { | ||
super(bot, 'warframe.worldstate.cambion', 'cambion', 'Display the currently active Cambion info', 'WARFRAME'); | ||
this.regex = new RegExp(`^${this.call}s?\\s?(?:on\\s+${captures.platforms})?`, 'i'); | ||
} | ||
|
||
async run(message, ctx) { | ||
const platformParam = message.strippedContent.match(captures.platforms); | ||
const platform = platformParam && platformParam.length ? platformParam[0] : ctx.platform; | ||
const entrati = (await this.ws.get('syndicateMissions', platform, ctx.language)) | ||
.filter(m => m.syndicate === 'EntratiSyndicate'); | ||
const cambion = await this.ws.get('cambionCycle', platform, ctx.language); | ||
if (entrati && entrati.length) { | ||
[cambion.bounty] = entrati; | ||
} | ||
|
||
// make the embed | ||
this.messageManager.embed(message, new CambionEmbed(this.bot, cambion), true, true); | ||
return this.messageManager.statuses.SUCCESS; | ||
} | ||
} | ||
|
||
module.exports = Cambion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
'use strict'; | ||
|
||
const BaseEmbed = require('./BaseEmbed.js'); | ||
|
||
const { | ||
timeDeltaToString, fromNow, assetBase, toTitleCase, | ||
} = require('../CommonFunctions.js'); | ||
|
||
const fass = `${assetBase}/img/FassBanner.png`; | ||
const vome = `${assetBase}/img/VomeBanner.png`; | ||
|
||
const makeJobs = (mission) => { | ||
if (mission && mission.jobs && mission.jobs.length) { | ||
const tokens = []; | ||
mission.jobs.forEach((job) => { | ||
const totalStanding = job.standingStages.reduce((a, b) => a + b, 0); | ||
const levels = job.enemyLevels.join(' - '); | ||
const rewards = job.rewardPool instanceof Array ? job.rewardPool.join(' • ') : ''; | ||
tokens.push(`\u200B \\⬆ ${totalStanding} - ${job.type} (${levels})`); | ||
if (job.rewardPool[0] && !job.rewardPool[0].startsWith('Pattern Mismatch.')) { | ||
tokens.push(`\\💰 ${rewards}\n`); | ||
} | ||
}); | ||
|
||
tokens.push(`\n**Expires in ${mission.eta}**`); | ||
|
||
return tokens.join('\n'); | ||
} | ||
return undefined; | ||
}; | ||
|
||
class CambionEmbed extends BaseEmbed { | ||
constructor(bot, state) { | ||
super(); | ||
|
||
this.title = `Cambion Drift Cycle - ${toTitleCase(state.active)}`; | ||
this.color = state.active === 'fass' ? 0xC6733F : 0x415B9E; | ||
this.thumbnail = { | ||
url: state.active === 'fass' ? fass : vome, | ||
}; | ||
|
||
const next = toTitleCase(state.active === 'fass' ? 'vome' : 'fass'); | ||
|
||
const nextCtd = `Time remaining until ${next}: ${timeDeltaToString(fromNow(new Date(state.expiry)))}`; | ||
this.description = `${state.bounty ? makeJobs(state.bounty) : ''}\n\n${nextCtd}`; | ||
|
||
this.footer.text = `${next} starts `; | ||
this.timestamp = new Date(state.expiry); | ||
} | ||
} | ||
|
||
module.exports = CambionEmbed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters