gerbenjacobs / HabboAPI

A PHP wrapper for the (undocumented) Habbo API
MIT License
45 stars 10 forks source link

Dissect clothes and colours from figurestring #36

Open gerbenjacobs opened 8 years ago

gerbenjacobs commented 8 years ago

It would be nice if we could make a static resource of the clothing items and their colours from the figurestring 'codes'.

sh-905-1408 means shoes of type '905' with colour '1408'. If this could become:

{
  'item': 'shoes',
  'name': 'sneakers',
  'colour': '#ff00bb'
}

One of the ideas is that you can then start searching for people who are wearing a special kind of shirt.

Pandafuchs commented 5 years ago

Regarding the Structure of the figurestrings:

Some figurestrings look like this: {"user":{"uniqueId":"hhus-35ca38d8ccdc424c0a3b42b41a4e4751","name":"XoRASNICKoX","figureString":"hr-545-34.hd-600-1.ch-630-62.lg-715-63.sh-735-63.he-1605-73.ca-1813-", [...]

They end with a "-" char. Do you think habbo is truncating it while using the API or is that just how some figureStrings end? Looks like there is something missing... the second number like with the other parts of the string.

Alynva commented 5 years ago

What the ca mean? The lack of the last number may mean that that it doesn't have a color

DavydeVries commented 5 years ago

From top to bot

Head hr = hair hd = head he = (head) ear accessoires like earrings, feathers ha = (head) accessoires like hats and caps

Face ea = eye accessoires like glasses fa = face accessoires like masks

Chest ch = chest normal clothes ca = chest accessoires cc = chest cap like jackets cp = chest print like tattoos

Waist wa = waist accessoires like belts

Legs lg = legs like trousers/pants

Shoes sh = shoes

gerbenjacobs commented 5 years ago

The last number would indeed indicate color.

The meaning of the shortcodes is as Davy mentions, Habbo then calls these categories as follows:

{
    "ca": "Jewelry",
    "cc": "Jackets",
    "ch": "Shirts",
    "cp": "Prints",
    "ea": "Goggles",
    "fa": "Masks",
    "ha": "Hats",
    "hd": "Face & Body",
    "he": "Accessories",
    "hr": "Hair",
    "lg": "Trousers",
    "sh": "Shoes",
    "wa": "Belts"
}

In another project of mine I have created this feature request partly. It's not fully feature-rich and it doesn't deal with colours at all (although I guess it could): https://github.com/gerbenjacobs/habbowidgets-language/tree/master/clothes

Pandafuchs commented 5 years ago

Thanks for you input, I think thats actually very helpful and I guess that item does indeed not have a color. It's actually the little Medal you can wear on your chest:

https://www.habbo.com/habbo-imaging/avatarimage?size=l&figure=ch-3342-75-75.lg-3526-80.sh-3524-64-1408.ca-1813&direction=2&head_direction=2 image

@gerbenjacobs Since the data, which item has which number, is not available through the Habbo API, do you mind sharing how you retrieve that data for HabboWidgets?

gerbenjacobs commented 5 years ago

Yep it's in the script: https://github.com/gerbenjacobs/habbowidgets-language/blob/master/clothes/extracter.php