Unified inventory commands: one entry per category in dispatch
Each category (Zbraně, Výbava, Brnění, Zranění, Podmínky) is now a single command that asks Přidat/Odebrat/Upravit/Munice as needed. Dispatch menu halved from 31 to 26 entries — no more confusion between "Výbava — přidat" and "Výbava — spravovat". Removed SPC G v sub-prefix. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
214
alien-rpg.el
214
alien-rpg.el
@@ -1267,10 +1267,9 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
(alien-rpg--autosave)
|
(alien-rpg--autosave)
|
||||||
(message "Výbava: %s" item))
|
(message "Výbava: %s" item))
|
||||||
|
|
||||||
(defun alien-rpg-add-weapon ()
|
(defun alien-rpg--add-weapon-interactive ()
|
||||||
"Přidej zbraň se všemi parametry."
|
"Interaktivně přidej novou zbraň."
|
||||||
(interactive)
|
(let* ((name (read-string "Název zbraně: "))
|
||||||
(let* ((name (read-string "Zbraň: "))
|
|
||||||
(modifier (read-number "Modifier: " 0))
|
(modifier (read-number "Modifier: " 0))
|
||||||
(damage (read-number "Damage: " 1))
|
(damage (read-number "Damage: " 1))
|
||||||
(range (completing-read "Range: " '("Engaged" "Short" "Medium" "Long" "Extreme") nil t))
|
(range (completing-read "Range: " '("Engaged" "Short" "Medium" "Long" "Extreme") nil t))
|
||||||
@@ -1283,6 +1282,11 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
(alien-rpg--autosave)
|
(alien-rpg--autosave)
|
||||||
(message "Zbraň: %s mod%+d/DMG%d/%s" name modifier damage range)))
|
(message "Zbraň: %s mod%+d/DMG%d/%s" name modifier damage range)))
|
||||||
|
|
||||||
|
(defun alien-rpg-add-weapon ()
|
||||||
|
"Přidej zbraň se všemi parametry."
|
||||||
|
(interactive)
|
||||||
|
(alien-rpg--add-weapon-interactive))
|
||||||
|
|
||||||
(defun alien-rpg-add-armor ()
|
(defun alien-rpg-add-armor ()
|
||||||
"Nastav brnění."
|
"Nastav brnění."
|
||||||
(interactive)
|
(interactive)
|
||||||
@@ -1378,24 +1382,40 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
;; SPRAVA INVENTARE
|
;; SPRAVA INVENTARE
|
||||||
;; ====================================================================
|
;; ====================================================================
|
||||||
|
|
||||||
(defun alien-rpg-manage-gear ()
|
(defun alien-rpg-gear ()
|
||||||
"Spravuj výbavu — odeber předmět."
|
"Výbava — přidat nebo odebrat."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((extra (plist-get alien-rpg-state :extra-gear)))
|
(let* ((extra (plist-get alien-rpg-state :extra-gear))
|
||||||
(if (not extra)
|
(actions (if extra '("Přidat" "Odebrat") '("Přidat")))
|
||||||
(message "(žádná přidaná výbava)")
|
(action (if extra
|
||||||
(let* ((choice (completing-read "Odebrat výbavu: " extra nil t))
|
(completing-read "Výbava: " actions nil t)
|
||||||
|
"Přidat")))
|
||||||
|
(cond
|
||||||
|
((string= action "Přidat")
|
||||||
|
(let ((item (read-string "Nová výbava: ")))
|
||||||
|
(setq alien-rpg-state (plist-put alien-rpg-state :extra-gear
|
||||||
|
(append extra (list item))))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "Výbava: %s" item)))
|
||||||
|
((string= action "Odebrat")
|
||||||
|
(let* ((choice (completing-read "Odebrat: " extra nil t))
|
||||||
(new-list (remove choice extra)))
|
(new-list (remove choice extra)))
|
||||||
(setq alien-rpg-state (plist-put alien-rpg-state :extra-gear new-list))
|
(setq alien-rpg-state (plist-put alien-rpg-state :extra-gear new-list))
|
||||||
(alien-rpg--autosave)
|
(alien-rpg--autosave)
|
||||||
(message "Odebráno: %s" choice)))))
|
(message "Odebráno: %s" choice))))))
|
||||||
|
|
||||||
(defun alien-rpg-manage-weapon ()
|
(defun alien-rpg-weapon ()
|
||||||
"Spravuj zbraně — odeber, uprav munici, nebo přepiš."
|
"Zbraně — přidat, odebrat, upravit munici."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((weapons (plist-get alien-rpg-state :weapons)))
|
(let* ((weapons (plist-get alien-rpg-state :weapons))
|
||||||
(if (not weapons)
|
(actions (if weapons '("Přidat" "Munice" "Upravit" "Odebrat") '("Přidat")))
|
||||||
(message "(žádné zbraně)")
|
(action (if weapons
|
||||||
|
(completing-read "Zbraně: " actions nil t)
|
||||||
|
"Přidat")))
|
||||||
|
(cond
|
||||||
|
((string= action "Přidat")
|
||||||
|
(alien-rpg--add-weapon-interactive))
|
||||||
|
(t
|
||||||
(let* ((names (mapcar (lambda (w)
|
(let* ((names (mapcar (lambda (w)
|
||||||
(format "%s mod%+d/DMG%d/%s/%dks"
|
(format "%s mod%+d/DMG%d/%s/%dks"
|
||||||
(plist-get w :name)
|
(plist-get w :name)
|
||||||
@@ -1404,14 +1424,11 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
(or (plist-get w :range) "?")
|
(or (plist-get w :range) "?")
|
||||||
(or (plist-get w :ammo) 0)))
|
(or (plist-get w :ammo) 0)))
|
||||||
weapons))
|
weapons))
|
||||||
(choice (completing-read "Zbraň: " names nil t))
|
(choice (completing-read "Která zbraň: " names nil t))
|
||||||
(idx (cl-position choice names :test #'string=))
|
(idx (cl-position choice names :test #'string=))
|
||||||
(weapon (nth idx weapons))
|
(weapon (nth idx weapons)))
|
||||||
(action (completing-read
|
|
||||||
(format "%s: " (plist-get weapon :name))
|
|
||||||
'("Munice +/-" "Odebrat" "Upravit") nil t)))
|
|
||||||
(cond
|
(cond
|
||||||
((string= action "Munice +/-")
|
((string= action "Munice")
|
||||||
(let* ((current (or (plist-get weapon :ammo) 0))
|
(let* ((current (or (plist-get weapon :ammo) 0))
|
||||||
(delta (read-number (format "Munice [%d] +/-: " current) -1))
|
(delta (read-number (format "Munice [%d] +/-: " current) -1))
|
||||||
(new-ammo (max 0 (+ current delta))))
|
(new-ammo (max 0 (+ current delta))))
|
||||||
@@ -1428,7 +1445,7 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
(alien-rpg--autosave)
|
(alien-rpg--autosave)
|
||||||
(message "Odebráno: %s" (plist-get weapon :name)))
|
(message "Odebráno: %s" (plist-get weapon :name)))
|
||||||
((string= action "Upravit")
|
((string= action "Upravit")
|
||||||
(let* ((name (read-string "Zbraň: " (plist-get weapon :name)))
|
(let* ((name (read-string "Název: " (plist-get weapon :name)))
|
||||||
(modifier (read-number "Modifier: " (or (plist-get weapon :modifier) 0)))
|
(modifier (read-number "Modifier: " (or (plist-get weapon :modifier) 0)))
|
||||||
(damage (read-number "Damage: " (or (plist-get weapon :damage) 1)))
|
(damage (read-number "Damage: " (or (plist-get weapon :damage) 1)))
|
||||||
(range (completing-read "Range: "
|
(range (completing-read "Range: "
|
||||||
@@ -1443,63 +1460,79 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
(plist-put weapon :ammo ammo)
|
(plist-put weapon :ammo ammo)
|
||||||
(plist-put weapon :weight weight)
|
(plist-put weapon :weight weight)
|
||||||
(alien-rpg--autosave)
|
(alien-rpg--autosave)
|
||||||
(message "Upraveno: %s mod%+d/DMG%d/%s" name modifier damage range))))))))
|
(message "Upraveno: %s mod%+d/DMG%d/%s" name modifier damage range)))))))))
|
||||||
|
|
||||||
(defun alien-rpg-manage-injury ()
|
(defun alien-rpg-armor ()
|
||||||
"Odeber zranění."
|
"Brnění — nasadit nebo odebrat."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((injuries (plist-get alien-rpg-state :injuries)))
|
(let* ((armor (plist-get alien-rpg-state :armor))
|
||||||
(if (not injuries)
|
(action (if armor
|
||||||
(message "(žádná zranění)")
|
(completing-read "Brnění: " '("Nasadit nové" "Odebrat") nil t)
|
||||||
(let* ((choice (completing-read "Odebrat zranění: " injuries nil t))
|
"Nasadit nové")))
|
||||||
|
(cond
|
||||||
|
((string= action "Nasadit nové")
|
||||||
|
(let* ((name (read-string "Brnění: "))
|
||||||
|
(level (read-number "Level: " 1))
|
||||||
|
(weight (read-number "Weight: " 1))
|
||||||
|
(new-armor (list :name name :level level :weight weight)))
|
||||||
|
(setq alien-rpg-state (plist-put alien-rpg-state :armor new-armor))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "Brnění: %s (L%d/W%d)" name level weight)))
|
||||||
|
((string= action "Odebrat")
|
||||||
|
(setq alien-rpg-state (plist-put alien-rpg-state :armor nil))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "Brnění odebráno.")))))
|
||||||
|
|
||||||
|
(defun alien-rpg-injury ()
|
||||||
|
"Zranění — přidat nebo vyléčit."
|
||||||
|
(interactive)
|
||||||
|
(let* ((injuries (plist-get alien-rpg-state :injuries))
|
||||||
|
(actions (if injuries '("Přidat" "Vyléčit") '("Přidat")))
|
||||||
|
(action (if injuries
|
||||||
|
(completing-read "Zranění: " actions nil t)
|
||||||
|
"Přidat")))
|
||||||
|
(cond
|
||||||
|
((string= action "Přidat")
|
||||||
|
(let ((injury (read-string "Zranění: ")))
|
||||||
|
(setq alien-rpg-state (plist-put alien-rpg-state :injuries
|
||||||
|
(append injuries (list injury))))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "Zranění: %s" injury)))
|
||||||
|
((string= action "Vyléčit")
|
||||||
|
(let* ((choice (completing-read "Vyléčit: " injuries nil t))
|
||||||
(new-list (remove choice injuries)))
|
(new-list (remove choice injuries)))
|
||||||
(setq alien-rpg-state (plist-put alien-rpg-state :injuries new-list))
|
(setq alien-rpg-state (plist-put alien-rpg-state :injuries new-list))
|
||||||
(alien-rpg--autosave)
|
(alien-rpg--autosave)
|
||||||
(message "Vyléčeno: %s" choice)))))
|
(message "Vyléčeno: %s" choice))))))
|
||||||
|
|
||||||
(defun alien-rpg-manage-condition ()
|
(defun alien-rpg-condition ()
|
||||||
"Odeber stav/podmínku."
|
"Stav/podmínka — přidat nebo odebrat."
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((conditions (plist-get alien-rpg-state :conditions)))
|
(let* ((conditions (plist-get alien-rpg-state :conditions))
|
||||||
(if (not conditions)
|
(actions (if conditions '("Přidat" "Odebrat") '("Přidat")))
|
||||||
(message "(žádné stavy)")
|
(action (if conditions
|
||||||
(let* ((choice (completing-read "Odebrat stav: " conditions nil t))
|
(completing-read "Podmínka: " actions nil t)
|
||||||
|
"Přidat")))
|
||||||
|
(cond
|
||||||
|
((string= action "Přidat")
|
||||||
|
(let ((cond-name (read-string "Stav: ")))
|
||||||
|
(setq alien-rpg-state (plist-put alien-rpg-state :conditions
|
||||||
|
(append conditions (list cond-name))))
|
||||||
|
(alien-rpg--autosave)
|
||||||
|
(message "Stav: %s" cond-name)))
|
||||||
|
((string= action "Odebrat")
|
||||||
|
(let* ((choice (completing-read "Odebrat: " conditions nil t))
|
||||||
(new-list (remove choice conditions)))
|
(new-list (remove choice conditions)))
|
||||||
(setq alien-rpg-state (plist-put alien-rpg-state :conditions new-list))
|
(setq alien-rpg-state (plist-put alien-rpg-state :conditions new-list))
|
||||||
(alien-rpg--autosave)
|
(alien-rpg--autosave)
|
||||||
(message "Odebráno: %s" choice)))))
|
(message "Odebráno: %s" choice))))))
|
||||||
|
|
||||||
(defun alien-rpg-manage-armor ()
|
|
||||||
"Odeber brnění."
|
|
||||||
(interactive)
|
|
||||||
(let ((armor (plist-get alien-rpg-state :armor)))
|
|
||||||
(if (not armor)
|
|
||||||
(message "(žádné brnění)")
|
|
||||||
(when (y-or-n-p (format "Odebrat %s? " (plist-get armor :name)))
|
|
||||||
(setq alien-rpg-state (plist-put alien-rpg-state :armor nil))
|
|
||||||
(alien-rpg--autosave)
|
|
||||||
(message "Brnění odebráno.")))))
|
|
||||||
|
|
||||||
(defun alien-rpg-manage-tiny-items ()
|
|
||||||
"Odeber drobný předmět."
|
|
||||||
(interactive)
|
|
||||||
(let ((items (plist-get alien-rpg-state :tiny-items)))
|
|
||||||
(if (not items)
|
|
||||||
(message "(žádné drobné předměty)")
|
|
||||||
(let* ((choice (completing-read "Odebrat: " items nil t))
|
|
||||||
(new-list (remove choice items)))
|
|
||||||
(setq alien-rpg-state (plist-put alien-rpg-state :tiny-items new-list))
|
|
||||||
(alien-rpg--autosave)
|
|
||||||
(message "Odebráno: %s" choice)))))
|
|
||||||
|
|
||||||
;; ====================================================================
|
;; ====================================================================
|
||||||
;; DISPATCH, HELP, VIEW MODE
|
;; DISPATCH, HELP, VIEW MODE
|
||||||
;; ====================================================================
|
;; ====================================================================
|
||||||
|
|
||||||
(defvar alien-rpg--dispatch-commands
|
(defvar alien-rpg--dispatch-commands
|
||||||
'(("Brnění — přidat" . alien-rpg-add-armor)
|
'(("Brnění" . alien-rpg-armor)
|
||||||
("Brnění — spravovat" . alien-rpg-manage-armor)
|
|
||||||
("Deck přehled" . alien-rpg-deck-overview)
|
|
||||||
("Dovednosti" . alien-rpg-skills)
|
("Dovednosti" . alien-rpg-skills)
|
||||||
("Editovat stat" . alien-rpg-set-stat)
|
("Editovat stat" . alien-rpg-set-stat)
|
||||||
("Health +/-" . alien-rpg-set-health)
|
("Health +/-" . alien-rpg-set-health)
|
||||||
@@ -1510,8 +1543,8 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
("Nápověda" . alien-rpg-help)
|
("Nápověda" . alien-rpg-help)
|
||||||
("Najít cestu" . alien-rpg-find-path)
|
("Najít cestu" . alien-rpg-find-path)
|
||||||
("Najít místnost" . alien-rpg-find-room)
|
("Najít místnost" . alien-rpg-find-room)
|
||||||
("Podmínka — přidat" . alien-rpg-add-condition)
|
("Paluba přehled" . alien-rpg-deck-overview)
|
||||||
("Podmínka — odebrat" . alien-rpg-manage-condition)
|
("Podmínka" . alien-rpg-condition)
|
||||||
("Poznámka globální" . alien-rpg-add-note)
|
("Poznámka globální" . alien-rpg-add-note)
|
||||||
("Poznámka k místnosti" . alien-rpg-add-room-note)
|
("Poznámka k místnosti" . alien-rpg-add-room-note)
|
||||||
("Poznámky" . alien-rpg-show-room-notes)
|
("Poznámky" . alien-rpg-show-room-notes)
|
||||||
@@ -1522,12 +1555,9 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
("Stress +/-" . alien-rpg-set-stress)
|
("Stress +/-" . alien-rpg-set-stress)
|
||||||
("Teleport" . alien-rpg-teleport)
|
("Teleport" . alien-rpg-teleport)
|
||||||
("Uložit stav" . alien-rpg-save-state)
|
("Uložit stav" . alien-rpg-save-state)
|
||||||
("Výbava — přidat" . alien-rpg-add-gear)
|
("Výbava" . alien-rpg-gear)
|
||||||
("Výbava — spravovat" . alien-rpg-manage-gear)
|
("Zbraně" . alien-rpg-weapon)
|
||||||
("Zbraň — přidat" . alien-rpg-add-weapon)
|
("Zranění" . alien-rpg-injury))
|
||||||
("Zbraň — spravovat" . alien-rpg-manage-weapon)
|
|
||||||
("Zranění — přidat" . alien-rpg-add-injury)
|
|
||||||
("Zranění — odebrat" . alien-rpg-manage-injury))
|
|
||||||
"Všechny příkazy pro dispatch.")
|
"Všechny příkazy pro dispatch.")
|
||||||
|
|
||||||
(defun alien-rpg-dispatch ()
|
(defun alien-rpg-dispatch ()
|
||||||
@@ -1563,19 +1593,12 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
(insert "SPC G S Stress +/-\n")
|
(insert "SPC G S Stress +/-\n")
|
||||||
(insert "SPC G r Kostky (dice calc)\n")
|
(insert "SPC G r Kostky (dice calc)\n")
|
||||||
(insert "SPC G e Editovat stat/skill\n\n")
|
(insert "SPC G e Editovat stat/skill\n\n")
|
||||||
(insert "--- Inventář přidat ---\n")
|
(insert "--- Inventář (přidat/odebrat/upravit) ---\n")
|
||||||
(insert "SPC G g Přidat výbavu\n")
|
(insert "SPC G g Výbava\n")
|
||||||
(insert "SPC G W Přidat zbraň\n")
|
(insert "SPC G W Zbraně\n")
|
||||||
(insert "SPC G a Přidat brnění\n")
|
(insert "SPC G a Brnění\n")
|
||||||
(insert "SPC G j Přidat zranění\n")
|
(insert "SPC G j Zranění\n")
|
||||||
(insert "SPC G c Přidat podmínku\n\n")
|
(insert "SPC G c Podmínky\n\n")
|
||||||
(insert "--- Inventář spravovat ---\n")
|
|
||||||
(insert "SPC G v g Spravovat výbavu\n")
|
|
||||||
(insert "SPC G v w Spravovat zbraně\n")
|
|
||||||
(insert "SPC G v a Spravovat brnění\n")
|
|
||||||
(insert "SPC G v j Spravovat zranění\n")
|
|
||||||
(insert "SPC G v c Spravovat podmínky\n")
|
|
||||||
(insert "SPC G v t Spravovat drobné věci\n\n")
|
|
||||||
(insert "--- Poznámky ---\n")
|
(insert "--- Poznámky ---\n")
|
||||||
(insert "SPC G n Poznámka k místnosti\n")
|
(insert "SPC G n Poznámka k místnosti\n")
|
||||||
(insert "SPC G N Zobrazit poznámky\n")
|
(insert "SPC G N Zobrazit poznámky\n")
|
||||||
@@ -1636,23 +1659,16 @@ Průlezy G<->H: G3<->H3, G4<->H4, G7<->H7, G8<->H8, G9<->H9
|
|||||||
:desc "Stress" "S" #'alien-rpg-set-stress
|
:desc "Stress" "S" #'alien-rpg-set-stress
|
||||||
:desc "Kostky" "r" #'alien-rpg-dice
|
:desc "Kostky" "r" #'alien-rpg-dice
|
||||||
:desc "Editovat" "e" #'alien-rpg-set-stat
|
:desc "Editovat" "e" #'alien-rpg-set-stat
|
||||||
:desc "Zraneni" "j" #'alien-rpg-add-injury
|
:desc "Zranění" "j" #'alien-rpg-injury
|
||||||
:desc "Vybava" "g" #'alien-rpg-add-gear
|
:desc "Výbava" "g" #'alien-rpg-gear
|
||||||
:desc "Zbran" "W" #'alien-rpg-add-weapon
|
:desc "Zbraně" "W" #'alien-rpg-weapon
|
||||||
:desc "Brneni" "a" #'alien-rpg-add-armor
|
:desc "Brnění" "a" #'alien-rpg-armor
|
||||||
:desc "Stav/condition" "c" #'alien-rpg-add-condition
|
:desc "Podmínky" "c" #'alien-rpg-condition
|
||||||
:desc "Pozn. místnost" "n" #'alien-rpg-add-room-note
|
:desc "Pozn. místnost" "n" #'alien-rpg-add-room-note
|
||||||
:desc "Poznamky" "N" #'alien-rpg-show-room-notes
|
:desc "Poznámky" "N" #'alien-rpg-show-room-notes
|
||||||
:desc "Glob. pozn." "x" #'alien-rpg-add-note
|
:desc "Glob. pozn." "x" #'alien-rpg-add-note
|
||||||
:desc "Uložit" "q" #'alien-rpg-save-state
|
:desc "Uložit" "q" #'alien-rpg-save-state
|
||||||
:desc "Načíst" "Q" #'alien-rpg-load-state
|
:desc "Načíst" "Q" #'alien-rpg-load-state)))
|
||||||
(:prefix ("v" . "Inventář")
|
|
||||||
:desc "Výbava" "g" #'alien-rpg-manage-gear
|
|
||||||
:desc "Zbraně" "w" #'alien-rpg-manage-weapon
|
|
||||||
:desc "Brnění" "a" #'alien-rpg-manage-armor
|
|
||||||
:desc "Zranění" "j" #'alien-rpg-manage-injury
|
|
||||||
:desc "Podmínky" "c" #'alien-rpg-manage-condition
|
|
||||||
:desc "Drobné věci" "t" #'alien-rpg-manage-tiny-items))))
|
|
||||||
|
|
||||||
(provide 'alien-rpg)
|
(provide 'alien-rpg)
|
||||||
;;; alien-rpg.el ends here
|
;;; alien-rpg.el ends here
|
||||||
|
|||||||
Reference in New Issue
Block a user