     :openwindow           (write-packet-openwindow conn payload)
     :closewindow          (write-packet-closewindow conn payload)
     :windowclick          (write-packet-windowclick conn payload)
+    :transaction          (write-packet-transaction conn payload)
 
     )
   (flushc conn))

  (-write-byte conn itemcount)
  (-write-short conn itemuses))


; Writing Wrappers -----------------------------------------------------------------
(defn flushc [conn]

(defn read-packet-closewindow [conn]
  (assoc {}
    :windowid (-read-byte conn)))

(defn read-packet-setslot [conn]
  (assoc {}
    :windowid (-read-byte conn)
    :slot (-read-short conn)
    :itemid (-read-short conn)
    :itemcount (-read-byte conn)
    :itemuses (-read-short conn)))

(defn read-packet-windowitems [conn]
  (letfn [(-read-payload-item []
             (let [payload (assoc :itemid (-read-short conn))]
               (if (= (:itemid payload) -1)
                 payload
                 (assoc payload
                        :count (-read-byte conn)
                        :uses (-read-short conn)))))]
    (let [prepayload (assoc {}
                            :windowid (-read-byte conn)
                            :count (-read-short conn))
          payload (repeatedly (:count prepayload) -read-payload-item)]
      (assoc prepayload :payload payload))))

(defn read-packet-updateprogressbar [conn]
  (assoc {}
    :windowid (-read-byte conn)
    :progressbar (-read-short conn)
    :value (-read-short conn)))

(defn read-packet-transaction [conn]
  (assoc {}
    :windowid (-read-byte conn)
    :actionnumber (-read-short conn)
    :accepted (-read-short conn)))


; Reading Wrappers -----------------------------------------------------------------
