snollygolly / paw-wars

:smiley_cat: A spiritual successor to DrugWars, but with cats.
http://pawwars.evilmousestudios.com
Other
32 stars 10 forks source link

Accounting vendor added. #82

Closed mikemclaren closed 8 years ago

mikemclaren commented 8 years ago
mikemclaren commented 8 years ago

I keep forgetting to set my origin to this repo, not my fork, hence the pull request from my fork!

mikemclaren commented 8 years ago

Don't merge this quite yet, I'm seeing an error on retainer purchase I need to work through.

mikemclaren commented 8 years ago

Fixed it, should be good for looking at now. I had made a circular reference when adding upgrades. :disappointed:

snollygolly commented 8 years ago

Super excited to try this out. Thanks for it! Are there any tests needed for it?

mikemclaren commented 8 years ago

There are! Making some tests for the vendor and upgrades now.

snollygolly commented 8 years ago

I bought laser pointers earlier in the game, but I sold all of them. Before I bought more, it said I had spent $0 on them. I bought 20, and the card now shows I paid more than they cost per unit.

screen shot 2016-03-12 at 9 47 08 pm

mikemclaren commented 8 years ago

Yeah, I need to make bookkeeping a little "smarter". Right now it doesn't track until you actually get the bookkeeping upgrade (which I think makes sense, though I need messaging to reflect that), and it's not particularly smart, especially if you don't sell all of something.

What I think I need to do is throw a "boughtAt" array onto an item's inventory object. Every time you "buy" that item, an object that contains the units and amount bought at is appended to it. Once you hit 0 and the item's gone from the inventory, that count would reset, which is perfect! I didn't intend this to be a "historical" price tracker, just more of a short-term turn-to-turn tool.

mikemclaren commented 8 years ago

Added some tests and bookkeeping should in general work a lot better now. :)

snollygolly commented 8 years ago

Looks great, thank you so much! :shipit: