UNPKG

ggejs

Version:

A powerful Node.js module for interacting with the server of Goodgame Empire & Goodgame Empire: Four Kingdoms

22 lines (20 loc) 707 B
const Lord = require("../../structures/Lord"); module.exports.name = "gli"; /** * @param {BaseClient} client * @param {number} errorCode * @param {{B: Object[], C: Object[]}} params */ module.exports.execute = function (client, errorCode, params) { const barons = parseLords(client, params.B).sort((l1, l2) => l1.pictureId - l2.pictureId); const commanders = parseLords(client, params.C).sort((l1, l2) => l1.pictureId - l2.pictureId); client.equipments._setCommandersAndBarons(barons, commanders); } /** * @param {BaseClient} client * @param {Object[]} data * @return {Lord[]} */ function parseLords(client, data) { return data.map(l => new Lord(client, l)); }