Skip to content

Commit

Permalink
optimize questRepository memory
Browse files Browse the repository at this point in the history
  • Loading branch information
wow890209 committed Oct 1, 2023
1 parent 83815d3 commit bf3b4c1
Show file tree
Hide file tree
Showing 22 changed files with 498 additions and 488 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import tw.waterballsa.utopia.utopiagamification.quest.extensions.toTaipeiLocalDa
import tw.waterballsa.utopia.utopiagamification.quest.listeners.UtopiaGamificationListener
import tw.waterballsa.utopia.utopiagamification.repositories.ActivityRepository
import tw.waterballsa.utopia.utopiagamification.repositories.PlayerRepository
import tw.waterballsa.utopia.utopiagamification.quest.service.PlayerFulfillMissionsService
import tw.waterballsa.utopia.utopiagamification.quest.usecase.PlayerFulfillMissionsUsecase
import java.time.LocalDateTime.now

private val log = KotlinLogging.logger {}
Expand All @@ -24,7 +24,7 @@ private val log = KotlinLogging.logger {}
class EventJoiningListener(
guild: Guild,
playerRepository: PlayerRepository,
private val playerFulfillMissionsService: PlayerFulfillMissionsService,
private val playerFulfillMissionsService: PlayerFulfillMissionsUsecase,
private val activityRepository: ActivityRepository
) : UtopiaGamificationListener(guild, playerRepository) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ class Mission(
state = CLAIMED
}

fun nextMission(): Mission? {
fun nextQuestId(): Int? {
if (state == IN_PROGRESS) {
return null
}
return quest.nextQuest?.let { Mission(player, it) }

return quest.nextQuestId
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package tw.waterballsa.utopia.utopiagamification.quest.domain

private const val completeMessage = "任務完成!"

class Quest(
val id: Int,
val title: String,
val description: String,
val preCondition: PreCondition,
val roleType: RoleType,
val periodType: PeriodType,
val preCondition: PreCondition = EmptyPreCondition(),
val roleType: RoleType = RoleType.EVERYONE,
val periodType: PeriodType = PeriodType.NONE,
val criteria: Action.Criteria,
val reward: Reward,
val nextQuest: Quest? = null,
val postMessage: String
val nextQuestId: Int? = null,
val postMessage: String = completeMessage
)

class Reward(
Expand Down

This file was deleted.

Loading

0 comments on commit bf3b4c1

Please sign in to comment.