From 347619eae63bf5b8eb1c5c71e21f092f5de7591c Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Wed, 28 Aug 2024 15:27:23 -0500 Subject: [PATCH] udpate to dnd --- README.org | 18 ++++++++++++++++-- init.el | 18 ++++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/README.org b/README.org index 84ff9852..11b1dbfa 100644 --- a/README.org +++ b/README.org @@ -5461,6 +5461,13 @@ Using emacs to run rpg things (add-to-list 'load-path "/home/chris/dev/emacs-rpgdm/") (use-package rpgdm :config + + (defun chris/dnd-get-table (table range) + "Get a list of the contents of any `table' and use `range' to get the info" + (with-current-buffer + (find-file-noselect "~/docs/notes/20240804T132141--dungeons-and-dragons__area_fun_personal.org") + (org-table-get-remote-range table range))) + (defun chris/dnd-skill-check (&optional skill) "Roll for a skill check using skill or prompting for one." (interactive) @@ -5481,7 +5488,12 @@ Using emacs to run rpg things skill skills :test 'string=)) skills)))) - (message value))) + (rpgdm-roll (concat "1d20" value)))) + + (defun chris/dnd-spell-attack-check () + "roll for a spell attack" + (interactive) + (rpgdm-roll "1d20+9")) :general (chris/leader-keys @@ -5489,7 +5501,9 @@ Using emacs to run rpg things :keymaps 'override "a" '(:ignore t :which-key "RPGDM") "ar" '(rpgdm-roll :which-key "roll") - "aa" '(hydra-rpgdm/body :which-key "hydra"))) + "aa" '(hydra-rpgdm/body :which-key "hydra") + "as" '(chris/dnd-skill-check :which-key "check skill") + "ap" '(chris/dnd-spell-attack-check :which-key "Spell attack"))) #+end_src ** Performance diff --git a/init.el b/init.el index 26678030..b06567af 100644 --- a/init.el +++ b/init.el @@ -4020,6 +4020,13 @@ interfere with the default `bongo-playlist-buffer'." (add-to-list 'load-path "/home/chris/dev/emacs-rpgdm/") (use-package rpgdm :config + + (defun chris/dnd-get-table (table range) + "Get a list of the contents of any `table' and use `range' to get the info" + (with-current-buffer + (find-file-noselect "~/docs/notes/20240804T132141--dungeons-and-dragons__area_fun_personal.org") + (org-table-get-remote-range table range))) + (defun chris/dnd-skill-check (&optional skill) "Roll for a skill check using skill or prompting for one." (interactive) @@ -4040,7 +4047,12 @@ interfere with the default `bongo-playlist-buffer'." skill skills :test 'string=)) skills)))) - (message value))) + (rpgdm-roll (concat "1d20" value)))) + + (defun chris/dnd-spell-attack-check () + "roll for a spell attack" + (interactive) + (rpgdm-roll "1d20+9")) :general (chris/leader-keys @@ -4048,7 +4060,9 @@ interfere with the default `bongo-playlist-buffer'." :keymaps 'override "a" '(:ignore t :which-key "RPGDM") "ar" '(rpgdm-roll :which-key "roll") - "aa" '(hydra-rpgdm/body :which-key "hydra"))) + "aa" '(hydra-rpgdm/body :which-key "hydra") + "as" '(chris/dnd-skill-check :which-key "check skill") + "ap" '(chris/dnd-spell-attack-check :which-key "Spell attack"))) ;; Reduce rendering/line scan work for Emacs by not rendering cursors or regions ;; in non-focused windows.