Mercurial > vba-clojure
comparison clojure/com/aurellem/gb/items.clj @ 181:4ea8ff49af87
modified give-items to work with glitched items.
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 22 Mar 2012 02:02:07 -0500 |
parents | 8665160f0f3d |
children | f0c1e5574e81 |
comparison
equal
deleted
inserted
replaced
180:4f5ea93cbaca | 181:4ea8ff49af87 |
---|---|
22 0x02 :ultra-ball | 22 0x02 :ultra-ball |
23 0x03 :great-ball | 23 0x03 :great-ball |
24 0x04 :poke-ball | 24 0x04 :poke-ball |
25 0x05 :town-map | 25 0x05 :town-map |
26 0x06 :bicycle | 26 0x06 :bicycle |
27 0x07 :surfboard | |
27 0x08 :safari-ball | 28 0x08 :safari-ball |
28 0x09 :pokedex | 29 0x09 :pokedex |
29 0x0A :moon-stone | 30 0x0A :moon-stone |
30 0x0B :antidote | 31 0x0B :antidote |
31 0x0C :burn-heal | 32 0x0C :burn-heal |
168 (let [items (item-list state)] | 169 (let [items (item-list state)] |
169 (map | 170 (map |
170 (fn [[item-code quantity]] | 171 (fn [[item-code quantity]] |
171 [(item-code->item-name | 172 [(item-code->item-name |
172 item-code | 173 item-code |
173 (str ":0x" (.toUpperCase (Integer/toHexString item-code)))) | 174 item-code) |
174 quantity]) | 175 quantity]) |
175 (partition | 176 (partition |
176 2 | 177 2 |
177 (next (take-while (partial not= 255) items)))))) | 178 (next (take-while (partial not= 255) items)))))) |
178 | 179 |
200 | 201 |
201 (defn inventory-codes [inventory] | 202 (defn inventory-codes [inventory] |
202 (flatten | 203 (flatten |
203 (concat [(count inventory)] | 204 (concat [(count inventory)] |
204 (map (fn [[item-name quantity]] | 205 (map (fn [[item-name quantity]] |
205 [(item-name->item-code item-name) | 206 [(item-name->item-code item-name item-name) |
206 quantity]) inventory) | 207 quantity]) inventory) |
207 [(item-name->item-code :end-of-list-sentinel)]))) | 208 [(item-name->item-code :end-of-list-sentinel)]))) |
208 | 209 |
209 (defn set-inv-mem [^SaveState state inv-codes] | 210 (defn set-inv-mem [^SaveState state inv-codes] |
210 (set-memory-range state item-list-start | 211 (set-memory-range state item-list-start |