comparison clojure/com/aurellem/run/bootstrap_0.clj @ 322:d604bd3c122c

added function to determine wuantity of items currently selected
author Robert McIntyre <rlm@mit.edu>
date Wed, 04 Apr 2012 00:35:44 -0500
parents af86b5ba622b
children 92ee94945327
comparison
equal deleted inserted replaced
321:af86b5ba622b 322:d604bd3c122c
334 "up-3" "down-3" 334 "up-3" "down-3"
335 "up-4" "down-4" 335 "up-4" "down-4"
336 "up-5" "down-5" 336 "up-5" "down-5"
337 "up-6"])))) 337 "up-6"]))))
338 338
339
340
339 (def item-cursor-offset-address 52262) 341 (def item-cursor-offset-address 52262)
340 (def item-screen-offset-address 52278) 342 (def item-screen-offset-address 52278)
341 343
342 (defn item-offset 344 (defn item-offset
343 ([^SaveState state] 345 ([^SaveState state]
344 (let [mem (memory state)] 346 (let [mem (memory state)]
345 (+ (aget mem item-screen-offset-address) 347 (+ (aget mem item-screen-offset-address)
346 (aget mem item-cursor-offset-address)))) 348 (aget mem item-cursor-offset-address))))
347 ([] (item-offset @current-state))) 349 ([] (item-offset @current-state)))
350
351
352 (defn exp-item-selection []
353 (clojure.pprint/pprint
354 (apply memory-compare
355 (map read-state
356 ["1-item"
357 "2-items"
358 "3-items"
359 "4-items"
360 ]))))
361
362 (def item-quantity-selected-address 65432)
363
364 (defn item-quantity-selected
365 ([^SaveState state]
366 (aget (memory state) item-quantity-selected-address))
367 ([] (item-quantity-selected @current-state)))
348 368
349 369
350 (defn buy-item 370 (defn buy-item
351 "Assumes that the main item-screen is up, and buys 371 "Assumes that the main item-screen is up, and buys
352 quantity of the nth item in the list, assuming that you 372 quantity of the nth item in the list, assuming that you