Skip to content

Commit

Permalink
Fix display of quest rewards
Browse files Browse the repository at this point in the history
  • Loading branch information
Janiczek committed Nov 10, 2024
1 parent 64b56a2 commit b0da0ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions src/Data/Message.elm
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,10 @@ summary message =
"You attacked " ++ r.target ++ " but nobody was able to kill the other"

YouCompletedAQuest r ->
"You completed the quest: " ++ Quest.title r.quest
"You completed: " ++ Quest.title r.quest

OthersCompletedAQuest r ->
"Others completed the quest: " ++ Quest.title r.quest
"Others completed: " ++ Quest.title r.quest


content : List (Attribute msg) -> PerceptionLevel -> Message -> Html msg
Expand Down Expand Up @@ -311,13 +311,15 @@ Your current level is """
[ "You completed the quest **{QUEST}**!"
|> String.replace "{QUEST}" (Quest.title r.quest)
|> Just
, Just (Quest.completionText r.quest)
, Just ("_" ++ Quest.completionText r.quest ++ "_")
, Just ("You earned " ++ String.fromInt r.xpReward ++ " XP.")
, Maybe.map
(\rewards ->
String.join "\n"
String.join "\n\n"
[ "Your rewards:"
, String.join "\n" (List.map Quest.playerRewardTitle rewards)
, rewards
|> List.map (\rew -> " - " ++ Quest.playerRewardTitle rew)
|> String.join "\n"
]
)
r.playerReward
Expand All @@ -326,9 +328,11 @@ Your current level is """

else
Just
(String.join "\n"
(String.join "\n\n"
[ "Global rewards:"
, String.join "\n" (List.map Quest.globalRewardTitle r.globalRewards)
, r.globalRewards
|> List.map (\rew -> " - " ++ Quest.globalRewardTitle rew)
|> String.join "\n"
]
)
]
Expand All @@ -340,7 +344,7 @@ Your current level is """
[ "Others completed the quest **{QUEST}** without your participation."
|> String.replace "{QUEST}" (Quest.title r.quest)
|> Just
, Just (Quest.completionText r.quest)
, Just ("_" ++ Quest.completionText r.quest ++ "_")
, if List.isEmpty r.globalRewards then
Nothing

Expand Down Expand Up @@ -403,14 +407,15 @@ markdownRenderer =
]
children
, strong = \children -> H.span [ HA.class "text-yellow" ] children
, emphasis = \children -> H.span [ HA.class "text-green-300" ] children
, unorderedList =
\list ->
list
|> List.map
(\(Markdown.Block.ListItem _ children) ->
H.li [] children
)
|> UI.ul [ HA.class "flex flex-col gap-4" ]
|> UI.ul [ HA.class "flex flex-col" ]
, codeSpan =
\text ->
H.span
Expand Down
2 changes: 1 addition & 1 deletion src/Frontend.elm
Original file line number Diff line number Diff line change
Expand Up @@ -4334,7 +4334,7 @@ messagesView currentTime zone _ player =
else
H.td [] []
, H.td
[ HA.title summary ]
[ HA.class "max-w-[60ch] overflow-x-hidden text-ellipsis whitespace-nowrap" ]
[ H.text summary ]
, H.td
[ HA.title <| Message.fullDate zone message ]
Expand Down

0 comments on commit b0da0ef

Please sign in to comment.