Mercurial > vba-clojure
view clojure/com/aurellem/items.clj @ 98:08cd8be1edc1
renamed inspect.clj to items.clj
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 12 Mar 2012 00:31:10 -0500 |
parents | |
children | 9fad96094950 |
line wrap: on
line source
1 (ns com.aurellem.items2 (:use (com.aurellem gb-driver vbm title))3 ;; this is fucking bullshit4 (:import [com.aurellem.gb_driver SaveState]))8 (defn game-name []9 (map char (subvec (vec (memory)) 0x134 0x142)))15 (defn current-items [^SaveState state]16 (set-state! state)19 )23 ;; try just buying five potions in sequence and see what changes24 ;; each time.26 (defn common-differences [& seqs]27 (let [backbone (range (count (first seqs)))]28 (filter29 (comp (partial apply distinct?) second)30 (zipmap backbone31 (apply (partial map list) seqs)))))33 ;; trying to find how items are represented in memory35 (comment36 (def empty-inventory @current-state)38 (def one-potion @current-state)40 (def two-potions @current-state)42 (def three-potions @current-state)44 (def four-potions @current-state)46 (def five-potions @current-state)49 ;; result50 (def canidates51 (apply common-differences52 (map (comp vec memory)53 [empty-inventory one-potion two-potions three-potions54 four-potions five-potions])))56 [55875 (37 15 49 27 14 44)]57 [55876 (30 1 49 56 55 23)]58 [49158 (154 191 78 135 70 73)]59 [54087 (49 40 37 34 25 22)]60 [49160 (7 24 59 243 50 217)]61 [49704 (31 14 72 33 84 27)]62 [49162 (126 159 183 110 176 179)]63 [39984 (0 254 251 248 127 252)]64 [49904 (29 72 64 78 1 95)]65 [65491 (222 127 149 132 226 38)]66 [65492 (44 20 89 11 253 163)]67 [49335 (52 15 6 14 3 17)]68 [49720 (78 152 96 60 83 103)]69 [65304 (19 89 214 33 18 113)]70 [53561 (132 185 145 162 159 183)]71 [54046 (0 1 2 3 4 5)])73 ;;; hmmmmmm...... I guess that the potion quantities are at 54046,74 ;;;huh?78 (def item-hack (read-state 7999))80 (def item-hack2 (read-state 75882))82 (defn get-mem []83 (subvec (vec (memory @current-state)) 54040 (+ 54046 100)))86 ;; potion -- 9987 [0 16 0 0 1 20 99 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]89 ;; potion -- 9590 [0 16 0 0 1 20 95 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]92 ;; potion -- 9593 ;; pokeball -- 194 [0 16 0 0 2 20 95 4 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 41 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]96 ;; potion -- 9597 ;; pokeball -- 1098 [0 16 0 0 2 20 95 4 10 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]101 ;; pokeball -- 10102 ;; potion -- 95103 [0 16 0 0 2 4 10 20 95 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 17 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]105 ;; pokeball -- 10106 ;; potion -- 95107 ;; antidote -- 1109 ;;prediction110 ;;[0 16 0 0 3 4 10 20 95 ?? 1 255 0 0 0 0 0 ....]111 [0 16 0 0 3 4 10 20 95 11 1 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 16 117 129 139 148 132 80 134 128 145 152 80 137 3 0 0 1 191 223 189 2 0 42 8 199 5 2 1 0 1 20 2 4 4 93 77 23 77 122 76 0 255 208 65 240 198 10 10 71 246 41 201 255 252 64 18 201 10 10]115 ;; now it's time to learn the item codes117 (def item-hack-3 (read-state 77557))118 (defn show-item119 "Run a saved pokemon with the first item replaced by the item named120 by n."121 [n]122 (set-state! item-hack-3)123 (let [mem (memory)]124 (aset mem 54045 n)125 (write-memory! mem))126 (step)127 (->> [[] @current-state]128 (play-moves129 [[:a] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []130 [] [] [] [] []])))133 (defn get-item-names []134 (dorun (map (fn [n] (println n)135 (show-item n)136 (Thread/sleep 5000))137 (range 0x00 0xFF))))141 ;; 0 garbage142 ;; 1 master-ball143 ;; 2 ultra-ball144 ;; 3 great-ball145 ;; 4 poke-ball146 ;; 5 town-map147 ;; 6 bicycle148 ;; 7 ?????149 ;; 8 safari-ball150 ;; 9 pokedex151 ;; 10 moon-stone152 ;; 11 antidote153 ;; 12 burn-heal154 ;; 13 ice-heal155 ;; 14 awakening156 ;; 15 parlyz-heal157 ;; 16 full-restore158 ;; 17 max-potion159 ;; 18 hyper-potion160 ;; 19 super-potion161 ;; 20 potion162 ;; 21 boulderbadge163 ;; 22 cascadebadge164 ;; 23 thunderbadge165 ;; 24 rainbowbadge166 ;; 25 soulbadge167 ;; 26 marshbadge168 ;; 27 volcanobadge169 ;; 28 earthbadge170 ;; 29 escape-rope171 ;; 30 repel172 ;; 31 old amber173 ;; 32 fire-stone174 ;; 33 thunderstone175 ;; 34 water-stone176 ;; 35 hp-up177 ;; 36 protein178 ;; 37 iron179 ;; 38 carbos180 ;; 39 calcium181 ;; 40 rare-candy182 ;; 41 dome-fossil183 ;; 42 helix-fossil184 ;; 43 secret-key185 ;; 44 ?????186 ;; 45 bike-voucher187 ;; 46 x-accuracy188 ;; 47 leaf-stone189 ;; 48 card-key190 ;; 49 nugget191 ;; 50 pp-up192 ;; 51 poke-doll193 ;; 52 full-heal194 ;; 53 revive195 ;; 54 max-revive196 ;; 55 guard-spec.197 ;; 56 super-repel198 ;; 57 max-repel199 ;; 58 dire-hit200 ;; 59 coin201 ;; 60 fresh-water202 ;; 61 soda-pop203 ;; 62 lemonade204 ;; 63 s.s.ticket205 ;; 64 gold-teeth206 ;; 65 x-attach207 ;; 66 x-defend208 ;; 67 x-speed209 ;; 68 x-special210 ;; 69 coin-case211 ;; 70 oak's-parcel212 ;; 71 itemfinder213 ;; 72 silph-scope214 ;; 73 poke-flute215 ;; 74 lift-key216 ;; 75 exp.all217 ;; 76 old-rod218 ;; 77 good-rod219 ;; 78 super-rod220 ;; 79 pp-up221 ;; 80 ether222 ;; 81 max-ether223 ;; 82 elixer224 ;; 83 max-elixer225 ;; 84 B2F226 ;; 85 B1F227 ;; 86 1F228 ;; 87 2F229 ;; 88 3F230 ;; 89 4F231 ;; 90 5F232 ;; 91 6F233 ;; 92 7F234 ;; 93 8F235 ;; 94 9F236 ;; 95 10F237 ;; 96 11F238 ;; 97 B4F239 ;; 98 garbage240 ;; 99 garbage241 ;; 100 garbage242 ;; 101 garbage243 ;; 102 garbage244 ;; 103 garbage245 ;; 104 garbage246 ;; 105 garbage247 ;; 106 garbage248 ;; 107 garbage249 ;; 108 garbage250 ;; 109 garbage251 ;; 110 garbage252 ;; 111 garbage253 ;; 112 garbage254 ;; 113 garbage255 ;; 114 garbage256 ;; 115 garbage257 ;; 116 garbage258 ;; 117 garbage259 ;; 118 garbage260 ;; 119 4261 ;; 120 garbage262 ;; 121 garbage263 ;; 122 slow264 ;; 123 garbage265 ;; 124 garbage266 ;; 125 garbage267 ;; 126 garbage268 ;; 127 garbage269 ;; 128 garbage270 ;; 129 garbage271 ;; 130 garbage272 ;; 131 slow273 ;; 132 slow274 ;; 133 garbage275 ;; 134 slow276 ;; 135 garbage277 ;; 136 garbage278 ;; 137 slow279 ;; 138 garbage280 ;; 139 garbage281 ;; 140 garbage282 ;; 141 slow283 ;; 142 garbage284 ;; 143 garbage285 ;; 144 garbage286 ;; 145 garbage287 ;; 146 garbage288 ;; 147 garbage289 ;; 148 garbage290 ;; 149 garbage291 ;; 150 slow292 ;; 151 garbage293 ;; 152 Q294 ;; 153 garbage295 ;; 154 garbage296 ;; 155 garbage297 ;; 156 garbage298 ;; 157 garbage299 ;; 158 garbage300 ;; 159 garbage301 ;; 160 garbage (alaphabet)302 ;; 161 garbage303 ;; 162 garbage304 ;; 163 garbage305 ;; 164 rival's306 ;; 165 name?307 ;; 166 nickname?308 ;; 167 slow309 ;; 168 garbage310 ;; 169 slow311 ;; 170 garbage312 ;; 171 garbage313 ;; 172 garbage314 ;; 173 garbage315 ;; 174 garbage316 ;; 175 yellow317 ;; 176 ash318 ;; 177 jack319 ;; 178 new-name320 ;; 179 blue321 ;; 180 gary322 ;; 181 john323 ;; 182 garbage324 ;; 183 garbage325 ;; 184 garbage326 ;; 185 garbage327 ;; 186 slow328 ;; 187 garbage329 ;; 188 garbage330 ;; 189 garbage331 ;; 190 garbage332 ;; 191 garbage333 ;; 192 garbage334 ;; 193 garbage335 ;; 194 garbage336 ;; 195 slow337 ;; 196 HM01338 ;; 197 HM02339 ;; 198 HM03340 ;; 199 HM04341 ;; 200 HM05342 ;; 201 TM01343 ;; 202 TM02344 ;; 203 TM03345 ;; 204 TM04346 ;; 205 TM05347 ;; 206 TM06348 ;; 207 TM07349 ;; 208 TM08350 ;; 209 TM09351 ;; 210 TM10352 ;; 211 TM11353 ;; 212 TM12354 ;; 213 TM13355 ;; 214 TM13356 ;; 215 TM15357 ;; 216 TM16358 ;; 217 TM17359 ;; 218 TM18360 ;; 219 TM19361 ;; 220 TM20362 ;; 221 TM21363 ;; 222 TM22364 ;; 223 TM23365 ;; 224 TM24366 ;; 225 TM25367 ;; 226 TM26368 ;; 227 TM27369 ;; 228 TM28370 ;; 229 TM29371 ;; 230 TM30372 ;; 231 TM31373 ;; 232 TM32374 ;; 233 TM33375 ;; 234 TM34376 ;; 235 TM35377 ;; 236 TM36378 ;; 237 TM37379 ;; 238 TM38380 ;; 239 TM39381 ;; 240 TM40382 ;; 241 TM41383 ;; 242 TM42384 ;; 243 TM43385 ;; 244 TM44386 ;; 245 TM45387 ;; 246 TM46388 ;; 247 TM47389 ;; 248 TM48390 ;; 249 TM49391 ;; 250 TM50392 ;; 251 TM51393 ;; 252 TM52394 ;; 253 TM53395 ;; 254 TM54396 ;; 255 end-of-list-sentinel