Create use effect command #419
3 changed files with 4 additions and 8 deletions
|
@ -61,7 +61,8 @@ export default class Effects extends ButtonEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const whenExpires = new Date(now.getMilliseconds() + effectDetail.duration);
|
|
||||||
|
const whenExpires = new Date(now.getTime() + effectDetail.duration);
|
||||||
|
|
||||||
const result = await EffectHelper.UseEffect(interaction.user.id, id, whenExpires);
|
const result = await EffectHelper.UseEffect(interaction.user.id, id, whenExpires);
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ export default class Effects extends ButtonEvent {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Expires",
|
name: "Expires",
|
||||||
value: `<t:${whenExpires.getMilliseconds()}:f>`,
|
value: `<t:${Math.round(whenExpires.getTime() / 1000)}:f>`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -53,8 +53,6 @@ export default class Drop extends Command {
|
||||||
|
|
||||||
const hasChanceUpEffect = await EffectHelper.HasEffect(interaction.user.id, "unclaimed");
|
const hasChanceUpEffect = await EffectHelper.HasEffect(interaction.user.id, "unclaimed");
|
||||||
|
|
||||||
console.log(hasChanceUpEffect);
|
|
||||||
|
|
||||||
if (hasChanceUpEffect && Math.random() <= CardConstants.UnusedChanceUpChance) {
|
if (hasChanceUpEffect && Math.random() <= CardConstants.UnusedChanceUpChance) {
|
||||||
randomCard = await CardDropHelperMetadata.GetRandomCardUnclaimed(interaction.user.id);
|
randomCard = await CardDropHelperMetadata.GetRandomCardUnclaimed(interaction.user.id);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -37,19 +37,16 @@ export default class EffectHelper {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
if (!effect || effect.Unused == 0) {
|
if (!effect || effect.Unused == 0) {
|
||||||
console.log(1);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const effectDetail = EffectDetails.get(effect.Name);
|
const effectDetail = EffectDetails.get(effect.Name);
|
||||||
|
|
||||||
if (!effectDetail) {
|
if (!effectDetail) {
|
||||||
console.log(2);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effect.WhenExpires && now < new Date(effect.WhenExpires.getMilliseconds() + effectDetail.cooldown)) {
|
if (effect.WhenExpires && now < new Date(effect.WhenExpires.getTime() + effectDetail.cooldown)) {
|
||||||
console.log(3);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue