Habitica: Quest Shop arithmetic follows its own rules. Laws of Mathematics are not the Habitica way.

Created on 9 Mar 2018  路  4Comments  路  Source: HabitRPG/habitica

Bulk purchasing doesn't work correctly in quest shop. Number purchased is treated as integer for 1 and as string for 2 or more (i.e., string concatenation occurs when you buy the items, instead of integer arithmetic). The number is also treated as a string if you change the number to anything and then change it back to 1.

To reproduce:

  • Give yourself a chunk of gold.
  • Go to the quest shop. Pick a gold-purchasable quest that you don't have any of.
  • Buy 1. You now own 1.
  • Buy another 1. You now own 2. This is good.
  • Use the bulk purchase feature to buy 2 at once. You now own 22. This is wrong.
  • Buy 10 at once. You now own 2210. This is getting silly.
  • Pick another quest that you own none of.
  • Buy 1000. You now own 1000.
  • Buy another 1000. You now own 10001000. This is not how maths is meant to work.
medium status in progress medium level coding

Most helpful comment

I broke also the counter in Inventory... maybe I shouldn't have tried... XD

habitica gamify your life 1

Syncing it's fixed, but it scared me for a moment

All 4 comments

I can't reproduce this for Gem-purchasable quests, which is nice.

I broke also the counter in Inventory... maybe I shouldn't have tried... XD

habitica gamify your life 1

Syncing it's fixed, but it scared me for a moment

I can look into this.

@Hus274 Thanks!

Was this page helpful?
0 / 5 - 0 ratings