Skip to content

Commit

Permalink
Fixed claim formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Mewtwo2387 committed Nov 8, 2024
1 parent 1448c6b commit a437953
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 56 deletions.
18 changes: 10 additions & 8 deletions commands/claim.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ class Claim extends Command {
async formatReward(skinKey, amount, multiplier, gold, silver, bronze) {
const skin = this.currentSkin[skinKey];

// Round percentages to 1 decimal place
const goldPercentage = (gold * 100).toFixed(1);
const silverPercentage = (silver * 100).toFixed(1);
const bronzePercentage = (bronze * 100).toFixed(1);
const goldPercentage = format(gold * 100, true);
const silverPercentage = format(silver * 100, true);
const bronzePercentage = format(bronze * 100, true);
const goldMultiplier = format(multiplier.gold, true);
const silverMultiplier = format(multiplier.silver, true);
const bronzeMultiplier = format(multiplier.bronze, true);

// Determine appropriate multiplier based on skinKey, defaulting to 1.0 for "regular"
const currentMultiplier = multiplier[skinKey] !== undefined ? multiplier[skinKey] : 1.0;
Expand All @@ -36,13 +38,13 @@ class Claim extends Command {
.replace(/{gold}/g, goldPercentage)
.replace(/{silver}/g, silverPercentage)
.replace(/{bronze}/g, bronzePercentage)
.replace(/{multiplier_gold}/g, multiplier.gold.toFixed(1))
.replace(/{multiplier_silver}/g, multiplier.silver.toFixed(1))
.replace(/{multiplier_bronze}/g, multiplier.bronze.toFixed(1));
.replace(/{multiplier_gold}/g, goldMultiplier)
.replace(/{multiplier_silver}/g, silverMultiplier)
.replace(/{multiplier_bronze}/g, bronzeMultiplier);

return {
amount: amount,
title: skin.title.replace("{amount}", amount).replace("{multiplier}", currentMultiplier.toFixed(1)),
title: skin.title.replace("{amount}", format(amount)).replace("{multiplier}", format(currentMultiplier, true)),
imageUrl: skin.imageUrl,
colour: skin.colour,
footer: formattedFooter,
Expand Down
131 changes: 83 additions & 48 deletions data/config/skin/claim.json
Original file line number Diff line number Diff line change
@@ -1,62 +1,97 @@
{
"halloween": {
"gold": {
"title": "Congratulations! You've claimed a golden dinonuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1168356994453885059/1301101446959468594/Xl7UV4y.png?ex=672340a6&is=6721ef26&hm=3c8f62666d10cfbf3a79d18901a390c42483800864a04a08c51417215a7775aa&=&format=webp&quality=lossless&width=876&height=1169",
"gold": {
"title": "Congratulations! You've claimed a golden gummynuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1168356994453885059/1301101446959468594/Xl7UV4y.png?ex=672340a6&is=6721ef26&hm=3c8f62666d10cfbf3a79d18901a390c42483800864a04a08c51417215a7775aa&=&format=webp&quality=lossless&width=876&height=1169",
"colour": "#FFD700",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"silver":{
"title": "Congratulations! You've claimed a silver gummynuggie!! ${multiplier}x earned this claim for a total of ${amount} gummynuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1168356994453885059/1301101446380523571/tRvkJDb.png?ex=672340a6&is=6721ef26&hm=afdbe8ce45ead0124f6492d82ba689c6d281617fc9a8fe91ed2e523e6439760d&=&format=webp&quality=lossless&width=876&height=1169",
"colour": "#C0C0C0",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"bronze":{
"title": "Congratulations! You've claimed a bronze gummynuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1168356994453885059/1301101447584157696/Fmi8wTB.png?ex=672340a6&is=6721ef26&hm=4ff5a5cb7d4b437d9f942117d2c5987d6d87b0e449a0d46c38a70ec3a7879724&=&format=webp&quality=lossless&width=876&height=1169",
"colour": "#CD7F32",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"regular": {
"title": "{amount} gummynuggies claimed!",
"imageUrl": "https://media.discordapp.net/attachments/1168356994453885059/1301102084002943017/jF8vRKZ.png?ex=6723413e&is=6721efbe&hm=ef1c378986d8ba2b5aa6f04f725392621f07147e6c012fa80fa9d7d2b3aa1e3e&=&format=webp&quality=lossless&width=592&height=242",
"colour": "#83F28F",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"multiplier": 1.0
},

"christmas": {
"gold": {
"title": "Congratulations! You've claimed a golden santanuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://drive.google.com/thumbnail?id=1U5oXdCW6LMjLgVxNWN-i4kDH_wow3yPp",
"colour": "#FFD700",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"silver":{
"title": "Congratulations! You've claimed a silver gummynuggie!! ${format(multiplier.silver, true)}x earned this claim for a total of ${format(amount)} gummynuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1168356994453885059/1301101446380523571/tRvkJDb.png?ex=672340a6&is=6721ef26&hm=afdbe8ce45ead0124f6492d82ba689c6d281617fc9a8fe91ed2e523e6439760d&=&format=webp&quality=lossless&width=876&height=1169",
},
"silver": {
"title": "Congratulations! You've claimed a silver santanuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://drive.google.com/thumbnail?id=1Q29dJ1ST1GMxmeM98jub4RKIpm-bZC1v",
"colour": "#C0C0C0",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"bronze":{
"title": "Congratulations! You've claimed a bronze dinonuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1168356994453885059/1301101447584157696/Fmi8wTB.png?ex=672340a6&is=6721ef26&hm=4ff5a5cb7d4b437d9f942117d2c5987d6d87b0e449a0d46c38a70ec3a7879724&=&format=webp&quality=lossless&width=876&height=1169",
},
"bronze": {
"title": "Congratulations! You've claimed a bronze santanuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://drive.google.com/thumbnail?id=1oLvRzxrs7b9Z97BVOacNbNCrodr68Fll",
"colour": "#CD7F32",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"regular": {
"title": "{amount} santanuggies claimed!",
"imageUrl": "https://drive.google.com/thumbnail?id=1_RPbZ680d8QFBv8oZMCwom6RrlgSUYBR",
"colour": "#83F28F",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"multiplier": 1.0
},
"regular": {

"normal": {
"gold": {
"title": "Congratulations! You've claimed a golden dinonuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1070612017058160731/1272801662121283614/AMuYswc.png?ex=66bc4c6b&is=66bafaeb&hm=1d284683c81389bf481ca100eb631a3b4d85ff51c86e22e7032f5cab30e73763&=&format=webp&quality=lossless&width=806&height=1169",
"colour": "#FFD700",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://media.forgecdn.net/avatars/thumbnails/375/327/256/256/637550156004612442.png"
},
"silver": {
"title": "Congratulations! You've claimed a silver dinonuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1070612017058160731/1272804142871609445/r0LVjIF.png?ex=66bc4ebb&is=66bafd3b&hm=75fcdacc2e0e138e0ad0640d7328607fa8a692c626398bf19d8ce4631b4a63ef&=&format=webp&quality=lossless&width=433&height=629",
"colour": "#C0C0C0",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://media.forgecdn.net/avatars/thumbnails/375/327/256/256/637550156004612442.png"
},
"bronze": {
"title": "Congratulations! You've claimed a bronze dinonuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://media.discordapp.net/attachments/1070612017058160731/1272919852507463773/OXjd97e.png?ex=66bcba7e&is=66bb68fe&hm=34ef60370f5d26896aa8feca56846920228c78299144e9b5deb5d172522df56d&=&format=webp&quality=lossless&width=896&height=1169",
"colour": "#CD7F32",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://media.forgecdn.net/avatars/thumbnails/375/327/256/256/637550156004612442.png"
},
"regular": {
"title": "{amount} dinonuggies claimed!",
"imageUrl": "https://media.discordapp.net/attachments/1168356994453885059/1301102084002943017/jF8vRKZ.png?ex=6723413e&is=6721efbe&hm=ef1c378986d8ba2b5aa6f04f725392621f07147e6c012fa80fa9d7d2b3aa1e3e&=&format=webp&quality=lossless&width=592&height=242",
"imageUrl": "https://media.forgecdn.net/avatars/thumbnails/375/327/256/256/637550156004612442.png",
"colour": "#83F28F",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
}
},
"christmas": {
"gold": {
"title": "Congratulations! You've claimed a golden dinonuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://drive.google.com/thumbnail?id=1U5oXdCW6LMjLgVxNWN-i4kDH_wow3yPp",
"colour": "#FFD700",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"silver": {
"title": "Congratulations! You've claimed a silver dinonuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://drive.google.com/thumbnail?id=1Q29dJ1ST1GMxmeM98jub4RKIpm-bZC1v",
"colour": "#C0C0C0",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"bronze": {
"title": "Congratulations! You've claimed a bronze dinonuggie!! {multiplier}x earned this claim for a total of {amount} dinonuggies!",
"imageUrl": "https://drive.google.com/thumbnail?id=1oLvRzxrs7b9Z97BVOacNbNCrodr68Fll",
"colour": "#CD7F32",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
},
"regular": {
"title": "{amount} dinonuggies claimed!",
"imageUrl": "https://drive.google.com/thumbnail?id=1_RPbZ680d8QFBv8oZMCwom6RrlgSUYBR",
"colour": "#83F28F",
"footer": "Gold: {gold}% for {multiplier_gold}x | Silver: {silver}% for {multiplier_silver}x | Bronze: {bronze}% for {multiplier_bronze}x. Check upgrades with /upgrades",
"thumbnail": "https://drive.google.com/thumbnail?id=1oVDRweQoYLU6YfB01LWZpTFQiBS1fRRa"
}
"thumbnail": "https://media.forgecdn.net/avatars/thumbnails/375/327/256/256/637550156004612442.png"
},
"multiplier": 1.0
}
}

0 comments on commit a437953

Please sign in to comment.