OpenNeo

Dress to Impress - Neopets wearables made easy

Feb 22

Happy pets! And converted by default

Just about every day I get an e-mail about how all the pets are sad and how some are unconverted. Well, no more! Thanks to some clever database magic, the default gender/emotion state on the beta server will always be happy (that’s in the item database, too), and the unconverted state will always be the last in the list.

In short: no more sad pets by default! Yay!

As always, this new feature applies only to the beta server.

The solution was some simple math. A gender/emotion state is defined as a group of SWFs for different body parts, each with a given ID number. Most, say, Blue Acaras share most of the same SWFs, except for eyes and mouth. As it happens, TNT almost always creates the happy pets first, then the sad pets, then the sick pets, meaning that the SWFs for happy mouth and eyes have the smallest ID numbers. So, if we take the sum of all of a gender/emotion state’s SWF IDs, the smallest sums should belong to happy pets. Additionally, unconverted pets only have one SWF. So, for all you SQL types, we pretty much sort by “COUNT(swf_asset_ids) DESC, SUM(swf_asset_ids)” meaning that gender/emotion states with more SWFs are sorted to the front of the list (pushing the unconverted state to the very back), and then those with the smallest SWF sums are also pushed to the front.

I was expecting this to be a much tougher job, with lots of clever data analysis. Turns out the solution was pretty simple. It’s not foolproof, but I’m very, very satisfied with it :)

Awesome! Another big issue checked off the list. Y’all are the coolest! Thanks for using Dress to Impress.
Matchu