summaryrefslogtreecommitdiff
path: root/src/gizmo/wasp-animism.el
blob: 80c6f70efd47e6b7f38fec58256546806f20ab6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
;;; wasp-animism --- Superterranean Animism Overlay -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:

(require 'wasp-utils)
(require 'wasp-bus)
(require 'wasp-prod)

(add-to-list 'load-path (f-canonical "~/src/animism/"))
(require 'bulletml)

;; src,Xway,fire^쾠㘽쾷ㅗ껋㾨먝乲뛏屚w㮇㸩멽ꝼ쓋♫릫m떫쓏䓳⩺䮻1㨧퉝ƭ쓐ǥᓌ㒵ᒄ먽乳俴㢈쿗峫ฐꙢ왽욍투ㅖ㨧슝呑㟪䁓Ɂy䏧呠3먫슎呒3⧘ɍy욋ᕈ00먫⇳
;; this one is broken fix it -ellg, probably

(defconst w/overlay-spellcard-names
  '("Joel" "Pemis" "JoelTeachingHisSonJolHowToSpinWhileWideBorisPassesBy" "bugSegz"
    "widepeepoMASTURBATION77769420GANGSHITNOMOREFORTNITE19DOLLERFORTNITECARD"
    "Machine Made Of Fire, Heart Made Of Doves"
    "Dream Seal" "Evil-Sealing Circle" "Dream Seal -Spread-" "Dream Seal -Concentrate-"
    "Duplex Barrier" "Dream Orb" "Omnidirectional Oni-Binding Circle" "Yin-Yang Treasured Orb"
    "Yin-Yang Kishin Orb" "Dream Orb String" "Yin-Yang Scattering" "Exorcising Border"
    "Yin-Yang King Piece" "Illusionary Moon" "Flying Mysterious Shrine Maiden"
    "Dream Seal -Blink-" "Great Duplex Barrier" "Dream Seal -Worn-" "Dream Seal -Marred-"
    "Dream Seal -The Point Of The Mask-"
    ))

(defvar w/overlay-barrage-active nil)
(defvar w/overlay-last-cursor nil)
(defun w/overlay-update-cursor ()
  "Inform the overlay about the current cursor position."
  (when (and w/overlay-barrage-active (process-live-p (get-process w/bus-process)))
    (when-let ((pos (window-absolute-pixel-position)))
      (when (not (equal pos w/overlay-last-cursor))
        (setf w/overlay-last-cursor pos)
        (w/pub '(overlay cursor) (list (- (car pos) 1920) (cdr pos)))))))
(add-hook 'post-command-hook #'w/overlay-update-cursor)

(defun w/overlay-start-barrage (bml)
  "Start a barrage on the overlay using the BulletML source string BML."
  (w/pub '(overlay barrage start) (list (w/encode-string bml))))

(defun w/overlay-decode-shorthand-bml (s k)
  "Decode the shorthand BulletML string S.
Pass the resulting BulletML XML string to K."
  ;; (w/write-log s)
  (w/prod-get-raw
   (format "/api/yamame?input=%s" (url-encode-url s))
   (lambda (data)
     (if-let* ((bml (bml/parse-string data))
               (b (bml/initialize bml))
               ((bml/barrage-toplevel b)))
         (progn
           (funcall k data))
       (w/write-chat-event "That spell card is too powerful... ")))))

(provide 'wasp-animism)
;;; wasp-animism.el ends here