Compare commits

...

2 Commits

Author SHA1 Message Date
Niklas 53f03b3f56 fix: correct compose up commands 2023-10-24 16:01:16 +02:00
Niklas 8a8076e48f feat: added imager 2023-10-24 15:59:51 +02:00
6 changed files with 127 additions and 2 deletions

13
.env
View File

@ -15,4 +15,15 @@ RCON_HOST=127.0.0.1
RCON_PORT=3001
RCON_ALLOWED=127.0.0.1
RT_THREADS=12
RT_THREADS=12
API_HOST=imager
API_PORT=3000
AVATAR_SAVE_PATH=/app/assets/usercontent/avatar/
# talking internally - can also be a external using FQDN
AVATAR_ACTIONS_URL=http://assets/assets/gamedata/HabboAvatarActions.json
AVATAR_FIGUREDATA_URL=http://assets/assets/gamedata/FigureData.json
AVATAR_FIGUREMAP_URL=http://assets/assets/gamedata/FigureMap.json
AVATAR_EFFECTMAP_URL=http://assets/assets/gamedata/EffectMap.json
AVATAR_ASSET_URL=http://assets/assets/bundled/figure/%libname%.nitro
AVATAR_ASSET_EFFECT_URL=http://assets/assets/bundled/effect/%libname%.nitro

View File

@ -90,7 +90,8 @@ UPDATE emulator_settings SET `value`='0' WHERE `key`='console.mode';
```bash
docker compose up assets -d && \
docker compose up assets-build --build && \
docker compose up arcturus --build -d
docker compose up imager --build -d && \
docker compose up arcturus --build -d && \
docker compose up backup -d
```

View File

View File

@ -92,5 +92,17 @@ services:
- ./assets/:/usr/share/nginx/html
networks: [nitro]
imager:
build:
context: imager
env_file:
- .env
volumes:
- ./assets/:/app/assets/
ports:
- 3001:3000
restart: unless-stopped
networks: [nitro]
networks:
nitro:

21
imager/Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM node:lts as builder
ARG BRANCH=dev
ARG COMMIT=7ff2405
WORKDIR /app
RUN apt-get update && apt-get install -y \
git \
build-essential \
python3 \
&& rm -rf /var/lib/apt/lists/*
RUN apt remove apt --autoremove -y --allow-remove-essential
RUN git clone --branch ${BRANCH} --recurse-submodules https://github.com/billsonnn/nitro-imager.git .
RUN git checkout $COMMIT
RUN yarn install
RUN yarn build
ENTRYPOINT ["node", "/app/dist/src/main.js"]
#ENTRYPOINT ["tail", "-f", "/dev/null"]

80
imager/README.md Normal file
View File

@ -0,0 +1,80 @@
# Nitro Imager
This tool serves as a server-side habbo-imager using the same avatar generator from nitro-renderer. It will download & cache in memory `.nitro` assets. Rendered figures will also save to a local folder to prevent re-renders. You will use the same process as your nitro-client to update assets for the imager.
## URL paramaters
Their are a few different options you may pass as URL parameters to generate figures with different actions. All parameters are optional.
| key | default | description |
| -------------- | ------- | ------------------------------------------------------------------- |
| figure | null | The figure string to be rendered |
| action | null | The actions to render, see actions below |
| gesture | std | The gesture to render, see gestures below |
| direction | 2 | The direction to render, from 0-7 |
| head_direction | 2 | The head direction to render, from 0-7 |
| headonly | 0 | A value of `0` or `1` |
| dance | 0 | A dance id of 0-4 to render |
| effect | 0 | An effect id to render |
| size | n | The size to render, see sizes below |
| frame_num | 0 | The frame number to render |
| img_format | png | A value of `png` or `gif`. Gif will render all frames of the figure |
## Actions
You may render multiple actions with a comma separater
Example: `&action=wlk,wav,drk=1`
##### Posture
| key | description |
| ------ | ---------------------------- |
| std | Renders the standing posture |
| wlk,mv | Renders the walking posture |
| sit | Renders the sitting posture |
| lay | Renders the laying posture |
##### Expression
| key | description |
| -------- | ------------------------------- |
| wav,wave | Renders the waving expression |
| blow | Renders the kissing expression |
| laugh | Renders the laughing expression |
| respect | Renders the respect expression |
##### Carry / Drink
To hold a certain drink, use an equal separator with the hand item id. You can only render one of these options at a time
| key | description |
| -------- | ------------------------ |
| crr,cri | Renders the carry action |
| drk,usei | Renders the drink action |
## Gestures
| key | description |
| --- | ------------------------------ |
| std | Renders the standard gesture |
| agr | Renders the aggravated gesture |
| sad | Renders the sad gesture |
| sml | Renders the smile gesture |
| srp | Renders the surprised gesture |
## Sizes
| key | description |
| --- | ---------------------------- |
| s | Renders the small size (0.5) |
| n | Renders the normal size (1) |
| l | Renders the large size (2) |
## Known Issues
- GIFs are only able to render 1 bit alpha channels, therefore most effects will not correctly render due to using many different alpha values.
- The rendered canvas size may not match habbos imager exactly, we will hopefully have this addressed soon.
## Test String:
[`figure=hd-180-1.ch-255-66.lg-280-110.sh-305-62.ha-1012-110.hr-828-61&action=std,wav&gesture=std&direction=2&head_direction=2&size=l&img_format=png`](http://labs.habox.org/generator-avatar)