Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3b7d298
Merge remote-tracking branch 'DMV-orcpub/develop' into develop
codeGlaze Apr 8, 2023
318555d
Merge branch '602-fix-icon-asclepius-svg' into develop
codeGlaze Mar 11, 2024
dad0bba
Merge branch 'develop' of https://github.com/codeglaze/orcpub into de…
codeGlaze Oct 20, 2024
d6a5e11
Merge remote-tracking branch 'DMV-orcpub/develop' into develop
codeGlaze Oct 20, 2024
853b6f6
untracking `.gitignore`
codeGlaze Jan 18, 2025
cf81b0f
Merge remote-tracking branch 'DMV-orcpub/develop' into develop
codeGlaze Jul 26, 2025
41848ee
Lay groundwork for delete button in item builder
codeGlaze Aug 10, 2025
61abcac
Custom Item Delete buttons nearly complete
codeGlaze Aug 11, 2025
b1e4e3c
Responsive `Delete` button for item builer
codeGlaze Aug 13, 2025
4c1b0dc
Tighten `spec/def` and warn about malformed item names
codeGlaze Aug 14, 2025
f70cc18
Fix Item Page Edit + Add Option Source Datalist
codeGlaze Aug 17, 2025
6e06eb4
Genericized `plugin-datalist`
codeGlaze Aug 17, 2025
a3cfac1
Finish Converting Option Source Fields - Refactor Name Validation
codeGlaze Aug 20, 2025
195a27b
Case Insensitive Equipment sort
codeGlaze Aug 21, 2025
b3ddbe0
Add `aloof-sort-by` - case insensitive alphanumeric sorting
codeGlaze Aug 24, 2025
ab8d4cf
FIXED saving from the popdown banner
codeGlaze Aug 24, 2025
54f75db
Add DMV Firearms and sort weapon proficiency menu
codeGlaze Aug 24, 2025
63ff1e3
Oops, forgot to stage the homebrew firearms
codeGlaze Aug 24, 2025
d78d9a2
Added Light Weapon Property to Item Builder
codeGlaze Aug 25, 2025
647a32d
Cleaning up debug lines and REMs
codeGlaze Aug 25, 2025
45ef969
Only dispatch user/db calls when necessary
codeGlaze Aug 28, 2025
17f7a45
Stopped loading code for `homebrew.orcbrew` on dev builds
codeGlaze Aug 28, 2025
72e6e3a
Removing commented/unused code
codeGlaze Aug 28, 2025
5ec0006
Added extra commentary
codeGlaze Aug 28, 2025
62f6323
Re-tracking project `.gitignore`
codeGlaze Sep 5, 2025
4bfc226
Lock in `clj-kondo` version
codeGlaze Sep 5, 2025
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
36 changes: 0 additions & 36 deletions .gitignore

This file was deleted.

13 changes: 11 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@
:asset-path "/js/compiled/out"
:output-to "resources/public/js/compiled/orcpub.js"
:output-dir "resources/public/js/compiled/out"
:source-map-timestamp true}}}}
:source-map-timestamp true
:pretty-print true
:closure-defines {goog.DEBUG true}
:optimizations :none
}}}}

:figwheel {;; :http-server-root "public" ;; default and assumes "resources"
;; :server-port 3449 ;; default
Expand Down Expand Up @@ -185,9 +189,14 @@
[cider/piggieback "0.4.0"]
[org.clojure/test.check "0.9.0"]
[day8.re-frame/re-frame-10x "0.3.7"]]
:env {:dev-mode "true"}
;; need to add dev source path here to get user.clj loaded
:source-paths ["web/cljs" "src/clj" "src/cljc" "src/cljs" "dev"]
:cljsbuild {:builds {:dev {:compiler {:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}
:cljsbuild {:builds {:dev {:compiler {:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true
goog.DEBUG true
}
:optimizations :none
:pretty-print true
;; To console.log CLJS data-structures make sure you enable devtools in Chrome
;; https://github.com/binaryage/cljs-devtools
:preloads [devtools.preload day8.re-frame-10x.preload]}}}}
Expand Down
1 change: 1 addition & 0 deletions src/clj/orcpub/db/schema.clj
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@
::weapon5e/melee?
::weapon5e/ranged?
::weapon5e/heavy?
::weapon5e/light?
::weapon5e/thrown?
::weapon5e/two-handed?
::weapon5e/finesse?
Expand Down
54 changes: 38 additions & 16 deletions src/clj/orcpub/index.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
(:require [hiccup.page :refer [html5 include-css include-js]]
[orcpub.oauth :as oauth]
[orcpub.dnd.e5.views-2 :as views-2]
[orcpub.favicon :as fi]))
[orcpub.favicon :as fi]
[environ.core :refer [env]]
))

(def devmode? (env :dev-mode))

(defn meta-tag [property content]
(if content
Expand Down Expand Up @@ -124,18 +128,36 @@ html {
(include-js "/js/cookies.js")
(include-css "/assets/font-awesome/5.13.1/css/all.min.css")
(include-css "https://fonts.googleapis.com/css?family=Open+Sans")
[:script " window.start.init({Palette:\"palette7\",Mode:\"banner bottom\",})"]
[:script
"let plugins = localStorage.getItem ('plugins');
if(plugins === null || plugins === '{}')
{
fetch('https://' + window.location.host + '/homebrew.orcbrew')
.then(resp => resp.text())
.then(text => {
if(!text.toUpperCase().includes('NOT FOUND')){
localStorage.setItem('plugins',text);
window.location.reload(false);
}
});
}
"]]))
[:script " window.start.init({Palette:\"palette7\",Mode:\"banner bottom\",})"]
(if devmode?
(println "dev mode - no script")

[:script
"const protocol = window.location.protocol;
const apiUrl = `${protocol}://${window.location.host}`;
const pluginUrl = `${apiUrl}/homebrew.orcbrew`;

let plugins = localStorage.getItem('plugins');
if (plugins === null || plugins === '{}') {
fetch(pluginUrl)
.then(resp => {
if (!resp.ok) {
throw new Error(`Failed to fetch plugins: ${resp.status} ${resp.statusText}`);
}
return resp.text();
})
.then(text => {
if (!text.toUpperCase().includes('NOT FOUND')) {
localStorage.setItem('plugins', text);
window.location.reload(false);
}
})
.catch(error => {
console.error('Error fetching plugins:', error);
// You can also add a fallback or default behavior here
});
}
"]
)
]))

49 changes: 45 additions & 4 deletions src/clj/orcpub/styles/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -933,8 +933,7 @@
{:background-color "rgba(0, 0, 0, 0.5)"
:-webkit-backdrop-filter "blur(3px)"
:backdrop-filter "blur(3px)"
:border-radius "5px"
}]
:border-radius "5px"}]

[:.header-tab.mobile
[:.title
Expand Down Expand Up @@ -1291,10 +1290,52 @@
[:table.striped
[:tr
[(s/& (s/nth-child :even))
{:background-color "rgba(0, 0, 0, 0.1)"}]]]]]
{:background-color "rgba(0, 0, 0, 0.1)"}]]]]

;;;; "Modal" styles
[:.modal-container
{:background-image "linear-gradient(to right, #d35730, #eda41e)"
:padding ".5em 2em"}]

[:.modal-container :.m-b-10,
:.modal-container :.link-button
{:font-weight "bold"}]

[:.modal-container :.link-button
{:color "#f7c257"
;:font-weight "bold"
}]

;;;; WARNING TOOLTIP "warntip"
[:.warntiptext
{:width "20%"
:margin-top "10px"
:background-color "#d94b20"
:color "#fff"
:text-align "center"
:padding "5px 0"
:border-radius "0 0 6px 6px"
:position "absolute"
:border "solid 1px #e96868"
:z-index 1}]

[:.warntip :.warntiptext
[:&:after
{:content "\" \""
:position "absolute"
:bottom "100%" ;; At the bottom of the tooltip
:left "50%"
:margin-left "-5px"
:border-width "10px"
:border-style "solid"
:border-color "transparent transparent #e96868 transparent"}]]];concat-bracket
margin-lefts
margin-tops
widths
font-sizes
props
media-queries))
media-queries) ;concat
);def app


;;);concat;app
4 changes: 4 additions & 0 deletions src/cljc/orcpub/common.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,7 @@
(fn [[k v]] (str (safe-capitalize-kw k) " " (bonus-str v)))
m)))

;; Case Insensitive `sort-by`
(defn aloof-sort-by [sorter coll]
(sort-by (comp s/lower-case sorter) coll)
)
7 changes: 5 additions & 2 deletions src/cljc/orcpub/dnd/e5/magic_items.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
[clojure.set :refer [intersection difference]])
#?(:cljs (:require-macros [orcpub.dnd.e5.modifiers :as mod5e])))

(spec/def ::name string?)
(spec/def ::type keyword?)
;(spec/def ::name string?)
(spec/def ::name (spec/and string? common/starts-with-letter?))
;(spec/def ::type keyword?)
(spec/def ::type (spec/and keyword? common/keyword-starts-with-letter?))
(spec/def ::rarity keyword?)
(spec/def ::description string?)
(spec/def ::magical-attack-bonus int?)
Expand Down Expand Up @@ -231,6 +233,7 @@
::weapons5e/melee?
::weapons5e/ranged?
::weapons5e/heavy?
::weapons5e/light?
::weapons5e/thrown?
::weapons5e/two-handed?
::weapons5e/finesse?
Expand Down
36 changes: 35 additions & 1 deletion src/cljc/orcpub/dnd/e5/weapons.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,47 @@
::thrown true,
::range {::min 5, ::max 15},
:key :net
::special? true}])
::special? true}
;;;;
;; Community Designed Weapons
;;;;
{:name "Firearm, Hand (DMV)",
::damage-type :piercing,
::damage-die 10,
::type :martial,
::damage-die-count 1,
::ranged? true,
::heavy? true,
::range {::min 30, ::max 90},
:key :firearm-hand
::two-handed? false}
{:name "Firearm, Burst (DMV)",
::damage-type :piercing,
::damage-die 6,
::type :martial,
::damage-die-count 2,
::ranged? true,
::heavy? true,
::range {::min 10, ::max 30},
:key :firearm-burst
::two-handed? true}
{:name "Firearm, Long (DMV)",
::damage-type :piercing,
::damage-die 12,
::type :martial,
::damage-die-count 1,
::ranged? true,
::heavy? true,
::range {::min 60, ::max 120},
:key :firearm-long
::two-handed? true}])

(def ammunition
(common/add-keys
[{:name "Arrow" ::type :ammunition :sell-qty 20 :cost {:num 1 :type :gp} :weight "1 lb."}
{:name "Blowgun needle" ::type :ammunition :sell-qty 50 :cost {:num 1 :type :gp} :weight "1 lb."}
{:name "Crossbow bolt" ::type :ammunition :sell-qty 20 :cost {:num 1 :type :gp} :weight "1½ lb."}
{:name "Firearm bullet" ::type :ammunition :sell-qty 20 :cost {:num 2 :type :gp} :weight "1½ lb."}
{:name "Sling bullet" ::type :ammunition :sell-qty 20 :cost {:num 4 :type :cp} :weight "1½ lb."}]))

(def weapons-map
Expand Down
8 changes: 4 additions & 4 deletions src/cljc/orcpub/pdf_spec.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@

(defn traits-fields [built-char]
(let [traits-by-type (group-by :type (es/entity-val built-char :traits))
bonus-actions (sort-by :name (concat (es/entity-val built-char :bonus-actions)
bonus-actions (common/aloof-sort-by :name (concat (es/entity-val built-char :bonus-actions)
(traits-by-type :b-action)))
actions (sort-by :name (concat (es/entity-val built-char :actions)
actions (common/aloof-sort-by :name (concat (es/entity-val built-char :actions)
(traits-by-type :action)))
reactions (sort-by :name (concat (es/entity-val built-char :reactions)
reactions (common/aloof-sort-by :name (concat (es/entity-val built-char :reactions)
(traits-by-type :reaction)))
traits (sort-by :name (traits-by-type nil))
traits (common/aloof-sort-by :name (traits-by-type nil))
traits-str (traits-string traits)
actions? (or (seq bonus-actions)
(seq actions)
Expand Down
3 changes: 2 additions & 1 deletion src/cljs/orcpub/character_builder.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,10 @@
{:name name
:key (or key id)})

;;; selection creator for character builder
(defn inventory-adder [key options selected-keys]
[comps/selection-adder
(sort-by
(common/aloof-sort-by
:name
(sequence
(comp
Expand Down
17 changes: 11 additions & 6 deletions src/cljs/orcpub/dnd/e5/equipment_subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,15 @@
[orcpub.route-map :as routes]
[orcpub.dnd.e5.events :refer [url-for-route] :as events]
[reagent.ratom :as ra]
[clojure.string :as s]
[cljs-http.client :as http]
[cljs.core.async :refer [<!]])
(:require-macros [cljs.core.async.macros :refer [go]]))


(def sorted-items
(delay (sort-by mi5e/name-key mi5e/magic-items)))
(delay (sort-by mi5e/name-key mi5e/magic-items))
)

(defn auth-headers [db]
(let [token (-> db :user-data :token)]
Expand All @@ -36,7 +39,8 @@
(reg-sub-raw
::mi5e/custom-items
(fn [app-db [_ user-data]]
(go (dispatch [:set-loading true])
(if (and (:user @app-db) (:token (:user @app-db)))
(go (dispatch [:set-loading true])
(let [response (<! (http/get (url-for-route routes/dnd-e5-items-route)
{:headers (auth-headers @app-db)}))]
(dispatch [:set-loading false])
Expand All @@ -45,7 +49,7 @@
401 nil ;;(dispatch [:route routes/login-page-route {:secure? true}])
500 (dispatch (events/show-generic-error)))))
(ra/make-reaction
(fn [] (get @app-db ::mi5e/custom-items [])))))
(fn [] (get @app-db ::mi5e/custom-items []))))))
(reg-sub
::mi5e/custom-items
(fn [_ _] [])))
Expand Down Expand Up @@ -193,7 +197,7 @@

(reg-sub
::mi5e/other-magic-items
:<- [::char5e/sorted-items]
:<- [::char5e/sorted-items] ;function relies on state of this sub
(fn [sorted-items _]
(sequence
mi5e/other-magic-items-xform
Expand Down Expand Up @@ -244,15 +248,16 @@
(reg-sub-raw
::mi5e/remote-item
(fn [app-db [_ id]]
(go (dispatch [:set-loading true])
(if (and (:user @app-db) (:token (:user @app-db)))
(go (dispatch [:set-loading true])
(let [response (<! (http/get (url-for-route
routes/dnd-e5-item-route
:id id)
{:headers (auth-headers @app-db)}))]
(dispatch [:set-loading false])
(case (:status response)
200 (dispatch [::mi5e/add-remote-item (:body response)])
500 (dispatch (events/show-generic-error)))))
500 (dispatch (events/show-generic-error))))))
(ra/make-reaction
(fn [] (get-in @app-db [::mi5e/remote-items id] {})))))

Expand Down
Loading
Loading