skyrim-multiplayer / skymp

Multiplayer Mod & TypeScript SDK for Skyrim Special Edition
Other
218 stars 75 forks source link

unhardcode banned races #1874

Open Pospelove opened 6 months ago

Pospelove commented 6 months ago

follow up https://github.com/skyrim-multiplayer/skymp/pull/1805

Pospelove commented 1 month ago

@ellipsis-dev plan

ellipsis-dev[bot] commented 1 month ago
:rocket: This implementation plan was created by @ellipsis-dev

Tag me (@ellipsis-dev) in a comment with guidance if you want me to replan or to implement this plan.

Implementation Plan

Step 1: Implement race ban check

Path: skymp5-client/src/sync/appearance.ts In applyAppearanceCommon, check isRaceBanned(raceId) before setting NPC race. Implement isRaceBanned(raceId: number): boolean to read from config/bannedRaces.json.

Step 2: Create banned races JSON

Path: config/bannedRaces.json Create config/bannedRaces.json with an array of banned race IDs, e.g., [1, 2, 3].

Step 3: Read banned races from JSON

Path: skymp5-client/src/sync/appearance.ts In isRaceBanned, use fs.promises.readFile to read config/bannedRaces.json. Parse with JSON.parse. Handle file I/O and JSON errors. Return true if raceId is in the parsed array, else false.


Questions? Check out our documentation. Leave :+1:/:-1: on this plan to give us feedback.