Skip to content

Commit

Permalink
refactory
Browse files Browse the repository at this point in the history
  • Loading branch information
wow890209 committed Nov 19, 2023
1 parent 3ec2e30 commit 229af69
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Mission(
) {

constructor(player: Player, quest: Quest) : this(randomUUID(), player, quest, IN_PROGRESS, null)
constructor(player: Player, quest: Quest, state: State) : this(randomUUID(), player, quest, state, null)

var state: State = state
private set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class ClaimMissionRewardPresenter : ClaimMissionRewardUsecase.Presenter {
目前等級:${mission.player.level}
目前經驗值:${mission.player.currentExp()}/${mission.player.level.toLevelRange().expLimit}
""".trimIndent(),

mission.nextQuestId()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import tw.waterballsa.utopia.utopiagamification.quest.usecase.ClaimMissionReward
import tw.waterballsa.utopia.utopiagamification.repositories.MissionRepository
import tw.waterballsa.utopia.utopiagamification.repositories.PlayerRepository
import tw.waterballsa.utopia.utopiatestkit.annotations.UtopiaTest
import java.util.*

@UtopiaTest
class ClaimMissionRewardUsecaseTest @Autowired constructor(
Expand All @@ -36,6 +37,8 @@ class ClaimMissionRewardUsecaseTest @Autowired constructor(
1.0f
)
)
private val completedMission = Mission(UUID.randomUUID(), playerA, quest, COMPLETED, null)
private val claimedMission = Mission(UUID.randomUUID(), playerA, quest, CLAIMED, null)

@BeforeEach
fun setup() {
Expand All @@ -52,7 +55,6 @@ class ClaimMissionRewardUsecaseTest @Autowired constructor(
@Test
fun `test player claims mission rewards`() {
//given
val completedMission = Mission(playerA, quest, COMPLETED)
missionRepository.saveMission(completedMission)

val request = ClaimMissionRewardUsecase.Request(playerA.id, quest.id)
Expand Down Expand Up @@ -103,8 +105,7 @@ class ClaimMissionRewardUsecaseTest @Autowired constructor(
)
@Test
fun `test players cannot claim mission rewards repeatedly`() {
val mission = Mission(playerA, quest, CLAIMED)
missionRepository.saveMission(mission)
missionRepository.saveMission(claimedMission)

val request = ClaimMissionRewardUsecase.Request(playerA.id, quest.id)
val presenter = ClaimMissionRewardPresenter()
Expand Down
15 changes: 9 additions & 6 deletions wsa-bot-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@
|:--------------:| ---------------------------------------------------------------------------------------------------------- | ----------- |
| random lottery | number(INTEGER): Number of choose members per room.<br>role(ROLE): Only select specific role in this round | Lottery |

## rock-paper-scissors
| Commands | Arguments | Description |
|:-------------------:| --------- | ------------------------------------- |
| rock-paper-scissors | | start a new rock paper scissors game! |

## roulette
| Commands | Arguments | Description |
|:--------:| --------- | --------------- |
Expand All @@ -60,13 +55,21 @@
| weekly-messages-volume | channel-name(STRING): The channel to show the weekly messages volume | Show the weekly messages volume of the channel |

## quiz

| Commands | Arguments | Description |
|:--------:| ----------------------------------------- | -------------------- |
| quiz | name(STRING): The quiz you want to start. | The quiz for utopia. |

## utopia

| Commands | Arguments | Description |
|:------------------:| ------------------------ | ------------------------------------- |
| utopia first-quest | | get first quest |
| utopia re-render | | re-render in_progress/completed quest |
| utopia leaderboard | options(STRING): my rank | leaderboard |
| utopia leaderboard | options(STRING): my-rank | leaderboard |

## rock-paper-scissors

| Commands | Arguments | Description |
|:-------------------:| --------- | ------------------------------------- |
| rock-paper-scissors | | start a new rock paper scissors game! |

0 comments on commit 229af69

Please sign in to comment.