Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display encounter info #7819

Merged
merged 4 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/clj/web/auth.clj
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@
(defn profile-keys []
[:background :pronouns :language :default-format :show-alt-art :blocked-users
:alt-arts :card-resolution :deckstats :gamestats :card-zoom :pin-zoom
:card-back :stacked-cards :ghost-trojans :sides-overlap :archives-sorted :heap-sorted
:card-back :stacked-cards :ghost-trojans :display-encounter-info
:sides-overlap :archives-sorted :heap-sorted
:labeled-cards :labeled-unrezzed-cards :bespoke-sounds])

(defn update-profile-handler
Expand Down
13 changes: 11 additions & 2 deletions src/cljs/nr/account.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
(swap! app-state assoc-in [:options :player-stats-icons] (:player-stats-icons @s))
(swap! app-state assoc-in [:options :stacked-cards] (:stacked-cards @s))
(swap! app-state assoc-in [:options :ghost-trojans] (:ghost-trojans @s))
(swap! app-state assoc-in [:options :display-encounter-info] (:display-encounter-info @s))
(swap! app-state assoc-in [:options :sides-overlap] (:sides-overlap @s))
(swap! app-state assoc-in [:options :runner-board-order] (:runner-board-order @s))
(swap! app-state assoc-in [:options :log-width] (:log-width @s))
Expand All @@ -69,6 +70,7 @@
(.setItem js/localStorage "player-stats-icons" (:player-stats-icons @s))
(.setItem js/localStorage "stacked-cards" (:stacked-cards @s))
(.setItem js/localStorage "ghost-trojans" (:ghost-trojans @s))
(.setItem js/localStorage "display-encounter-info" (:display-encounter-info @s))
(.setItem js/localStorage "sides-overlap" (:sides-overlap @s))
(.setItem js/localStorage "runner-board-order" (:runner-board-order @s))
(.setItem js/localStorage "card-back" (:card-back @s))
Expand Down Expand Up @@ -372,7 +374,13 @@
:value true
:checked (:ghost-trojans @s)
:on-change #(swap! s assoc-in [:ghost-trojans] (.. % -target -checked))}]
(tr [:settings.ghost-trojans "Display ghosts for hosted programs"])]]
(tr [:settings.display-encounter-info "Display ghosts for hosted programs"])]]
[:div
[:label [:input {:type "checkbox"
:value true
:checked (:display-encounter-info @s)
:on-change #(swap! s assoc-in [:display-encounter-info] (.. % -target -checked))}]
(tr [:settings.display-encounter-info "Always display encounter info dialog"])]]
[:div
[:label [:input {:type "checkbox"
:value true
Expand Down Expand Up @@ -575,7 +583,7 @@

[api-keys s]

[:section
[:section
[:span.flash-message (:flash-message @s)]]]])}))

(defn account []
Expand All @@ -600,6 +608,7 @@
:card-resolution (get-in @app-state [:options :card-resolution])
:stacked-cards (get-in @app-state [:options :stacked-cards])
:ghost-trojans (get-in @app-state [:options :ghost-trojans])
:display-encounter-info (get-in @app-state [:options :display-encounter-info])
:sides-overlap (get-in @app-state [:options :sides-overlap])
:player-stats-icons (get-in @app-state [:options :player-stats-icons])
:runner-board-order (get-in @app-state [:options :runner-board-order])
Expand Down
36 changes: 23 additions & 13 deletions src/cljs/nr/gameboard/board.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -580,17 +580,27 @@
(doall
(map-indexed
(fn [i sub]
[:div {:key i}
[:span (cond (:broken sub)
{:class :disabled
:style {:font-style :italic}}
(false? (:resolve sub))
{:class :dont-resolve
:style {:text-decoration :line-through}})
(render-icons (str " [Subroutine] " (:label sub)))]
[:span.float-right
(cond (:broken sub) banned-span
(:fired sub) "✅")]])
(let [fire-sub #(when (= :corp (:side @game-state))
(send-command "subroutine" {:card ice
:subroutine i})
(close-card-menu))]
[:div {:key i
:tab-index 0
:on-click fire-sub
:on-key-down #(when (= "Enter" (.-key %))
(fire-sub))
:on-key-up #(when (= " " (.-key %))
(fire-sub))}
[:span (cond (:broken sub)
{:class :disabled
:style {:font-style :italic}}
(false? (:resolve sub))
{:class :dont-resolve
:style {:text-decoration :line-through}})
(render-icons (str " [Subroutine] " (:label sub)))]
[:span.float-right
(cond (:broken sub) banned-span
(:fired sub) "✅")]]))
subroutines))]))

(defn card-abilities [card abilities subroutines]
Expand Down Expand Up @@ -1430,7 +1440,7 @@
:on-mouse-out #(card-highlight-mouse-out % ice button-channel)}
(tr [:game.encounter-ice "Encounter ice"]) ": " (render-message (get-title ice))]
[:hr]
(when (:button @app-state)
(when (or (:button @app-state) (get-in @app-state [:options :display-encounter-info]))
[encounter-info-div ice])])
(when @run
[:h4 (tr [:game.current-phase "Current phase"]) ":" [:br] (get phase->title (:phase @run) (tr [:game.unknown-phase "Unknown phase"]))])
Expand Down Expand Up @@ -1500,7 +1510,7 @@
:on-mouse-out #(card-highlight-mouse-out % ice button-channel)}
(tr [:game.encounter-ice "Encounter ice"]) ": " (render-message (get-title ice))]
[:hr]
(when (:button @app-state)
(when (or (:button @app-state) (get-in @app-state [:options :display-encounter-info]))
[encounter-info-div ice])])
(when @run
[:h4 (tr [:game.current-phase "Current phase"]) ":" [:br] (get phase->title phase)])
Expand Down
8 changes: 7 additions & 1 deletion src/cljs/nr/gameboard/settings.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@
:value true
:checked (get-in @app-state [:options :ghost-trojans])
:on-change #(swap! app-state assoc-in [:options :ghost-trojans] (.. % -target -checked))}]
(tr [:ingame-settings.ghost-trojans "Display hosted trojans in rig"])]]]
(tr [:ingame-settings.ghost-trojans "Display hosted trojans in rig"])]]
[:div
[:label [:input {:type "checkbox"
:value true
:checked (get-in @app-state [:options :display-encounter-info])
:on-change #(swap! app-state assoc-in [:options :display-encounter-info] (.. % -target -checked))}]
(tr [:ingame-settings.display-encounter-info "Always display encounter info"])]]]

[:section
[:h4 (tr [:ingame-settings.card-sorting "Sorting"])]
Expand Down
Loading