diff --git a/src/cljc/orcpub/common.cljc b/src/cljc/orcpub/common.cljc index 460d32ce..ae754f21 100644 --- a/src/cljc/orcpub/common.cljc +++ b/src/cljc/orcpub/common.cljc @@ -36,7 +36,8 @@ (defn map-by-id [values] (map-by :db/id values)) -(defmacro ptime [message body] +;; dead — zero callers +#_(defmacro ptime [message body] `(do (prn ~message) (time ~body))) @@ -149,14 +150,17 @@ (def rounds-per-minute 10) (def minutes-per-hour 60) -(def hours-per-day 24) +;; dead — redefined in views.cljs, never used from common +#_(def hours-per-day 24) (def rounds-per-hour (* minutes-per-hour rounds-per-minute)) -(defn rounds-to-hours [rounds] +;; dead — zero callers +#_(defn rounds-to-hours [rounds] (int (/ rounds rounds-per-hour))) -(defn rounds-to-minutes [rounds] +;; dead — zero callers +#_(defn rounds-to-minutes [rounds] (int (/ (rem rounds rounds-per-hour) rounds-per-minute))) (def filter-true-xform diff --git a/src/cljc/orcpub/dnd/e5/character.cljc b/src/cljc/orcpub/dnd/e5/character.cljc index d0640b2c..9605fdd2 100644 --- a/src/cljc/orcpub/dnd/e5/character.cljc +++ b/src/cljc/orcpub/dnd/e5/character.cljc @@ -126,7 +126,8 @@ %)) raw-character)) -(defn add-equipment-namespaces [raw-character] +;; dead — only caller was add-namespaces +#_(defn add-equipment-namespaces [raw-character] (-> (reduce add-equipment-namespace raw-character @@ -145,7 +146,8 @@ ::wis (or n-wis wis) ::cha (or n-cha cha)}))) -(defn add-namespaces-to-values [raw-character] +;; dead — only caller was add-namespaces +#_(defn add-namespaces-to-values [raw-character] (if (seq (::entity/values raw-character)) (update raw-character ::entity/values @@ -155,7 +157,8 @@ values))) raw-character)) -(defn add-namespaces [raw-character] +;; dead — zero live callers (cascade: add-equipment-namespaces, add-namespaces-to-values) +#_(defn add-namespaces [raw-character] (-> raw-character add-equipment-namespaces add-ability-namespaces @@ -396,7 +399,8 @@ (defn base-flying-speed [built-char] (get-prop built-char :flying-speed)) -(defn base-climbing-speed [built-char] +;; dead — zero callers +#_(defn base-climbing-speed [built-char] (get-prop built-char :climbing-speed)) (defn land-speed-with-armor [built-char] @@ -598,7 +602,8 @@ (defn save-bonuses [built-char] (get-prop built-char :save-bonuses)) -(defn saving-throw-advantages [built-char] +;; dead — zero callers +#_(defn saving-throw-advantages [built-char] (get-prop built-char :saving-throw-advantage)) (defn best-weapon-attack-modifier-fn [built-char] @@ -733,7 +738,8 @@ (defn dual-wield-weapon-fn [built-char] (get-prop built-char :dual-wield-weapon?)) -(defn max-armor-class [unarmored-armor-class +;; dead — zero callers +#_(defn max-armor-class [unarmored-armor-class ac-with-armor-fn all-armor-inventory equipped-armor diff --git a/src/cljc/orcpub/dnd/e5/classes.cljc b/src/cljc/orcpub/dnd/e5/classes.cljc index 80747c56..614fbfdf 100644 --- a/src/cljc/orcpub/dnd/e5/classes.cljc +++ b/src/cljc/orcpub/dnd/e5/classes.cljc @@ -371,7 +371,8 @@ :page 55 :summary "make a weapon attack when you use your action to cast a bard spell"})]}}}]})) -(defn blessings-of-knowledge-skill [skill-name] +;; dead — only called from #_ discarded block +#_(defn blessings-of-knowledge-skill [skill-name] (let [skill-kw (common/name-to-kw skill-name)] (t/option-cfg {:name skill-name @@ -379,7 +380,8 @@ :modifiers [(mod5e/skill-proficiency skill-kw) (mod5e/skill-expertise skill-kw)]}))) -(def spell-level-to-cleric-level +;; dead — zero callers +#_(def spell-level-to-cleric-level {1 1 2 3 3 5 @@ -1466,7 +1468,7 @@ 10 {:modifiers [(mod5e/dependent-trait {:name "Aura of Courage" :page 85 - :summary (str (str "you and friendly creatures within " ?paladin-aura " ft. can't be frightened"))})]} + :summary (str "you and friendly creatures within " ?paladin-aura " ft. can't be frightened")})]} 14 {:modifiers [(mod5e/action {:name "Cleansing Touch" :page 85 @@ -2324,7 +2326,8 @@ :page page :description (str "time and money to copy an " school " spell is halved")}) -(defn spell-in-spells-known? [known level spell-key] +;; dead — only called from #_ discarded block +#_(defn spell-in-spells-known? [known level spell-key] (and known (some #(= spell-key (:key %)) (known level)))) (defn spell-mastery-selection [level] @@ -2613,7 +2616,8 @@ (t/option-cfg {:name (or (:name weapon) (::weapon5e/name weapon))}))))) -(defn pact-weapon-option [title weapons] +;; dead — zero callers +#_(defn pact-weapon-option [title weapons] (t/option-cfg {:name title :selections [(t/selection-cfg diff --git a/src/cljc/orcpub/dnd/e5/options.cljc b/src/cljc/orcpub/dnd/e5/options.cljc index a53923db..0141d544 100644 --- a/src/cljc/orcpub/dnd/e5/options.cljc +++ b/src/cljc/orcpub/dnd/e5/options.cljc @@ -32,7 +32,8 @@ (def xps [0 300 900 2700 6500 14000 23000 34000 48000 64000 85000 100000 120000 140000 165000 195000 225000 265000 305000 355000]) -(def levels +;; unreferenced — xps is used directly elsewhere +#_(def levels (map-indexed (fn [i xp] {:level (inc i) :min-xp xp}) xps)) @@ -392,7 +393,8 @@ "You already have this language" (fn [c] (not (get @(subscribe [::character/languages nil c]) key))))]})) -(defn key-to-name [key] +;; unreferenced — common/name-to-kw is used instead +#_(defn key-to-name [key] (s/join " " (map s/capitalize (s/split (name key) #"-")))) (defn spell-field [name value] @@ -816,7 +818,8 @@ (map language-map (keys lang-options)))] (language-selection-aux languages lang-num))) -(defn any-language-selection [language-map & [num]] +;; unreferenced — language-selection and homebrew-language-selection used instead +#_(defn any-language-selection [language-map & [num]] (language-selection-aux (vals language-map) num)) #_(defn maneuver-option [name & [desc]] @@ -865,7 +868,8 @@ (not= k source)) (?tool-profs tool-kw))])]) -(defn skill-or-expertise-selection [num skill-kws option-source] +;; dead — only called from deprecated ua_race_feats.cljc +#_(defn skill-or-expertise-selection [num skill-kws option-source] (t/selection-cfg {:name "Skill Proficiency" :order 0 @@ -1061,9 +1065,11 @@ (mods/set-mod ?feats kw)) (not multiselect?) (update :prereqs conj (does-not-have-feat-prereq kw)))))) -(def charge-summary "when you Dash, you can make 1 melee attack or shove as a bonus action; if you move 10 ft. before taking this bonus action you gain +5 damage to attack or shove 10 ft.") +;; dead — zero callers +#_(def charge-summary "when you Dash, you can make 1 melee attack or shove as a bonus action; if you move 10 ft. before taking this bonus action you gain +5 damage to attack or shove 10 ft.") -(def defensive-duelist-summary "when you are hit with a melee attack, you can add your prof bonus to AC for the attack if you are wielding a finesse weapon you are proficient with") +;; dead — zero callers +#_(def defensive-duelist-summary "when you are hit with a melee attack, you can add your prof bonus to AC for the attack if you are wielding a finesse weapon you are proficient with") #_(defn homebrew-spell-selection [spell-lists spells-map] (spell-selection @@ -1146,14 +1152,14 @@ [(let [main-hand-weapon ?orcpub.dnd.e5.character/main-hand-weapon off-hand-weapon ?orcpub.dnd.e5.character/off-hand-weapon all-weapons-map @(subscribe [::mi/all-weapons-map])] - (and (and main-hand-weapon - (-> all-weapons-map - main-hand-weapon - ::weapons/melee?)) - (and off-hand-weapon - (-> all-weapons-map - off-hand-weapon - ::weapons/melee?))))])) + (and main-hand-weapon + (-> all-weapons-map + main-hand-weapon + ::weapons/melee?) + off-hand-weapon + (-> all-weapons-map + off-hand-weapon + ::weapons/melee?)))])) (def dual-wield-weapon-mod (mods/modifier ?dual-wield-weapon? weapons/one-handed-weapon?)) @@ -1714,17 +1720,17 @@ [(let [main-hand-weapon ?orcpub.dnd.e5.character/main-hand-weapon off-hand-weapon ?orcpub.dnd.e5.character/off-hand-weapon all-weapons-map @(subscribe [::mi/all-weapons-map])] - (and (and main-hand-weapon - (-> all-weapons-map + (and main-hand-weapon + (-> all-weapons-map + main-hand-weapon + ::weapons/melee?) + (not (-> all-weapons-map main-hand-weapon - ::weapons/melee?) - (not (-> all-weapons-map - main-hand-weapon - ::weapons/two-handed?))) - (and off-hand-weapon - (not (-> all-weapons-map ;ensure no weapons in off hand - off-hand-weapon - ::weapons/type)))))]) + ::weapons/two-handed?)) + off-hand-weapon + (not (-> all-weapons-map ;ensure no weapons in off hand + off-hand-weapon + ::weapons/type))))]) ]}) (t/option-cfg {:name "Great Weapon Fighting" @@ -1861,7 +1867,8 @@ (def ua-al-illegal (modifiers/al-illegal "Unearthed Arcana options are not allowed")) -(defn subclass-plugin [class-base-cfg source subclasses ua-al-illegal?] +;; dead — all callers are in #_ discarded template blocks (dmg-classes, ua, scag) +#_(defn subclass-plugin [class-base-cfg source subclasses ua-al-illegal?] (merge class-base-cfg {:source source @@ -1899,7 +1906,8 @@ :num num :prepend-level? true})) -(defn subclass-cantrip-selection [spell-lists spells-map class-key class-name ability spells num] +;; dead — only called from deprecated ua_sorcerer.cljc +#_(defn subclass-cantrip-selection [spell-lists spells-map class-key class-name ability spells num] (spell-selection spell-lists spells-map @@ -1997,7 +2005,8 @@ (traits-modifiers traits nil source) (when source [(modifiers/used-resource source name)]))}))) -(defn ability-modifiers [abilities] +;; unreferenced — inline (map modifiers/ability ...) used at call sites +#_(defn ability-modifiers [abilities] (map (fn [[k v]] (modifiers/ability k v)) @@ -2188,7 +2197,6 @@ armor-proficiencies weapon-proficiencies profs - source plugin? edit-event] :as race}] @@ -2239,12 +2247,14 @@ (weapon-prof-modifiers weapon-proficiencies) (when source [(modifiers/used-resource source name)]))}))) -(defn add-sources [source background] +;; dead — only called from #_ discarded block in template.cljc +#_(defn add-sources [source background] (-> background (assoc :source source) (update :traits (fn [traits] (map (fn [t] (assoc t :source source)) traits))))) -(def artisans-tools-choice-cfg +;; dead — only called from #_ discarded backgrounds in template.cljc and deprecated scag.cljc +#_(def artisans-tools-choice-cfg {:name "Artisan's Tool" :options (zipmap (map :key equipment/artisans-tools) (repeat 1))}) @@ -2597,7 +2607,8 @@ (defn level-name [index] (str "Level " index)) -(defn subclass-level-option [{:keys [name +;; unreferenced — subclass-option builds level options inline +#_(defn subclass-level-option [{:keys [name levels] :as subcls} kw spellcasting-template @@ -3030,7 +3041,8 @@ :yuan-ti-pureblood {:name "Yuan-Ti Pureblood" :languages [:abyssal :draconic]}}) -(defn druid-cantrip-selection [spell-lists spells-map class-nm] +;; dead — only called from deprecated ua_race_feats.cljc +#_(defn druid-cantrip-selection [spell-lists spells-map class-nm] (t/selection-cfg {:name "Druid Cantrip" :tags #{:spells} @@ -3070,7 +3082,8 @@ (get-in @(subscribe [::character/spells-known nil c]) [0 ["Warlock" :eldritch-blast]])))) -(defn deep-gnome-option-cfg [key source page] +;; dead — only called from #_ discarded blocks in template.cljc +#_(defn deep-gnome-option-cfg [key source page] {:name "Gnome" :plugin? true :subraces @@ -3085,7 +3098,8 @@ :page page :summary "Advantage on hide checks in rocky terrain"}]}]}) -(defmacro eldritch-invocation-option [{:keys [name summary source page prereqs modifiers trait-type frequency range]}] +;; dead — only called from deprecated ua_warlock_and_wizard.cljc / ua_revised_class_options.cljc +#_(defmacro eldritch-invocation-option [{:keys [name summary source page prereqs modifiers trait-type frequency range]}] `(t/option-cfg {:name ~name :prereqs ~prereqs diff --git a/src/cljc/orcpub/dnd/e5/template.cljc b/src/cljc/orcpub/dnd/e5/template.cljc index f2607738..61ba6a01 100644 --- a/src/cljc/orcpub/dnd/e5/template.cljc +++ b/src/cljc/orcpub/dnd/e5/template.cljc @@ -23,7 +23,7 @@ [orcpub.dnd.e5.template-base :as t-base] #_[orcpub.dnd.e5.templates.scag :as scag] #_[orcpub.dnd.e5.templates.ua-base :as ua] - [re-frame.core :refer [subscribe dispatch]])) + #_[re-frame.core :refer [subscribe dispatch]])) (def character {::entity/options {:ability-scores {::entity/key :standard-scores @@ -31,13 +31,15 @@ :class [{::entity/key :barbarian ::entity/options {:levels [{::entity/key :level-1}]}}]}}) -(defn set-ability! [app-state ability-key ability-value] +;; dead — ability roller UI superseded by character_builder.cljs +#_(defn set-ability! [app-state ability-key ability-value] (swap! app-state assoc-in [:character ::entity/options :ability-scores ::entity/value ability-key] ability-value)) -(defn swap-abilities [app-state i other-i k v] +;; dead — ability roller UI superseded by character_builder.cljs +#_(defn swap-abilities [app-state i other-i k v] (fn [] (swap! app-state update-in @@ -69,14 +71,16 @@ [:img {:class-name (str "h-" size " w-" size (when light-theme? " opacity-7")) :src (str (if light-theme? "/image/black/" "/image/") (ability-icons k) ".svg")}])) -(defn ability-modifier [v] +;; dead — ability roller UI superseded by character_builder.cljs +#_(defn ability-modifier [v] [:div.f-6-12.f-w-n.h-24 [:div.t-a-c.f-s-10.opacity-5 "mod"] [:div.m-t--1 (opt5e/ability-bonus-str v)]]) -(defn ability-component [k v i app-state controls] +;; dead — ability roller UI superseded by character_builder.cljs +#_(defn ability-component [k v i app-state controls] [:div.m-t-10.t-a-c (ability-icon k 24 @(subscribe [:theme])) [:div.uppercase (name k)] @@ -84,7 +88,8 @@ (ability-modifier v) controls]) -(defn abilities-standard [app-state] +;; dead — ability roller UI superseded by character_builder.cljs +#_(defn abilities-standard [app-state] [:div.flex.justify-cont-s-b (let [abilities (or (opt5e/get-raw-abilities app-state) (char5e/abilities 15 14 13 12 10 8)) abilities-vec (vec abilities)] @@ -100,7 +105,8 @@ {:on-click (swap-abilities app-state i (inc i) k v)}]]]) abilities-vec)))]) -(defn abilities-roller [app-state reroll-fn] +;; dead — zero callers (character_builder.cljs has its own abilities-roller) +#_(defn abilities-roller [app-state reroll-fn] [:div (abilities-standard app-state) [:button.form-button.m-t-5 @@ -109,7 +115,8 @@ (.stopPropagation e))} "Re-Roll"]]) -(def score-costs +;; dead — ability roller UI superseded by character_builder.cljs +#_(def score-costs {8 0 9 1 10 2 @@ -119,10 +126,12 @@ 14 7 15 9}) -(def point-buy-points 27) +;; dead — ability roller UI superseded by character_builder.cljs +#_(def point-buy-points 27) -(defn point-buy-abilities [app-state] +;; dead — zero callers (character_builder.cljs has its own point-buy-abilities) +#_(defn point-buy-abilities [app-state] (let [abilities (or (opt5e/get-raw-abilities app-state) (char5e/abilities 8 8 8 8 8 8)) abilities-vec (vec (map (fn [[a v]] [a (-> v (min 15) (max 8))]) abilities)) @@ -1274,7 +1283,8 @@ :modifiers [(modifier-fn key item)]}))) items)})) -(defn amazon-frame [link] +;; dead — all amazon affiliate frame defs are #_ discarded +#_(defn amazon-frame [link] [:iframe {:style {:width "120px" :height "240px"} :margin-width 0 :margin-height 0 @@ -1282,7 +1292,8 @@ :frame-border 0 :src link}]) -(defn content-list [options] +;; dead — only called from #_ discarded plugins block +#_(defn content-list [options] [:ul.m-t-5 (doall (map @@ -1297,7 +1308,8 @@ #_(def volos-amazon-frame (amazon-frame "//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=tf_til&ad_type=product_link&tracking_id=orcpub-20&marketplace=amazon®ion=US&placement=0786966017&asins=0786966017&linkId=8c552e7b980d7d944bd12dec57e002e8&show_border=false&link_opens_in_new_window=true&price_color=ffffff&title_color=f0a100&bg_color=2c3445")) -(def phb-amazon-frame +;; dead — only called from #_ discarded plugins block +#_(def phb-amazon-frame (amazon-frame "//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=qf_sp_asin_til&ad_type=product_link&tracking_id=orcpub-20&marketplace=amazon®ion=US&placement=0786965606&asins=0786965606&linkId=3b5b686390559c31dbc3c20d20f37ec4&show_border=false&link_opens_in_new_window=true&price_color=ffffff&title_color=f0a100&bg_color=2c3445")) #_(def dmg-amazon-frame @@ -1306,7 +1318,8 @@ #_(def cos-amazon-frame (amazon-frame "//ws-na.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&OneJS=1&Operation=GetAdHtml&MarketPlace=US&source=ac&ref=qf_sp_asin_til&ad_type=product_link&tracking_id=orcpub-20&marketplace=amazon®ion=US&placement=0786965983&asins=0786965983&linkId=91dfcae14b0c8ecd3795eaf375104ca5&show_border=false&link_opens_in_new_window=true&price_color=ffffff&title_color=f0a100&bg_color=2c3445")) -(defn amazon-frame-help [frame content] +;; dead — only called from #_ discarded plugins block +#_(defn amazon-frame-help [frame content] [:div.flex.m-t-10 [:div.flex-grow-1.p-r-5 content] @@ -1456,7 +1469,8 @@ [:td 15] [:td 9]]]]]) -(defn custom-race-builder [] +;; dead — zero callers (options.cljc has its own custom-race-builder) +#_(defn custom-race-builder [] [:div.m-t-10 [:span "Name"] [:input.input diff --git a/src/cljs/orcpub/character_builder.cljs b/src/cljs/orcpub/character_builder.cljs index c15dbe7d..5815f504 100644 --- a/src/cljs/orcpub/character_builder.cljs +++ b/src/cljs/orcpub/character_builder.cljs @@ -1464,11 +1464,11 @@ [:div.m-t-5 [:span.pointer.underline.orange {:on-click #(dispatch [:route routes/dnd-e5-race-builder-page-route])} - (str "CLICK HERE TO ADD A RACE")]] + "CLICK HERE TO ADD A RACE"]] [:div.m-t-5 [:span.pointer.underline.orange {:on-click #(dispatch [:route routes/dnd-e5-subrace-builder-page-route])} - (str "CLICK HERE TO ADD A SUBRACE")]]])) + "CLICK HERE TO ADD A SUBRACE"]]])) (defn add-feat-component [] (add-item-component "feat" routes/dnd-e5-feat-builder-page-route)) @@ -1479,11 +1479,11 @@ [:div.m-t-5 [:span.pointer.underline.orange {:on-click #(dispatch [:route routes/dnd-e5-class-builder-page-route])} - (str "CLICK HERE TO ADD A CLASS")]] + "CLICK HERE TO ADD A CLASS"]] [:div.m-t-5 [:span.pointer.underline.orange {:on-click #(dispatch [:route routes/dnd-e5-subclass-builder-page-route])} - (str "CLICK HERE TO ADD A SUBCLASS")]]])) + "CLICK HERE TO ADD A SUBCLASS"]]])) (def pages [{:name "Race" diff --git a/src/cljs/orcpub/dnd/e5/db.cljs b/src/cljs/orcpub/dnd/e5/db.cljs index 1fe51720..2d9afd7d 100644 --- a/src/cljs/orcpub/dnd/e5/db.cljs +++ b/src/cljs/orcpub/dnd/e5/db.cljs @@ -274,7 +274,8 @@ local-storage-magic-item-key ::mi5e/internal-magic-item) -(def musical-instrument-choice-cfg +;; dead — duplicate of classes.cljc def, never referenced from .cljs code +#_(def musical-instrument-choice-cfg {:name "Musical Instrument" :options (zipmap (map :key equip5e/musical-instruments) (repeat 1))}) diff --git a/src/cljs/orcpub/dnd/e5/events.cljs b/src/cljs/orcpub/dnd/e5/events.cljs index 25376cc9..a81e9720 100644 --- a/src/cljs/orcpub/dnd/e5/events.cljs +++ b/src/cljs/orcpub/dnd/e5/events.cljs @@ -47,7 +47,6 @@ subclass->local-store class->local-store plugins->local-store - tab-path default-character default-spell default-monster @@ -284,7 +283,8 @@ (fn [_] (random-hit-points-option (char5e/levels built-char) class-kw)))}) -(def max-iterations 100) +;; unreferenced — random-character loop hardcodes 10 +#_(def max-iterations 100) (defn keep-options [built-template entity option-paths] (reduce @@ -343,7 +343,8 @@ (fn [_ [_ character built-template locked-components]] {:dispatch [:set-random-character character built-template locked-components]})) -(def dnd-5e-characters-path [:dnd :e5 :characters]) +;; unreferenced — character path is constructed inline +#_(def dnd-5e-characters-path [:dnd :e5 :characters]) (reg-event-fx :character-save-success @@ -1123,7 +1124,8 @@ ::char5e/image-url-failed nil))) -(reg-event-db +;; never dispatched from UI +#_(reg-event-db :toggle-public character-interceptors (fn [character _] @@ -1428,10 +1430,12 @@ (fn [db [_ user-data]] (assoc db :user user-data))) -(defn set-active-tabs [db [_ active-tabs]] +;; never dispatched from UI +#_(defn set-active-tabs [db [_ active-tabs]] (assoc-in db tab-path active-tabs)) -(reg-event-db +;; never dispatched from UI +#_(reg-event-db :set-active-tabs set-active-tabs) @@ -1656,7 +1660,8 @@ (fn [cofx [_ response]] {:dispatch [:clear-login]})) -(defn validate-registration []) +;; dead stub — real impl is orcpub.registration/validate-registration +#_(defn validate-registration []) (reg-event-db :email-taken @@ -1668,7 +1673,8 @@ (fn [db [_ response]] (assoc db :username-taken? (-> response :body (= "true"))))) -(reg-event-db +;; never dispatched — registration form uses :register-first-and-last-name +#_(reg-event-db :registration-first-and-last-name (fn [db [_ first-and-last-name]] (assoc-in db [:registration-form :first-and-last-name] first-and-last-name))) @@ -1700,7 +1706,8 @@ (fn [db [_ send-updates?]] (assoc-in db [:registration-form :send-updates?] send-updates?))) -(reg-event-db +;; never dispatched from UI +#_(reg-event-db :register-first-and-last-name (fn [db [_ first-and-last-name]] (assoc-in db [:registration-form :first-and-last-name] first-and-last-name))) @@ -1769,7 +1776,8 @@ :on-success [:send-password-reset-success] :on-failure [:send-password-reset-failure]}})) -(reg-event-db +;; never dispatched — character loading uses :load-user-data flow +#_(reg-event-db :load-characters-success (fn [db [_ response]] (assoc-in db [:dnd :e5 :characters] (:body response)))) @@ -2016,7 +2024,8 @@ :login-message-shown? true :login-message message))) -(reg-event-db +;; never dispatched from UI +#_(reg-event-db :hide-warning (fn [db _] (assoc db :warning-hidden true))) @@ -2048,7 +2057,8 @@ :subrace subrace :sex sex})}))) -(defn remove-subtypes [subtypes hidden-subtypes] +;; unreferenced +#_(defn remove-subtypes [subtypes hidden-subtypes] (let [result (sets/difference subtypes hidden-subtypes)] result)) @@ -2118,7 +2128,8 @@ (assoc :orcacle-clicked? false) (dissoc :search-text)))) -(reg-event-fx +;; never dispatched from UI (note: "orcacle" typo) +#_(reg-event-fx :open-orcacle-over-character-builder (fn [] {:dispatch-n [[:route routes/dnd-e5-char-builder-route] @@ -2423,7 +2434,8 @@ "dark-theme" "light-theme"))))) -(reg-event-db +;; never dispatched from UI +#_(reg-event-db ::mi/set-builder-item [magic-item->local-store-interceptor] (fn [db [_ magic-item]] @@ -2854,7 +2866,8 @@ (fn [subclass [_ class-spells-key level index spell-kw]] (assoc-in subclass [class-spells-key level index] spell-kw))) -(reg-event-db +;; never dispatched from UI +#_(reg-event-db ::class5e/set-spell-list subclass-interceptors (fn [subclass [_ class-kw]] @@ -2866,7 +2879,8 @@ (fn [feat [_ prop-key prop-value]] (assoc feat prop-key prop-value))) -(reg-event-db +;; never dispatched from UI +#_(reg-event-db ::bg5e/set-feature-prop background-interceptors (fn [background [_ prop-key prop-value]] @@ -2878,7 +2892,8 @@ (fn [feat [_ key]] (update-in feat [:props key] not))) -(reg-event-db +;; never dispatched from UI — feat builder uses toggle-feat-prop instead +#_(reg-event-db ::feats5e/toggle-feat-selection feat-interceptors (fn [feat [_ key]] @@ -2908,7 +2923,8 @@ (dissoc m key) (assoc m key num)))))) -(reg-event-db +;; never dispatched — class/subclass builder UI not wired for value-prop toggles +#_(reg-event-db ::class5e/toggle-subclass-value-prop subclass-interceptors (fn [subclass [_ key num]] @@ -2917,7 +2933,8 @@ (dissoc m key) (assoc m key num)))))) -(reg-event-db +;; never dispatched — class builder UI not wired for value-prop toggles +#_(reg-event-db ::class5e/toggle-class-value-prop class-interceptors (fn [class [_ key num]] @@ -2950,7 +2967,8 @@ (fn [class [_ prop-path prop-value]] (update-in class prop-path not))) -(reg-event-db +;; never dispatched — class builder UI not wired for prof toggles +#_(reg-event-db ::class5e/toggle-class-prof class-interceptors (fn [class [_ prop-path]] @@ -2985,19 +3003,22 @@ (fn [race [_ key value]] (update-in race [:props key value] not))) -(reg-event-db +;; never dispatched — class builder UI not wired for subclass map-prop toggles +#_(reg-event-db ::class5e/toggle-subclass-map-prop subclass-interceptors (fn [subclass [_ key value]] (update-in subclass [:props key value] not))) -(reg-event-db +;; never dispatched — class builder UI not wired for class map-prop toggles +#_(reg-event-db ::class5e/toggle-class-map-prop class-interceptors (fn [class [_ key value]] (update-in class [:props key value] not))) -(reg-event-db +;; never dispatched — background builder UI not wired for map-prop toggles +#_(reg-event-db ::bg5e/toggle-background-map-prop background-interceptors (fn [background [_ key value]] @@ -3390,7 +3411,7 @@ (let [blob (js/Blob. (clj->js [(str @(subscribe [::e5/plugins]))]) (clj->js {:type "text/plain;charset=utf-8"}))] - (js/saveAs blob (str "all-content.orcbrew")) + (js/saveAs blob "all-content.orcbrew") {}))) (reg-event-fx @@ -3407,7 +3428,7 @@ (let [blob (js/Blob. (clj->js [(with-out-str (pprint/pprint @(subscribe [::e5/plugins])))]) (clj->js {:type "text/plain;charset=utf-8"}))] - (js/saveAs blob (str "all-content.orcbrew")) + (js/saveAs blob "all-content.orcbrew") {}))) (reg-event-fx diff --git a/src/cljs/orcpub/dnd/e5/subs.cljs b/src/cljs/orcpub/dnd/e5/subs.cljs index 320235da..da1312e4 100644 --- a/src/cljs/orcpub/dnd/e5/subs.cljs +++ b/src/cljs/orcpub/dnd/e5/subs.cljs @@ -449,7 +449,8 @@ {} folders))) -(reg-sub +;; dead — never subscribed to; events.cljs accesses ::char5e/summary-map directly +#_(reg-sub ::char5e/summary-map (fn [[_ login-optional?]] (subscribe [::char5e/characters login-optional?])) diff --git a/src/cljs/orcpub/dnd/e5/views.cljs b/src/cljs/orcpub/dnd/e5/views.cljs index 442bc441..16221e73 100644 --- a/src/cljs/orcpub/dnd/e5/views.cljs +++ b/src/cljs/orcpub/dnd/e5/views.cljs @@ -155,7 +155,8 @@ (defn dispatch-route-to-my-account [e] (dispatch [:route :my-account])) -(def header-tab-style +;; dead — zero callers +#_(def header-tab-style {:width "85px"}) (def active-style {:background-color "rgba(240, 161, 0, 0.7)"}) @@ -169,7 +170,8 @@ :top 84 :right 0}) -(def desktop-menu-item-style +;; dead — zero callers +#_(def desktop-menu-item-style (assoc header-menu-item-style :width "100%")) @@ -303,14 +305,16 @@ :background-color :transparent :color :white}) -(def search-icon-style +;; dead — zero callers +#_(def search-icon-style {:top 6 :right 25}) (def search-input-parent-style {:background-color "rgba(0,0,0,0.15)"}) -(def transparent-search-input-style +;; dead — zero callers +#_(def transparent-search-input-style (assoc search-input-style :color :transparent)) (defn route-to-default-route [] @@ -1125,7 +1129,7 @@ (str (when (pos? level) (str (common/ordinal level) "-level")) " " - (str (common/safe-capitalize school) (if ritual " (can be cast as ritual)" "")) + (str (common/safe-capitalize school) (when ritual " (can be cast as ritual)")) (when (zero? level) " cantrip"))]]) @@ -1464,16 +1468,20 @@ [:p "Version " (v/version) " (" (v/date) ") " (v/description) " edition"]]] [debug-data]]]])]))}))) -(def row-style +;; dead — zero callers +#_(def row-style {:border-bottom "1px solid rgba(255,255,255,0.5)"}) -(def light-row-style +;; dead — zero callers +#_(def light-row-style {:border-bottom "1px solid rgba(0,0,0,0.5)"}) -(def list-style +;; dead — zero callers +#_(def list-style {:border-top "2px solid rgba(255,255,255,0.5)"}) -(def thumbnail-style +;; dead — zero callers +#_(def thumbnail-style {:height "100px" :max-width "200px"}) @@ -1597,7 +1605,8 @@ true true))) -(defn realize-char [built-char] +;; dead — character_builder.cljs has its own realize-char +#_(defn realize-char [built-char] (reduce-kv (fn [m k v] (let [realized-value (es/entity-val built-char k)] @@ -1607,7 +1616,8 @@ (sorted-map) built-char)) -(def summary-style +;; dead — zero callers +#_(def summary-style {:padding "33px 0"}) @@ -1637,7 +1647,8 @@ values)] true))) -(defn svg-icon-section [title icon-name content] +;; dead — zero callers +#_(defn svg-icon-section [title icon-name content] [:div.m-t-20 [:span.f-s-16.f-w-600 title] [:div.flex.align-items-c @@ -1651,7 +1662,8 @@ ((or name-fn :name) item)) items)]) -(defn compare-spell [spell-1 spell-2] +;; dead — zero callers +#_(defn compare-spell [spell-1 spell-2] (let [key-fn (juxt :key :ability)] (compare (key-fn spell-1) (key-fn spell-2)))) @@ -2068,7 +2080,8 @@ [[finish-long-rest-button id] (when (contains? classes :warlock) [finish-short-rest-button-warlock id])]])) -(defn equipment-section [title icon-name equipment equipment-map] +;; dead — zero callers +#_(defn equipment-section [title icon-name equipment equipment-map] [list-display-section title icon-name (map (fn [[equipment-kw {item-qty ::char-equip/quantity @@ -2216,10 +2229,12 @@ (str (name value) (when qualifier (str " (" qualifier ")")))) -(def no-https-images "Sorry, we don't currently support images that start with https") +;; dead — zero callers +#_(def no-https-images "Sorry, we don't currently support images that start with https") -(defn default-image [race classes] - (when (and (or (= "Human" race) +;; dead — zero callers +#_(defn default-image [race classes] + (if (and (or (= "Human" race) (nil? race)) (= :barbarian (first classes))) "/image/barbarian.png")) @@ -3698,7 +3713,8 @@ on-change attrs])) -(defn select-builder-field [name value on-change children] +;; dead — zero callers +#_(defn select-builder-field [name value on-change children] (base-builder-field name (cond-> [:select.builder-option.builder-option-dropdown @@ -3709,7 +3725,8 @@ (defn input-builder-field [name value on-change attrs] [builder-field :input name value on-change attrs]) -(defn text-field [{:keys [value on-change]}] +;; dead — zero callers +#_(defn text-field [{:keys [value on-change]}] [comps/input-field :input value @@ -4930,7 +4947,8 @@ (defn feat-damage-resistance [feat] (option-damage-resistance feat ::feats/toggle-feat-map-prop)) -(defn subrace-damage-resistance [subrace] +;; dead — zero callers +#_(defn subrace-damage-resistance [subrace] (option-damage-resistance subrace ::feats/toggle-subrace-map-prop)) (defn feat-misc-modifiers [feat] @@ -5005,7 +5023,8 @@ (doseq [plugin-name (keys plugins)] (js/console.log plugin-name)))) -(def option-pack-styles +;; dead — zero callers +#_(def option-pack-styles {:class-name "flex-grow-1 m-l-5 m-b-20" :name "option-pack"}) @@ -5084,7 +5103,8 @@ [:div [option-skill-proficiency-or-expertise feat ::feats/toggle-feat-map-prop]] [:div [option-tool-proficiency-or-expertise feat ::feats/toggle-feat-map-prop]]])) -(defn selection-selector [index selection-cfg value-change-event] +;; dead — zero callers +#_(defn selection-selector [index selection-cfg value-change-event] (let [selections @(subscribe [::selections/plugin-selections])] [:div.flex [:div.m-r-5 @@ -6646,9 +6666,12 @@ [:monsters index :num] (js/parseInt %)])) -(def rounds-per-minute 10) -(def minutes-per-hour 60) -(def hours-per-day 24) +;; dead — duplicates of common.cljc defs, never referenced from views +#_(def rounds-per-minute 10) +;; dead — duplicates of common.cljc defs, never referenced from views +#_(def minutes-per-hour 60) +;; dead — duplicates of common.cljc defs, never referenced from views +#_(def hours-per-day 24) (def w-155 {:style {:width "155px"}}) (def w-160 {:style {:width "160px"}}) @@ -7126,11 +7149,11 @@ ) )) -(def invalid-styling +;; dead — zero callers +#_(def invalid-styling {:color "red" :font-size "12px" - :display "block"} - ) + :display "block"}) (defn valid-wel [name] (when-let [messages (validate-name name)] @@ -7503,100 +7526,99 @@ [my-content]]]) (defn my-account-page [] - (r/with-let [editing? (r/atom false) - new-email (r/atom "") - confirm-email (r/atom "")] - (let [current-email @(subscribe [:email]) - pending-email @(subscribe [:pending-email]) - sent? @(subscribe [:email-change-sent?]) - error @(subscribe [:email-change-error]) - ;; Client-side validation: format check + confirm match - bad-format? (and (seq @new-email) - (registration/bad-email? @new-email)) - emails-dont-match? (and (seq @confirm-email) - (not= @new-email @confirm-email)) - can-submit? (and (seq @new-email) - (not bad-format?) - (= @new-email @confirm-email))] - [content-page - "My Account" - [{:title (str "Delete Account") - :icon "trash" - :on-click #(dispatch - [:show-confirmation - {:confirm-button-text "DELETE ACCOUNT" - :question "Are you sure you want to delete your account, characters, and associated data?" - :event [:delete-account]}])}] - [:div.f-s-24.p-10.white - [:div.p-5 - [:span.f-w-b "Username: "] - [:span @(subscribe [:username])]] - [:div.p-5 - [:span.f-w-b "Email: "] - (cond - sent? - [:div - [:span current-email] - [:div.m-t-5.f-s-14 "A verification email has been sent to " [:strong pending-email] ". Click the link in that email to confirm the change."] - [:button.link-button.m-t-5.f-s-14 - {:on-click #(do (reset! editing? true) - (reset! new-email "") - (reset! confirm-email "") - (dispatch [:change-email-clear]))} - "Change again"]] - - @editing? - [:div.m-t-5 - [:input.input - {:type :email - :value @new-email - :placeholder "New email address" - :on-change #(reset! new-email (event-value %))}] - (when bad-format? - [:div.m-t-5.red "Not a valid email format"]) - ;; Confirm field to prevent typo-induced lockout - [:input.input.m-t-5 - {:type :email - :value @confirm-email - :placeholder "Confirm new email address" - :on-change #(reset! confirm-email (event-value %))}] - (when emails-dont-match? - [:div.m-t-5.red "Email addresses don't match"]) - [:div.m-t-5 - [:button.form-button - {:disabled (not can-submit?) - :on-click #(when can-submit? - (dispatch [:change-email @new-email]))} - "Save"] - [:button.link-button.m-l-10 - {:on-click #(do (reset! editing? false) - (reset! new-email "") - (reset! confirm-email "") - (dispatch [:change-email-clear]))} - "Cancel"]] - (when error - [:div.m-t-5.red error])] - - :else - [:div - [:span current-email] - (when pending-email - [:div.m-t-5.f-s-14 - "Pending: " pending-email " — check your email to verify the change. " - ;; Resend uses the same change-email flow; server enforces 3-zone rate limit - ;; (0–1 min blocked, 1–5 min free resend, 5+ min open) - [:button.link-button.f-s-14 - {:on-click #(dispatch [:change-email pending-email])} - "Resend"] - (when error - [:span.m-l-5.red.f-s-14 error])]) - [:button.link-button.m-l-10 - {:on-click #(do (reset! editing? true) - (reset! new-email "") - (reset! confirm-email "") - (dispatch [:change-email-clear]))} - "Change"]])]]]))) - + (r/with-let [editing? (r/atom false) + new-email (r/atom "") + confirm-email (r/atom "")] + (let [current-email @(subscribe [:email]) + pending-email @(subscribe [:pending-email]) + sent? @(subscribe [:email-change-sent?]) + error @(subscribe [:email-change-error]) + ;; Client-side validation: format check + confirm match + bad-format? (and (seq @new-email) + (registration/bad-email? @new-email)) + emails-dont-match? (and (seq @confirm-email) + (not= @new-email @confirm-email)) + can-submit? (and (seq @new-email) + (not bad-format?) + (= @new-email @confirm-email))] + [content-page + "My Account" + [{:title (str "Delete Account") + :icon "trash" + :on-click #(dispatch + [:show-confirmation + {:confirm-button-text "DELETE ACCOUNT" + :question "Are you sure you want to delete your account, characters, and associated data?" + :event [:delete-account]}])}] + [:div.f-s-24.p-10.white + [:div.p-5 + [:span.f-w-b "Username: "] + [:span @(subscribe [:username])]] + [:div.p-5 + [:span.f-w-b "Email: "] + (cond + sent? + [:div + [:span current-email] + [:div.m-t-5.f-s-14 "A verification email has been sent to " [:strong pending-email] ". Click the link in that email to confirm the change."] + [:button.link-button.m-t-5.f-s-14 + {:on-click #(do (reset! editing? true) + (reset! new-email "") + (reset! confirm-email "") + (dispatch [:change-email-clear]))} + "Change again"]] + + @editing? + [:div.m-t-5 + [:input.input + {:type :email + :value @new-email + :placeholder "New email address" + :on-change #(reset! new-email (event-value %))}] + (when bad-format? + [:div.m-t-5.red "Not a valid email format"]) + ;; Confirm field to prevent typo-induced lockout + [:input.input.m-t-5 + {:type :email + :value @confirm-email + :placeholder "Confirm new email address" + :on-change #(reset! confirm-email (event-value %))}] + (when emails-dont-match? + [:div.m-t-5.red "Email addresses don't match"]) + [:div.m-t-5 + [:button.form-button + {:disabled (not can-submit?) + :on-click #(when can-submit? + (dispatch [:change-email @new-email]))} + "Save"] + [:button.link-button.m-l-10 + {:on-click #(do (reset! editing? false) + (reset! new-email "") + (reset! confirm-email "") + (dispatch [:change-email-clear]))} + "Cancel"]] + (when error + [:div.m-t-5.red error])] + + :else + [:div + [:span current-email] + (when pending-email + [:div.m-t-5.f-s-14 + "Pending: " pending-email " — check your email to verify the change. " + ;; Resend uses the same change-email flow; server enforces 3-zone rate limit + ;; (0–1 min blocked, 1–5 min free resend, 5+ min open) + [:button.link-button.f-s-14 + {:on-click #(dispatch [:change-email pending-email])} + "Resend"] + (when error + [:span.m-l-5.red.f-s-14 error])]) + [:button.link-button.m-l-10 + {:on-click #(do (reset! editing? true) + (reset! new-email "") + (reset! confirm-email "") + (dispatch [:change-email-clear]))} + "Change"]])]]]))) (defn newb-character-builder-page [] [content-page