From 696810e093d1412c9b654d0c643b5541e9ac8a6a Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Sat, 1 Jun 2024 14:42:51 +0100 Subject: [PATCH] Update the give currency timer to give 10 coins every 20 minutes (#236) # Description Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. - Give the currency to a user every 20 minutes - This is enough so that they can run claim once every 20 minutes #204, #226, #229 ## Type of change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) # How Has This Been Tested? Please describe the tests that you ran to verify the changes. Provide instructions so we can reproduce. Please also list any relevant details to your test configuration. # Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that provde my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules Reviewed-on: https://git.vylpes.xyz/External/card-drop/pulls/236 Reviewed-by: VylpesTester Co-authored-by: Ethan Lane Co-committed-by: Ethan Lane --- src/client/client.ts | 2 +- src/constants/CardConstants.ts | 1 + src/timers/GiveCurrency.ts | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/client/client.ts b/src/client/client.ts index 2dd9a29..384843d 100644 --- a/src/client/client.ts +++ b/src/client/client.ts @@ -79,7 +79,7 @@ export class CoreClient extends Client { .then(() => { AppLogger.LogInfo("Client", "App Data Source Initialised"); - const timerId = this._timerHelper.AddTimer("*/30 * * * * *", "Europe/London", GiveCurrency, false); + const timerId = this._timerHelper.AddTimer("*/20 * * * *", "Europe/London", GiveCurrency, false); this._timerHelper.StartTimer(timerId); }) .catch(err => { diff --git a/src/constants/CardConstants.ts b/src/constants/CardConstants.ts index dfc89b8..0a87e22 100644 --- a/src/constants/CardConstants.ts +++ b/src/constants/CardConstants.ts @@ -1,5 +1,6 @@ export default class CardConstants { public static readonly ClaimCost = 10; + public static readonly TimerGiveAmount = 10; public static readonly DailyCurrency = 100; public static readonly StartingCurrency = 300; } \ No newline at end of file diff --git a/src/timers/GiveCurrency.ts b/src/timers/GiveCurrency.ts index ad1a21a..c292025 100644 --- a/src/timers/GiveCurrency.ts +++ b/src/timers/GiveCurrency.ts @@ -1,4 +1,5 @@ import AppLogger from "../client/appLogger"; +import CardConstants from "../constants/CardConstants"; import User from "../database/entities/app/User"; export default async function GiveCurrency() { @@ -7,10 +8,10 @@ export default async function GiveCurrency() { const users = await User.FetchAll(User); for (const user of users) { - user.AddCurrency(5); + user.AddCurrency(CardConstants.TimerGiveAmount); } User.SaveAll(User, users); - AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +5 currency to ${users.length} users`); + AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${users.length} users`); } \ No newline at end of file