Skip to content

Conversation

@andrewlinington
Copy link

Implements bang and a rudimentary profile for the user to be able to use.

…n task to remove an error when resetting the timer.
…streak has ended for the given day and a way to keep track of the users current streak.
…nto spring to run code to check for a users bang streak during the given day.

Updated the README.md to include usages for both the database and property file.
… Removed all unused imports. moved BangCache.kt and BangResult.kt into their respective files in Service.
val roleExpiry: LocalDateTime? = null
val roleExpiry: LocalDateTime? = null,
val bangStreak: Int = 0//,
// val bangAttempts: Int = 0,
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can remove these lines or adjust this code when we come to decision

checkPanic()
if (!panic) {
printBangResult(bangEntity, chambers)
performBangForResult(bangEntity)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added this code to perform all the repository actions

private fun finishTimer () {
timer?.cancel()
timer = null
manageQueue()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted to manage the queue in one function

queue.forEach { updates.getOrPut(it.userId!!) { LinkedList() }.add(it) }

printResults(updates)
performResultUpdates(updates)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the action after printing as to ensure it is printed based on the actions then updates them

todayBangerRepository.deleteAll()
}

private fun performBangForResult (bangEntity: BangEntity) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new addtion

userRepository.addMoney(bangEntity.userId, money)
}

private fun performDailyUpdate(userId: Long): Long {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new addition

return 0L
}

private fun performResultUpdates(updates: HashMap<Long, LinkedList<BangEntity>>) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new addition

}
}

private fun performIndividualResultUpdate(userUpdates: LinkedList<BangEntity>, userId: Long) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new addition

else ""
}

private fun getDailyResultOutputString (name: String, userId: Long): String {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new addition

"\n$name received their daily reward of 5 GryphCoins!\n" + getBonusForStreakString(userId) else "\n"
}

private fun getBonusForStreakString (userId: Long): String {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new addition

Deaths: ${userUpdates.count { it.result == BangResult.DIE.value }}
Jams: ${userUpdates.count { it.result == BangResult.JAM.value }}
""".trimIndent()
output += getDailyResultOutputString(user.safeName(), user.idLong)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted so daily prints with each user instead of at the bottom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant