Compare commits

...

5 Commits

12 changed files with 125 additions and 10 deletions

3
.gitignore vendored
View File

@ -17,3 +17,6 @@ atomcms/logs/*
!atomcms/cache/.gitkeep
!atomcms/storage/.gitkeep
!atomcms/logs/.gitkeep
*.env
nitro/*.json
!example-*

View File

@ -20,7 +20,18 @@ This setup installs a complete local setup. Connecting externally requires editi
| CMS | http://127.0.0.1:8081 | example.com |
| Nitro Client | http://127.0.0.1:3080 | game.example.com |
```sql
UPDATE emulator_settings SET `value`='*.example.com' WHERE `key`='websockets.whitelist';
```
## Build
0. copy necessary files to work locally
The following command searches for all files starting with `example-`, copies the file and remove the `example-` prefix. If you don't have access to the find command, you can do it manually.
```bash
find . -type f -name 'example-*' -exec sh -c 'cp -rf "$0" "${0/example-/}"' {} \;
```
1. Download the default assets
> The `&& \` is used to combine multiple commands into a single line in a Unix-like command shell. By using && \, the two commands are executed sequentially and only if the first command succeeds. If the first command fails, the second command will not be executed, saving you from potential errors.
@ -175,7 +186,8 @@ cd ../.. && \
docker compose up assets-build --build && \
cd ./assets/translation && \
python FurnitureDataTranslator.py && \
python SQLGenerator.py
python SQLGenerator.py && \
python external_text.py --domain com
```
* run SQL file

View File

@ -0,0 +1,41 @@
diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
index e8fca734..86c01371 100644
--- a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
@@ -155,4 +155,8 @@ public class PermissionsManager {
public boolean isEffectBlocked(int effectId, int groupId) {
return this.specialEnables.contains(effectId) && this.specialEnables.get(effectId) > groupId;
}
+
+ public Collection<PermissionGroup> getPermissionGroups() {
+ return permissionGroups.values();
+ }
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java
index 56920133..69b5b110 100644
--- a/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java
+++ b/src/main/java/com/eu/habbo/habbohotel/users/inventory/BadgesComponent.java
@@ -13,8 +13,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Comparator;
-import java.util.Set;
@Slf4j
public class BadgesComponent {
@@ -36,9 +36,11 @@ public class BadgesComponent {
while (set.next()) {
HabboBadge badge = new HabboBadge(set, habbo);
- if(!(habbo.getHabboInfo().getPermissionGroup().hasBadge() && habbo.getHabboInfo().getPermissionGroup().getBadge() == badge.getCode())) {
+ Collection<PermissionGroup> permissionGroups = Emulator.getGameEnvironment().getPermissionsManager().getPermissionGroups();
+ for (PermissionGroup permissionGroup : permissionGroups) {
+ if (habbo.getHabboInfo().getPermissionGroup().getId() == permissionGroup.getId()) continue;
+ if (!permissionGroup.hasBadge() || permissionGroup.getBadge() != badge.getCode()) continue;
deleteBadge(habbo.getHabboInfo().getId(), badge.getCode());
- continue;
}
badgesList.add(badge);

View File

@ -0,0 +1,56 @@
import argparse
import requests
import json
domains = ["com.br", "com.tr", "com", "de", "es", "fi", "fr", "it", "nl"]
def fetch_external_flash_texts(domain):
url = f"https://www.habbo.{domain}/gamedata/external_flash_texts/0"
response = requests.get(url)
if response.status_code == 200:
return response.text.split('\n')
else:
print(f"Failed to fetch data from {url}. Status code: {response.status_code}")
return []
def parse_flash_texts(lines):
flash_texts_dict = {}
for line in lines:
if '=' in line:
key, value = line.split('=', 1)
flash_texts_dict[key.strip()] = value.strip()
return flash_texts_dict
def main():
parser = argparse.ArgumentParser(description="Fetch and parse external flash texts for a given domain.")
parser.add_argument("--domain", help="Specify the top-level domain (TLD) for fetching external flash texts.", choices=domains)
args = parser.parse_args()
if args.domain:
domain = args.domain
else:
print("Please provide a valid domain using the --domain argument.")
return
domains.remove(domain)
domains.append(domain)
all_flash_texts = {}
with open("../assets/gamedata/ExternalTexts.json", "r", encoding="utf-8") as f:
all_flash_texts = json.load(f)
for d in domains:
flash_texts_lines = fetch_external_flash_texts(d)
flash_texts_dict = parse_flash_texts(flash_texts_lines)
all_flash_texts = all_flash_texts | flash_texts_dict
with open("../assets/gamedata/ExternalTexts.json", "w", encoding="utf-8") as f:
json.dump(all_flash_texts, f, separators=(',', ':'), sort_keys=True)
if __name__ == "__main__":
main()

View File

@ -28,7 +28,7 @@ RUN composer install
# ---------------------------------------------
FROM node:lts-alpine as npm-builder
FROM node:lts as npm-builder
WORKDIR /var/www/html

View File

@ -82,6 +82,9 @@ services:
assets:
image: nginx:alpine
restart: unless-stopped
depends_on:
- imager
- imgproxy
env_file:
- .env
ports:
@ -94,9 +97,6 @@ services:
imager:
build:
context: imager
depends_on:
# proxied through nginx of assets
- assets
env_file:
- .env
volumes:
@ -106,9 +106,6 @@ services:
imgproxy:
image: ghcr.io/willnorris/imageproxy
depends_on:
# proxied through nginx of assets
- assets
volumes:
- "./assets/usercontent/imageproxy/cache:/tmp/imageproxy"
env_file:
@ -120,7 +117,7 @@ services:
build:
context: atomcms
depends_on:
- imager
- assets
- arcturus
ports:
- "8081:80"
@ -128,6 +125,7 @@ services:
- ".cms.env:/var/www/html/.env"
- "./atomcms/storage:/var/www/html/storage/app/public"
- "./atomcms/logs:/var/www/html/storage/logs"
restart: unless-stopped
networks: [nitro]
networks:

View File

View File

@ -9,6 +9,11 @@ RUN apt-get update && apt-get install -y \
git \
build-essential \
python3 \
libcairo2-dev \
libpango1.0-dev \
libjpeg-dev \
libgif-dev \
librsvg2-dev \
&& rm -rf /var/lib/apt/lists/*
RUN apt remove apt --autoremove -y --allow-remove-essential

View File

@ -1,7 +1,7 @@
FROM node:lts-alpine as builder
ARG BRANCH=main
ARG COMMIT=ee47e21
ARG COMMIT=1666e35
WORKDIR /build