Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Habbo Asset Updater - Python

Status
Not open for further replies.
Newbie Spellweaver
Joined
Sep 24, 2011
Messages
47
Reaction score
9
Hello,

After seeing many hotels struggling to update their clothing themselves, I decided to create a tool which grabs all of the latest clothing from Habbo. But, I decided I shouldn't stop there. With this tool you will be able to import your current figuremap to allow the tool to only download the ones you don't have! But it doesn't stop there, you know those annoying XML snippets you have to add one by one? Well, this tool will generate the XML needed for the clothing you add!

The current alpha/proof of concept version can be seen at , however this is still considered to be a prereleased version. And is very poorly implemented.

Habbo Asset Updater

Features:
- Download all of Habbo's latest clothing
- Generate XML for only the clothing you need
- Choose your export path

Might be added:
- Download badges, and generate the respective text
- Download furniture and generate SQL queries for them
- Download latest hotelview imagary
- Maybe more?

See it in action:
mdMthLG - Habbo Asset Updater - Python - RaGEZONE Forums
Code snippets:
Excerpt from main.py
Code:
def getExternal(id):
    global lines
 
    # Check if external variables is cached if not, make a request
    try:
        lines
    except:
        externalVars = makeRequest("https://www.habbo.com/gamedata/external_variables/0")
        lines = externalVars.splitlines()

    for line in lines:
        if line.startswith(id.encode()):
            line = line.decode("utf-8")
            line = line.replace(id+"=", "")
            if line.startswith("${url.prefix}"):
                line = line.replace("${url.prefix}", "https://habbo.com")
            if not line.startswith("http"):
                line = "https:"+line
            return line

def clothingList():
    global production
    clothingItems = []
    figureData = makeRequest(production+"figuremap.xml")
    figureData = BeautifulSoup(figureData, "html.parser")
    for lib in figureData.find_all("lib", id=True):
        clothingItems.append(production+lib['id']+".swf")
    return clothingItems

 
production = getExternal("flash.client.url")

def worker():
    while True:
        item = q.get()
        print(Req.download(item))
        q.task_done()

q = Queue()
for i in range(14):
     t = Thread(target=worker)
     t.daemon = True
     t.start()

def run():
    clothes = clothingList()
    for cloth in clothes:
        q.put(cloth) 
    del clothes
Excerpt from Req.py (still a bit rough)
Code:
def download(url, extention=False):
        if Req.validUrl(url):
    
            filename = url.split('/')[-1]
            if extention == False:
                if "." in filename:
                    extention = filename.split('.')[1]
                else:
                    return ["error", "ERROR(004): No extention specified."]
            else:
                filename = filename+"."+extention
    
            if not Req.fileExists(filename):
                extentions = ["swf", "png", "gif"]
                if extention in extentions:  
                    r = scraper.get(url, stream=True, headers=headers)
                    with open(filename, 'wb') as f:
                        shutil.copyfileobj(r.raw, f)
                    return filename
                else:
                    return ["error", "ERROR(003): '{}' is an invalid, or unsupported extention. ({})".format(extention, url)]
            else:
                return ["error", "{}, seems to already exist.".format(filename)]
        else:
            return ["error", "ERROR(001): '{}' appears to be an invalid url. ".format(url)]
 

Attachments

You must be registered for see attachments list
Last edited:
Software Engineer
Loyal Member
Joined
Feb 19, 2008
Messages
1,055
Reaction score
492
Neat, I would suggest attempting to make a GUI / UI using either Tk or packaging it up so n00bs don't have to install Python themselves try pyinstaller ;)
 
Newbie Spellweaver
Joined
Sep 24, 2011
Messages
47
Reaction score
9
Was considering a UI, but will be very unlikely the first version will have it. As functionality is more important than ease of use for version one.

And yeah I was planning on packaging it so it's easier for people who aren't familiar with Python. I will at the very least just do a try: except: when importing and on except run pip install for the library so at least that part is done for them.

I've also been looking into nice CLI, like a percentage of completion, perhaps have a loading bar and beside it say "x of 700 downloaded". Or if I get more familiar with tkinter will implement that.
 
Newbie Spellweaver
Joined
Feb 26, 2018
Messages
79
Reaction score
4
very interesting project, I will absolutely try the alpha version waiting for the official one :p
 
Status
Not open for further replies.
Back
Top