merged develop

This commit is contained in:
Piotr 'pwh' Hanusiak
2022-03-28 13:16:29 +02:00
284 changed files with 13296 additions and 3161 deletions
-2
View File
@@ -1,5 +1,4 @@
import * as tg from "generic-type-guard";
import { isCharacterTexture } from "./CharacterTexture";
/*
* WARNING! The original file is in /messages/JsonMessages.
@@ -12,7 +11,6 @@ export const isAdminApiData = new tg.IsInterface()
email: tg.isNullable(tg.isString),
roomUrl: tg.isString,
mapUrlStart: tg.isString,
textures: tg.isArray(isCharacterTexture),
})
.withOptionalProperties({
messages: tg.isArray(tg.isUnknown),
-16
View File
@@ -1,16 +0,0 @@
import * as tg from "generic-type-guard";
/*
* WARNING! The original file is in /messages/JsonMessages.
* All other files are automatically copied from this file on container startup / build
*/
export const isCharacterTexture = new tg.IsInterface()
.withProperties({
id: tg.isNumber,
level: tg.isNumber,
url: tg.isString,
rights: tg.isString,
})
.get();
export type CharacterTexture = tg.GuardedType<typeof isCharacterTexture>;
+4 -2
View File
@@ -1,5 +1,4 @@
import * as tg from "generic-type-guard";
import { isCharacterTexture } from "./CharacterTexture";
import { isNumber } from "generic-type-guard";
/*
@@ -12,7 +11,6 @@ export const isMapDetailsData = new tg.IsInterface()
mapUrl: tg.isString,
policy_type: isNumber, //isNumericEnum(GameRoomPolicyTypes),
tags: tg.isArray(tg.isString),
textures: tg.isArray(isCharacterTexture),
authenticationMandatory: tg.isUnion(tg.isNullable(tg.isBoolean), tg.isUndefined),
roomSlug: tg.isNullable(tg.isString), // deprecated
contactPage: tg.isNullable(tg.isString),
@@ -24,6 +22,10 @@ export const isMapDetailsData = new tg.IsInterface()
expireOn: tg.isString,
// Whether the "report" feature is enabled or not on this room
canReport: tg.isBoolean,
// The URL of the logo image on the loading screen
loadingLogo: tg.isNullable(tg.isString),
// The URL of the logo image on "LoginScene"
loginSceneLogo: tg.isNullable(tg.isString),
})
.get();
+48
View File
@@ -0,0 +1,48 @@
import * as tg from "generic-type-guard";
import { z } from "zod";
//The list of all the player textures, both the default models and the partial textures used for customization
const wokaTexture = z.object({
id: z.string(),
name: z.string(),
url: z.string(),
tags: z.array(z.string()).optional(),
tintable: z.boolean().optional(),
});
export type WokaTexture = z.infer<typeof wokaTexture>;
const wokaTextureCollection = z.object({
name: z.string(),
textures: z.array(wokaTexture),
});
export type WokaTextureCollection = z.infer<typeof wokaTextureCollection>;
const wokaPartType = z.object({
collections: z.array(wokaTextureCollection),
required: z.boolean().optional(),
});
export type WokaPartType = z.infer<typeof wokaPartType>;
export const wokaList = z.record(wokaPartType);
export type WokaList = z.infer<typeof wokaList>;
export const wokaPartNames = ["woka", "body", "eyes", "hair", "clothes", "hat", "accessory"];
export const isWokaDetail = new tg.IsInterface()
.withProperties({
id: tg.isString,
})
.withOptionalProperties({
url: tg.isString,
layer: tg.isString,
})
.get();
export type WokaDetail = tg.GuardedType<typeof isWokaDetail>;
export type WokaDetailsResult = WokaDetail[];
+1 -2
View File
@@ -1,5 +1,5 @@
import * as tg from "generic-type-guard";
import { isCharacterTexture } from "./CharacterTexture";
//import { isCharacterTexture } from "./CharacterTexture";
/*
* WARNING! The original file is in /messages/JsonMessages.
@@ -13,7 +13,6 @@ export const isRegisterData = new tg.IsInterface()
organizationMemberToken: tg.isNullable(tg.isString),
mapUrlStart: tg.isString,
userUuid: tg.isString,
textures: tg.isArray(isCharacterTexture),
authToken: tg.isString,
})
.withOptionalProperties({
+4 -2
View File
@@ -9,9 +9,10 @@
"copy-to-front-ts-proto": "sed 's/import { Observable } from \"rxjs\";/import type { Observable } from \"rxjs\";/g' ts-proto-generated/protos/messages.ts > ../front/src/Messages/ts-proto-generated/messages.ts",
"copy-to-pusher": "rm -rf ../pusher/src/Messages/generated && cp -rf generated/ ../pusher/src/Messages/generated",
"json-copy-to-pusher": "rm -rf ../pusher/src/Messages/JsonMessages/* && cp -rf JsonMessages/* ../pusher/src/Messages/JsonMessages/",
"json-copy-to-back": "rm -rf ../back/src/Messages/JsonMessages/* && cp -rf JsonMessages/* ../back/src/Messages/JsonMessages/",
"json-copy-to-front": "rm -rf ../front/src/Messages/JsonMessages/* && cp -rf JsonMessages/* ../front/src/Messages/JsonMessages/",
"precommit": "lint-staged",
"proto-all": "yarn run proto && yarn run ts-proto && yarn run copy-to-back && yarn run copy-to-front-ts-proto && yarn run copy-to-pusher && yarn run json-copy-to-pusher && yarn run json-copy-to-front",
"proto-all": "yarn run proto && yarn run ts-proto && yarn run copy-to-back && yarn run copy-to-front-ts-proto && yarn run copy-to-pusher && yarn run json-copy-to-pusher && yarn run json-copy-to-back && yarn run json-copy-to-front",
"proto:watch": "yarn run proto-all; inotifywait -q -m -e close_write protos/messages.proto JsonMessages/ | while read -r filename event; do yarn run proto-all; done",
"pretty": "yarn prettier --write 'JsonMessages/**/*.ts'",
"pretty-check": "yarn prettier --check 'JsonMessages/**/*.ts'"
@@ -20,7 +21,8 @@
"generic-type-guard": "^3.5.0",
"google-protobuf": "^3.13.0",
"grpc": "^1.24.4",
"ts-proto": "^1.96.0"
"ts-proto": "^1.96.0",
"zod": "^3.12.0"
},
"devDependencies": {
"@types/google-protobuf": "^3.7.4",
+9 -5
View File
@@ -1,7 +1,5 @@
syntax = "proto3";
import "google/protobuf/wrappers.proto";
/*********** PARTIAL MESSAGES **************/
message PositionMessage {
@@ -36,6 +34,7 @@ message SilentMessage {
message CharacterLayerMessage {
string url = 1;
string name = 2;
string layer = 3;
}
message CompanionMessage {
@@ -236,6 +235,8 @@ message RoomJoinedMessage {
repeated string tag = 5;
repeated VariableMessage variable = 6;
string userRoomToken = 7;
// We send the current skin of the current player.
repeated CharacterLayerMessage characterLayer = 8;
}
message WebRtcStartMessage {
@@ -287,6 +288,8 @@ message WorldFullMessage{
}
message TokenExpiredMessage{
}
message InvalidTextureMessage{
}
message WorldConnexionMessage{
string message = 2;
@@ -323,7 +326,8 @@ message ServerToClientMessage {
FollowRequestMessage followRequestMessage = 21;
FollowConfirmationMessage followConfirmationMessage = 22;
FollowAbortMessage followAbortMessage = 23;
GroupUsersUpdateMessage groupUsersUpdateMessage = 24;
InvalidTextureMessage invalidTextureMessage = 24;
GroupUsersUpdateMessage groupUsersUpdateMessage = 25;
}
}
@@ -364,9 +368,9 @@ message UserLeftZoneMessage {
message GroupUpdateZoneMessage {
int32 groupId = 1;
PointMessage position = 2;
google.protobuf.UInt32Value groupSize = 3;
int32 groupSize = 3;
Zone fromZone = 4;
google.protobuf.BoolValue locked = 5;
bool locked = 5;
}
message GroupLeftZoneMessage {
+5
View File
@@ -4645,3 +4645,8 @@ year@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/year/-/year-0.2.1.tgz#4083ae520a318b23ec86037f3000cb892bdf9bb0"
integrity sha1-QIOuUgoxiyPshgN/MADLiSvfm7A=
zod@^3.12.0:
version "3.14.2"
resolved "https://registry.yarnpkg.com/zod/-/zod-3.14.2.tgz#0b4ed79085c471adce0e7f2c0a4fbb5ddc516ba2"
integrity sha512-iF+wrtzz7fQfkmn60PG6XFxaWBhYYKzp2i+nv24WbLUWb2JjymdkHlzBwP0erpc78WotwP5g9AAu7Sk8GWVVNw==