Implemented upgrades

This commit is contained in:
2018-11-05 22:20:56 +11:00
parent 8077d260da
commit fef937da78
3 changed files with 83 additions and 5 deletions

View File

@@ -111,7 +111,7 @@ function printUpgrades(user, channel) {
.setColor(client.guilds.get(process.env.SANCTUM_ID).roles.find(role => role.name === "NPC").color) //NOTE: probably a better way to do this
.setTitle("Nanotech Upgrades")
.setDescription(dialog("upgradeText"))
.setFooter(`${user.username}, you have ${stats.wallet} crystals. Use !upgrade [OPTION] to buy.`); //TODO: move this to dialog?
.setFooter(`${user.username}, you have ${stats.upgradePoints} cannisters. Use !upgrade [OPTION] to upgrade.`); //TODO: move this to dialog?
shared.SendPublicMessage(client, user, channel, dialog("upgradeHeading"));
channel.send({ embed });
@@ -120,6 +120,36 @@ function printUpgrades(user, channel) {
shared.OnServerData("userStats", handleResponse, user.id);
}
function processUpgradeCommand(uset, channel, args) {
//TODO
function processUpgradeCommand(user, channel, args) {
//parse the stat to upgrade
let statToUpgrade;
switch(String(args[0]).toLowerCase()) {
case "str":
case "strength":
statToUpgrade = "strength";
break;
case "spd":
case "speed":
statToUpgrade = "speed";
break;
case "stam":
case "stamina":
statToUpgrade = "stamina";
break;
case "hp":
case "health":
statToUpgrade = "health";
break;
}
if (typeof(statToUpgrade) === "undefined") {
shared.SendPublicMessage(client, user, channel, dialog("upgradeParseError"));
return;
}
let handleResponse = function(response, suffix) {
shared.SendPublicMessage(client, user, channel, dialog(response, statToUpgrade, suffix));
}
shared.OnServerData("upgrade", handleResponse, user.id, statToUpgrade);
}

View File

@@ -1,7 +1,12 @@
{
"upgradeHeading": "Hey buddy! Here's what we can upgrade ASAP!",
"upgradeText": "STR - :cannister: **1**\n```Permanently upgrades your Strength by 1, so you can hit them Ravagers harder.```\nSPD - :cannister: **1**\n```Permanently upgrades your Speed by 1, so you can get hit less in battle.```\nSTAM - :cannister: **1**\n```Permanently upgrades your Max Stamina by 1, so you can hit more Ravagers.```\nHP - :cannister: **1**\n```Permanently upgrades your Max HP by 10, so you can can take those beatings like a champ.```",
"upgradeText": "STR - :cannister: **1**\n```Permanently upgrades your Strength by 1, so you can hit them Ravagers harder.```\nSPD - :cannister: **1**\n```Permanently upgrades your Speed by 1, so you can get hit less in battle.```\nSTAM - :cannister: **1**\n```Permanently upgrades your Max Stamina by 1, so you can hit more Ravagers.```\nHP - :cannister: **1**\n```Permanently upgrades your Max HP by 10, so you can take those beatings like a champ.```",
"upgradeSuccess": "Sweet! I used your Nanotech Cannister to upgrade your **{1}** by {2}!",
"upgradeFailure": "Sorry, no can do right now. Come back later though, ok?",
"upgradeNotEnoughPoints": "Hey now, you don't have that many cannisters.",
"upgradeParseError": "Believe me, I wish I could upgrade things like that.",
"noResult": "I have no idea what you just said."
}