Yu-Gi-Oh! Deck Building and Card Inventory Management web interface written in Common Lisp, utilizing HTMX.
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

63 linhas
1.8KB

  1. #|
  2. If you wanted to add an item, you would add to the end of the list
  3. or the matching position in the list to the matching DEFPARAMETER
  4. and DEFCLASS.
  5. These are all extracted from cardinfo.php
  6. |#
  7. (in-package #:cl-deck-builder2.models.ygoprodeck.fields)
  8. ;; TODO Merge this with YGO-CARD-NAME? What is even going on
  9. ;; here. This could be mixed with any DAO/table with a NAME
  10. ;; column. That *feels* like it's a lot more general than I
  11. ;; realize....
  12. (defclass variant ()
  13. ((name :col-type :text
  14. :initarg :name))
  15. (:metaclass registered-table-class))
  16. (defmethod name-of ((obj variant))
  17. (slot-value obj 'name))
  18. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  19. (defun create-variant (class variant)
  20. (or (mito:find-dao class :name variant)
  21. (mito:create-dao class :name variant)))
  22. (defun create-variants (class &rest variants)
  23. (with-connection (db)
  24. (with-transaction
  25. (dolist (v variants)
  26. (create-variant class v)))))
  27. (defmacro define-variant-list (name &rest lst)
  28. `(progn
  29. (defclass ,name (variant)
  30. ()
  31. (:metaclass registered-table-class))
  32. (create-table ',name)
  33. (create-variants (find-class ',name) ,@lst)))
  34. ;; Card Conditions
  35. (define-variant-list variant-condition
  36. "Near Mint" "Lightly Played" "Moderately Played" "Heavily Played" "Damaged")
  37. ;; Languages
  38. (define-variant-list variant-language
  39. "English" "French" "Italian" "Spanish" "German" "Portuguese")
  40. ;; Ban List Info
  41. (define-variant-list ygo-banlist-name
  42. "Unlimited" "Semi-Limited" "Limited" "Banned")
  43. ;; Formats
  44. (define-variant-list ygo-format-name
  45. "Common Charity" "Duel Links" "Edison" "GOAT" "OCG" "OCG GOAT" "Speed Duel" "TCG")
  46. ;; Link Markers
  47. (define-variant-list ygo-linkmarker-name
  48. "Top" "Top-Right" "Right" "Bottom-Right" "Bottom" "Bottom-Left" "Left" "Top-Left")