Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fomorian/Razorback construction and Events #125

Merged
merged 16 commits into from
Sep 20, 2017
29 changes: 29 additions & 0 deletions src/embeds/ConstructionEmbed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

const BaseEmbed = require('./BaseEmbed.js');

/**
* Generates daily deal embeds
*/
class ConstructionEmbed extends BaseEmbed {
/**
* @param {Genesis} bot - An instance of Genesis
* @param {Construction} constructionProgress - The current construction information
* @param {string} platform - The platform the event is for
*/
constructor(bot, constructionProgress, platform) {
super();

this.color = 0xff6961;
this.fields = [{
name: `[${platform}] Construction Status:`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

value: '```' +

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

`Razorback: ${construction.razorbackProgress}` +

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'construction' is not defined. (no-undef)

`Fomorian: ${construction.fomorianProgress}` +

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'construction' is not defined. (no-undef)

`Unknown: ${construction.unknwonProgress}` +

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'construction' is not defined. (no-undef)

'```'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing trailing comma. (comma-dangle)

}];
}
}

module.exports = ConstructionEmbed;
91 changes: 34 additions & 57 deletions src/embeds/EventEmbed.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,34 @@
'use strict';

const BaseEmbed = require('./BaseEmbed.js');

/**
* Generates fissure embeds
*/
class EventEmbed extends BaseEmbed {
/**
* @param {Genesis} bot - An instance of Genesis
* @param {Array.<Event>} events - The fissures to be included in the embed
*/
constructor(bot, events) {
super();

if (events.length < 2) {
this.title = 'Worldstate - Events';
this.description = 'Events';
}

if (events.length > 1) {
this.fields = events.map(e => ({
name: `${e.description}`,
value: `Takes place on: ${e.concurrentNodes.join(', ')}\nRewards: ${e.rewards.join(', ')}`,
}));
} else if (events.length === 0) {
this.fields = {
name: 'Currently no events',
value: '_ _',
};
} else {
const e = events[0];
this.title = 'Event! ';
this.description = `${e.description} against ${e.faction}`;
this.fields = [
{
name: 'Rewards',
value: e.rewards.join('\n'),
inline: true,
},
{
name: 'Nodes',
value: `${e.concurrentNodes.join('\n')}\n${e.node ? e.node : ''}\n${e.victimNode ? e.victimNode : ''}`,
inline: true,
},
];
this.footer.text = e.toolTip ? e.toolTip : this.footer.text;
}

this.color = events.length > 2 ? 0x00ff00 : 0xff0000;
this.thumbnail = {
url: 'https://i.imgur.com/EfIRu6v.png',
};
}
}

module.exports = EventEmbed;
'use strict';

const BaseEmbed = require('./BaseEmbed.js');

/**
* Generates daily deal embeds
*/
class EventEmbed extends BaseEmbed {
/**
* @param {Genesis} bot - An instance of Genesis
* @param {Event} event - The deal to be included in the embed
* @param {string} platform - The platform the event is for
*/
constructor(bot, event, platform) {
super();

this.color = 0xfdec96;

if (event) {
this.title = `[${platform}] ${event.description}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

this.fields = [];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)


if (event.victimNode) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

this.fields.push({name: '_ _', value: `Defend ${event.victimNode} by attacking the ${event.faction} at ${event.node}.` });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 10 spaces but found 12. (indent)
A space is required after '{'. (object-curly-spacing)

}
this.fields.push({ name: 'Rewards', value: event.rewards.map(reward => reward.asString).join('; ') });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

this.fields.push({ name: 'Completion Score', value: String(event.maximumScore) });

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

} else {
this.title = 'No Current Events';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected indentation of 6 spaces but found 8. (indent)

}
}
}

module.exports = EventEmbed;