Skip to content

Commit

Permalink
Refactor: Set dedicated client level on raid start request
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchangelWTF committed Jul 29, 2024
1 parent b382e1f commit ba17152
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 98 deletions.
12 changes: 12 additions & 0 deletions src/controllers/FikaRaidController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ import { IStatusDedicatedRequest } from "../models/fika/routes/raid/dedicated/IS
import { IStatusDedicatedResponse } from "../models/fika/routes/raid/dedicated/IStatusDedicatedResponse";
import { IGetStatusDedicatedResponse } from "../models/fika/routes/raid/dedicated/IGetStatusDedicatedResponse";
import { FikaDedicatedRaidWebSocket } from "../websockets/FikaDedicatedRaidWebSocket";
import { IPmcData } from "@spt/models/eft/common/IPmcData";
import { ProfileHelper } from "@spt/helpers/ProfileHelper";

@injectable()
export class FikaRaidController {
constructor(
@inject("FikaMatchService") protected fikaMatchService: FikaMatchService,
@inject("FikaDedicatedRaidService") protected fikaDedicatedRaidService: FikaDedicatedRaidService,
@inject("FikaDedicatedRaidWebSocket") protected fikaDedicatedRaidWebSocket: FikaDedicatedRaidWebSocket,
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
@inject("WinstonLogger") protected logger: ILogger,
) {
// empty
Expand Down Expand Up @@ -148,6 +151,15 @@ export class FikaRaidController {
};
}

const pmcDedicatedClientProfile: IPmcData = this.profileHelper.getPmcProfile(dedicatedClient);
const requesterProfile: IPmcData = this.profileHelper.getPmcProfile(sessionID);

this.logger.debug(`Dedicated: ${pmcDedicatedClientProfile.Info.Nickname} ${pmcDedicatedClientProfile.Info.Level} - Requester: ${requesterProfile.Info.Nickname} ${requesterProfile.Info.Level}`)

//Set level of the dedicated profile to the person that has requested the raid to be started.
pmcDedicatedClientProfile.Info.Level = requesterProfile.Info.Level;
pmcDedicatedClientProfile.Info.Experience = requesterProfile.Info.Experience;

this.fikaDedicatedRaidService.requestedSessions[dedicatedClient] = sessionID;

dedicatedClientWs.send(
Expand Down
3 changes: 0 additions & 3 deletions src/di/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ import { IWebSocketConnectionHandler } from "@spt/servers/ws/IWebSocketConnectio
import { Fika } from "../Fika";
import { FikaServerTools } from "../utils/FikaServerTools";
import { FikaDedicatedProfileService } from "../services/dedicated/FikaDedicatedProfileService";
import { BotControllerOverride } from "../overrides/controllers/BotController";


export class Container {
Expand Down Expand Up @@ -85,7 +84,6 @@ export class Container {
container.registerType("Overrides", "LocalesOverride");
container.registerType("Overrides", "AchievementControllerOverride");
container.registerType("Overrides", "DatabaseServiceOverride");
container.registerType("Overrides", "BotControllerOverride");

container.registerType("StaticRoutes", "FikaClientStaticRouter");
container.registerType("StaticRoutes", "FikaLocationStaticRouter");
Expand All @@ -110,7 +108,6 @@ export class Container {
container.register<HttpRouterOverride>("HttpRouterOverride", HttpRouterOverride, { lifecycle: Lifecycle.Singleton });
container.register<LauncherBackgroundOverride>("LauncherBackgroundOverride", LauncherBackgroundOverride, { lifecycle: Lifecycle.Singleton });
container.register<LocalesOverride>("LocalesOverride", LocalesOverride, { lifecycle: Lifecycle.Singleton });
container.register<BotControllerOverride>("BotControllerOverride", BotControllerOverride, { lifecycle: Lifecycle.Singleton });
container.register<Overrider>("Overrider", Overrider, { lifecycle: Lifecycle.Singleton });
container.register<AchievementControllerOverride>("AchievementControllerOverride", AchievementControllerOverride, { lifecycle: Lifecycle.Singleton });
container.register<DatabaseServiceOverride>("DatabaseServiceOverride", DatabaseServiceOverride, { lifecycle: Lifecycle.Singleton });
Expand Down
95 changes: 0 additions & 95 deletions src/overrides/controllers/BotController.ts

This file was deleted.

0 comments on commit ba17152

Please sign in to comment.