HabitRPG / habitica

A habit tracker app which treats your goals like a Role Playing Game.
https://habitica.com
Other
12k stars 4.09k forks source link

Blank Eggs #1367

Closed SabreCat closed 10 years ago

SabreCat commented 11 years ago

UUID 7f14ed62-5408-4e1b-be83-ada62d504931 on Windows 7, Chrome browser.

I noticed an odd little rectangle in my inventory--unfortunately didn't screencap it, but I think it was a bluish outline some 3 or 4 pixels tall and ~10 pixels wide. I clicked it, and it brought up the "what potion do you want to pour on your egg?" dialog. Puzzled, I proceeded with the "pour" command, using one of my stash of White Potions (I have all the White pets hatched). It said my egg hatched, and that I should visit the stable to equip my new pet. There was no new pet, but my "found pets" counter had increased!

It appears I hatched an undefined pet type somehow. I'm concerned that maybe a bogus egg "dropped" when I checked something off in the mobile app: API bug?

I'll keep an eye out in case this happens again, and if it does, screencap and update so folks can look at what's in the database representing this oddment. In the meantime, my pets counter should probably be reset to the proper number (confirmed 47 by Mark I Eyeball on the spritesheet).

SabreCat commented 11 years ago

Got a pet theory (rimshot) on this one. What if, when we've determined the user gets an egg, and go to randomize what kind they get, we have an off-by-one error? There are 9 possible eggs, but the randomizer has a slim chance of rolling a 10, something like that. Without an error trap, we might bull ahead and give the user an undefined egg type. Trying to examine algos.coffee to see if this is at all plausible, but thus far the CoffeeScript is making my eyes cross. @lefnire or @shaners, low priority thing here, but when you get the chance, spit me a comment on whether or not I'm likely barking up the wrong tree.

SabreCat commented 11 years ago

Oh, and my pet count is 49 now (should be 48), heh.

Shaners commented 11 years ago

Hmmm drop = helpers.randomVal(pets)

randomVal: (obj) -> result = undefined count = 0 for key, val of obj result = val if Math.random() < (1 / ++count) result

Confused what is happening here. Loop through the Pets object, set result to value of current key if Math.random() is less than 1 divided by current loop count. We loop 9 times so on the first run we are guaranteed a result and next we have 50% of changing the value of result. Then the following: 33.3%, 25%, 20%, 16.6%, 14%, 12.5%, 11%. So this shouldn't be able to give us a pet that doesn't exist...

SabreCat commented 11 years ago

OK, perhaps my intuition's leading me astray there. Might need to sideline this until if-and-when I see it happen again.

SabreCat commented 11 years ago

This user (LordGrowl) has what appear to be two of the bogus eggs. 1e18512a-0130-4651-962a-e089300f0b4d Any clues in the database?

Aubec commented 11 years ago

I've got the same issue.

User ID: 228a0207-6355-471a-84cd-7de7bba7feee

SabreCat commented 11 years ago

Screenshot : http://s9.postimg.org/vvuh1zqhr/secreteggs.jpg

Shaners commented 11 years ago

No access to the db for me so @lefnire would have to check those :beer:

mclois commented 11 years ago

I've got an invisible too, UID: c7ed829d-ef98-4138-9b34-e57dbe96cefd

GitSpoon commented 11 years ago

Same problem for me, UID : 0caf2e24-6359-4f09-93b8-6c634ded27be

SabreCat commented 11 years ago

I've got one of these again myself (see UUID at the top). I haven't been using the mobile app recently, but I have been using the preview site on Heroku.

Gonna nudge this up to Important (and tag @lefnire again, heh), since "will I get my drops?" tends to be a major concern of people migrating from Derby!Habit to mobile or anything else. It looks like, at the moment, you can get Potions OK but eggs not so much.

lefnire commented 11 years ago

OK, if it's not in the workflowy yet add it there, as this is definitely an API issue. The rewrite uses the same api as the mobile app (and chrome extension, and cli, etc). The only thing out there not using the API is the Derby site. I'll check into this before our meeting tomorrow On Aug 31, 2013 11:09 AM, "Sabe Jones" notifications@github.com wrote:

I've got one of these again myself (see UUID at the top). I haven't been using the mobile app recently, but I have been using the preview site on Heroku.

Gonna nudge this up to Important, since "will I get my drops?" tends to be a major concern of people migrating from Derby!Habit to mobile or anything else. It looks like, at the moment, you can get Potions OK but eggs not so much.

— Reply to this email directly or view it on GitHubhttps://github.com/lefnire/habitrpg/issues/1367#issuecomment-23607852 .

startmyquest commented 11 years ago

This just happened to me. Why must I always click random buttons! Lost two hatching potions playing about with those silly squares!

d5f4c795-cce2-4434-a1a5-8df9aa059408

SabreCat commented 11 years ago

We'll need to run some kind of search-and-fix over the database once we've got this solved. There are going to be a lot of people with "pets found" counters exceeding the number of pets they actually have.

lefnire commented 11 years ago

In the rewrite, let's add a UserSchema.pre('save') sanitization middleware for removing blank eggs. Note-to-self, or whoever tackles this ticket

nosht82 commented 11 years ago

Same issue my user id is 9a1e176f-a6e1-4da3-90e7-d04d0c60977e

lefnire commented 11 years ago

Ok, I fixed this in the API right here. Unfortunately this is on the rewrite, which has some major incompatibilities with the derby site. I gotta think of how to pull this in sans simply launching the rewrite

paglias commented 11 years ago

Is this going to appear on mobile? I mean now if one egg is dropped on mobile it doesn't notify you

lefnire commented 11 years ago

Actually that's a separate issue and is more complicated. Are you around for a Skype chat on that? I'd love your advice

paglias commented 11 years ago

Ok, give me ten minutes to install skype and i'm going to be there. I'l send my username on g+

lefnire commented 11 years ago

fixed

nosht82 commented 11 years ago

Its still saying 5 / 90 Pets Found even though I only have 4.

paglias commented 11 years ago

If you have the veteran pet then it's it the one more Il giorno 09/set/2013 18:36, "nosht82" notifications@github.com ha scritto:

Its still saying 5 / 90 Pets Found even though I only have 4.

— Reply to this email directly or view it on GitHubhttps://github.com/lefnire/habitrpg/issues/1367#issuecomment-24091998 .

nosht82 commented 11 years ago

That's part of the 4. I have 3 normal pets and the veteran pet that's 4 total it says 5. I tried hatching one of the bad eggs and it changed it to 5 while the bug was still in the game.

lefnire commented 11 years ago

ah, people who actually hatched the blank eggs added "undefined-Desert", "undefined-Shade" etc to user.items.pets. Looks like another db migration

SabreCat commented 11 years ago

Haha, awesome. Somebody (Bailey maybe?) had a suggestion in the Tavern that people who hatched bogus eggs should get a joke rare pet in the style of Pokemon's MISSINGNO. It sounds like such a pet would be called the Undefined Wolf ^.^

lefnire commented 11 years ago

Ha! I laughed heartily at that idea, and scratched my chin with "hmm...." - but alas, twould add nontrivial effort & we've got a lot on the plate right now unfortunately. But love the idea :)

SabreCat commented 10 years ago

Long ago fixed. Closing.