forked from zombieb/galvanic-corrosion-rewrite
rooooms are mostly dooone, misc routes, instance management stubs, and matchmaking base
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { getNetConfig } from "../net.ts";
|
||||
import { ServerUpdateEvent } from "../serverevents.ts";
|
||||
import { AvatarContentBase } from "./avatars/base.ts";
|
||||
import { EventManager } from "./baseevent.ts";
|
||||
@@ -5,9 +6,11 @@ import { CommandsBase } from "./commands/commands.ts";
|
||||
import { ServerContentManager } from "./content/base.ts";
|
||||
import GameConfigsBase from "./gameconfigs/base.ts";
|
||||
import { InstanceManager } from "./instances/base.ts";
|
||||
import { Objective, ObjectiveType } from "./objectives/base.ts";
|
||||
import { PlatformsManager } from "./platforms/base.ts";
|
||||
import { type PresenceUpdateEvent } from "./presence/events/PresenceUpdateEvent.ts";
|
||||
import { type ProfileUpdateEvent } from "./profiles/events/ProfileUpdate.ts";
|
||||
import { ProfileUpdatedSettingEvent } from "./profiles/events/ProfileUpdatedSetting.ts";
|
||||
import { type RoleUpdateEvent } from "./profiles/events/RoleUpdate.ts";
|
||||
import ProfileManagerBase from "./profiles/manager.ts";
|
||||
import { ServerRoomsBase } from "./rooms/base.ts";
|
||||
@@ -16,6 +19,7 @@ import { RoomUpdatedEvent, SubroomUpdatedEvent } from "./rooms/internal/RoomEven
|
||||
interface ServerEvents {
|
||||
'profile.roleupdate': RoleUpdateEvent,
|
||||
'profile.update': ProfileUpdateEvent,
|
||||
'profile.setting.update': ProfileUpdatedSettingEvent,
|
||||
'presence.update': PresenceUpdateEvent,
|
||||
'server.start': ServerUpdateEvent,
|
||||
'server.destroy': ServerUpdateEvent,
|
||||
@@ -23,6 +27,31 @@ interface ServerEvents {
|
||||
'room.subroom.updated': SubroomUpdatedEvent
|
||||
}
|
||||
|
||||
export interface LevelProgressionItem {
|
||||
Level: number;
|
||||
RequiredXp: number;
|
||||
};
|
||||
interface AutoMicMutingConfig {
|
||||
MicSpamVolumeThreshold: number;
|
||||
MicVolumeSampleInterval: number;
|
||||
MicVolumeSampleRollingWindowLength: number;
|
||||
MicSpamSamplePercentageForWarning: number;
|
||||
MicSpamSamplePercentageForWarningToEnd: number;
|
||||
MicSpamSamplePercentageForForceMute: number;
|
||||
MicSpamSamplePercentageForForceMuteToEnd: number;
|
||||
MicSpamWarningStateVolumeMultiplier: number;
|
||||
};
|
||||
|
||||
export type PublicConfig = {
|
||||
ShareBaseUrl: string;
|
||||
ServerMaintenance: {
|
||||
StartsInMinutes: number;
|
||||
};
|
||||
LevelProgressionMaps: LevelProgressionItem[];
|
||||
DailyObjectives: Objective[][];
|
||||
AutoMicMutingConfig: AutoMicMutingConfig;
|
||||
};
|
||||
|
||||
class ServerBase extends EventManager<ServerEvents> {
|
||||
Profiles = new ProfileManagerBase(this, 'profiles', true);
|
||||
GameConfigs = new GameConfigsBase(this, 'gameconfigs', true);
|
||||
@@ -36,6 +65,78 @@ class ServerBase extends EventManager<ServerEvents> {
|
||||
generateMask(...num: number[]) {
|
||||
return num.reduce((sum, val) => sum + val, 0);
|
||||
}
|
||||
|
||||
getPublicConfig() {
|
||||
const netConfig = getNetConfig();
|
||||
|
||||
function generateLevelProgressionMap() {
|
||||
const m: LevelProgressionItem[] = [];
|
||||
for (let i = 0; i < 31; i++) {
|
||||
m.push({
|
||||
Level: i,
|
||||
RequiredXp: Math.round(i * 1 * 20),
|
||||
});
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
const conf: PublicConfig = {
|
||||
ServerMaintenance: {
|
||||
StartsInMinutes: 0,
|
||||
},
|
||||
LevelProgressionMaps: generateLevelProgressionMap(),
|
||||
DailyObjectives: [
|
||||
[
|
||||
{ type: ObjectiveType.Default, score: 0 },
|
||||
{ type: ObjectiveType.GoToRecCenter, score: 0 },
|
||||
{ type: ObjectiveType.Default, score: 0 }
|
||||
],
|
||||
[
|
||||
{ type: ObjectiveType.Default, score: 0 },
|
||||
{ type: ObjectiveType.LevelUp, score: 0 },
|
||||
{ type: ObjectiveType.Default, score: 0 }
|
||||
],
|
||||
[
|
||||
{ type: ObjectiveType.Default, score: 0 },
|
||||
{ type: ObjectiveType.SaveOutfitSlot, score: 0 },
|
||||
{ type: ObjectiveType.Default, score: 0 }
|
||||
],
|
||||
[
|
||||
{ type: ObjectiveType.Default, score: 0 },
|
||||
{ type: ObjectiveType.ScoreBasketInRecCenter, score: 0 },
|
||||
{ type: ObjectiveType.Default, score: 0 }
|
||||
],
|
||||
[
|
||||
{ type: ObjectiveType.Default, score: 0 },
|
||||
{ type: ObjectiveType.VisitACustomRoom, score: 0 },
|
||||
{ type: ObjectiveType.Default, score: 0 }
|
||||
],
|
||||
[
|
||||
{ type: ObjectiveType.Default, score: 0 },
|
||||
{ type: ObjectiveType.SubscribeToPlayer, score: 0 },
|
||||
{ type: ObjectiveType.Default, score: 0 }
|
||||
],
|
||||
[
|
||||
{ type: ObjectiveType.Default, score: 0 },
|
||||
{ type: ObjectiveType.AddAFriend, score: 0 },
|
||||
{ type: ObjectiveType.Default, score: 0 }
|
||||
]
|
||||
],
|
||||
AutoMicMutingConfig: {
|
||||
MicSpamVolumeThreshold: 1.125,
|
||||
MicVolumeSampleInterval: 0.25,
|
||||
MicVolumeSampleRollingWindowLength: 7.0,
|
||||
MicSpamSamplePercentageForWarning: 0.8,
|
||||
MicSpamSamplePercentageForWarningToEnd: 0.2,
|
||||
MicSpamSamplePercentageForForceMute: 0.8,
|
||||
MicSpamSamplePercentageForForceMuteToEnd: 0.2,
|
||||
MicSpamWarningStateVolumeMultiplier: 0.25
|
||||
},
|
||||
ShareBaseUrl: `${netConfig.securePublicHost ? 'https' : 'http'}://${netConfig.publicHost}/{0}` // {0} is replaced by the game
|
||||
};
|
||||
|
||||
return conf;
|
||||
}
|
||||
}
|
||||
|
||||
const Server = new ServerBase();
|
||||
|
||||
Reference in New Issue
Block a user