Skip to content

Commit

Permalink
fixes #475
Browse files Browse the repository at this point in the history
  • Loading branch information
aza547 committed Feb 10, 2024
1 parent 74fbab5 commit 7d88d70
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 28 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [3.24.2] - 2024-02-10
### Changed
- [Issue 474](https://github.com/aza547/wow-recorder/issues/474) - Use CQP/CRF encoder modes rather than VBR.
- Removed support for ffmpeg_nvenc encoder, as jim_nvenc is always preferable.
### Added
- [Issue 475](https://github.com/aza547/wow-recorder/issues/475) - Make overrun times for raid and dungeons configurable.
### Fixed
- [Issue 478](https://github.com/aza547/wow-recorder/issues/478) - Fix an issue with config validation sometimes failing when it shouldn't.

Expand Down
1 change: 1 addition & 0 deletions src/activitys/Activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export default abstract class Activity {
}

set overrun(s) {
console.info('[Activity] Setting overrun to', s);
this._overrun = s;
}

Expand Down
4 changes: 0 additions & 4 deletions src/activitys/ChallengeModeDungeon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ export default class ChallengeModeDungeon extends Activity {
this.removeLastTimelineSegment();
}

if (result) {
this.overrun = 5;
}

this.CMDuration = CMDuration;
super.end(endDate, result);
}
Expand Down
9 changes: 0 additions & 9 deletions src/activitys/RaidEncounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ export default class RaidEncounter extends Activity {
return instanceDifficulty[this.difficultyID];
}

end(endDate: Date, result: boolean) {
if (result) {
console.log('[RaidEncounter] Adding overrun as this was a kill');
this.overrun = 15;
}

super.end(endDate, result);
}

getMetadata(): Metadata {
const rawCombatants = Array.from(this.combatantMap.values()).map(
(combatant: Combatant) => combatant.getRaw()
Expand Down
25 changes: 21 additions & 4 deletions src/main/configSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export type ConfigurationSchema = {
pushToTalkMouseButton: number;
pushToTalkModifiers: string;
obsAudioSuppression: boolean;
raidOverrun: number;
dungeonOverrun: number;
};

export type ConfigurationSchemaKey = keyof ConfigurationSchema;
Expand Down Expand Up @@ -118,7 +120,7 @@ export const configSchema = {
},
minEncounterDuration: {
description:
'Minimum raid boss encounter duration, encounters shorter than this will not be recorded. This setting is aimed at avoiding saving boss resets.',
'Encounters shorter than this duration will not be recorded. This setting is aimed at avoiding saving boss resets.',
type: 'integer',
default: 15,
maximum: 10000,
Expand Down Expand Up @@ -233,7 +235,7 @@ export const configSchema = {
},
minRaidDifficulty: {
description:
'The minimum raid difficulty to record, this setting only applies to retail.',
'The minimum raid difficulty to record. Only applies to retail.',
type: 'string',
default: 'LFR',
},
Expand Down Expand Up @@ -306,12 +308,12 @@ export const configSchema = {
},
pushToTalkKey: {
description: 'The push to talk hotkey, represented by the key code.',
type: 'number',
type: 'integer',
default: -1,
},
pushToTalkMouseButton: {
description: 'The push to talk mouse button.',
type: 'number',
type: 'integer',
default: -1,
},
pushToTalkModifiers: {
Expand All @@ -326,4 +328,19 @@ export const configSchema = {
type: 'boolean',
default: true,
},
raidOverrun: {
description: 'Number of seconds to record after a boss has been killed.',
type: 'integer',
default: 15,
minimum: 0,
maximum: 60,
},
dungeonOverrun: {
description:
'Number of seconds to record after a dungeon has been completed.',
type: 'integer',
default: 5,
minimum: 0,
maximum: 60,
},
};
6 changes: 6 additions & 0 deletions src/parsing/LogHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ export default abstract class LogHandler extends EventEmitter {
}

const result = Boolean(parseInt(line.arg(5), 10));

if (result) {
const overrun = this.cfg.get<number>('raidOverrun');
this.activity.overrun = overrun;
}

this.activity.end(line.date(), result);
await this.endActivity();
}
Expand Down
5 changes: 5 additions & 0 deletions src/parsing/RetailLogHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,11 @@ export default class RetailLogHandler extends LogHandler {
// levels can be calculated. This includes player death penalty.
const CMDuration = Math.round(parseInt(line.arg(4), 10) / 1000);

if (result) {
const overrun = this.cfg.get<number>('dungeonOverrun');
challengeModeActivity.overrun = overrun;
}

challengeModeActivity.endChallengeMode(endDate, CMDuration, result);
await this.endActivity();
}
Expand Down
97 changes: 90 additions & 7 deletions src/renderer/PVESettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import { ConfigurationSchema } from 'main/configSchema';
import React from 'react';
import { setConfigValues, useSettings } from './useSettings';

const formControlStyle = { m: 1, width: '200px' };
const formControlStyle = { width: '100%' };

const style = {
width: '300px',
m: 1,
width: '100%',
color: 'white',
'& .MuiOutlinedInput-notchedOutline': {
borderColor: 'white',
Expand Down Expand Up @@ -77,11 +78,15 @@ const PVESettings: React.FC = () => {
minRaidDifficulty: config.minRaidDifficulty,
recordDungeons: config.recordDungeons,
minKeystoneLevel: config.minKeystoneLevel,
raidOverrun: config.raidOverrun,
dungeonOverrun: config.dungeonOverrun,
});
}, [
config.dungeonOverrun,
config.minEncounterDuration,
config.minKeystoneLevel,
config.minRaidDifficulty,
config.raidOverrun,
config.recordDungeons,
config.recordRaids,
]);
Expand Down Expand Up @@ -143,7 +148,7 @@ const PVESettings: React.FC = () => {
variant="outlined"
type="number"
InputLabelProps={{ shrink: true, style: { color: 'white' } }}
sx={style}
sx={{ ...style, maxWidth: '250px' }}
inputProps={{ min: 0, style: { color: 'white' } }}
/>
);
Expand All @@ -168,15 +173,17 @@ const PVESettings: React.FC = () => {
}

return (
<FormControl sx={formControlStyle}>
<InputLabel sx={style}>Minimum Raid Difficulty</InputLabel>
<FormControl sx={{ ...formControlStyle, maxWidth: '250px' }}>
<InputLabel sx={{ ...style, maxWidth: '250px' }}>
Minimum Raid Difficulty
</InputLabel>
<Select
value={config.minRaidDifficulty}
disabled={!config.recordRaids}
label="Minimum Raid Difficulty"
variant="outlined"
onChange={setMinRaidDifficulty}
sx={style}
sx={{ ...style, maxWidth: '250px' }}
>
{raidDifficultyOptions.map((difficulty: string) => (
<MenuItem key={difficulty} value={difficulty}>
Expand All @@ -188,6 +195,78 @@ const PVESettings: React.FC = () => {
);
};

const setRaidOverrun = (event: React.ChangeEvent<HTMLInputElement>) => {
const newValue = parseInt(event.target.value, 10);

if (newValue < 0 || newValue > 60) {
// Don't allow invalid config to go further.
return;
}

setConfig((prevState) => {
return {
...prevState,
raidOverrun: newValue,
};
});
};

const getRaidOverrunField = () => {
if (!config.recordRaids) {
return <></>;
}

return (
<TextField
value={config.raidOverrun}
label="Raid Overrun (sec)"
disabled={!config.recordRaids}
onChange={setRaidOverrun}
variant="outlined"
type="number"
InputLabelProps={{ shrink: true, style: { color: 'white' } }}
sx={{ ...style, maxWidth: '250px' }}
inputProps={{ min: 0, max: 60, style: { color: 'white' } }}
/>
);
};

const setDungeonOverrun = (event: React.ChangeEvent<HTMLInputElement>) => {
const newValue = parseInt(event.target.value, 10);

if (newValue < 0 || newValue > 60) {
// Don't allow invalid config to go further.
return;
}

setConfig((prevState) => {
return {
...prevState,
dungeonOverrun: newValue,
};
});
};

const getDungeonOverrunField = () => {
if (!config.recordDungeons) {
return <></>;
}

return (
<TextField
value={config.dungeonOverrun}
label="Mythic+ Overrun (sec)"
disabled={!config.recordDungeons}
onChange={setDungeonOverrun}
variant="outlined"
type="number"
InputLabelProps={{ shrink: true, style: { color: 'white' } }}
sx={{ ...style, maxWidth: '250px' }}
inputProps={{ min: 0, max: 60, style: { color: 'white' } }}
/>
);
};

const setRecordDungeons = (event: React.ChangeEvent<HTMLInputElement>) => {
setConfig((prevState) => {
return {
Expand Down Expand Up @@ -232,7 +311,7 @@ const PVESettings: React.FC = () => {
type="number"
error={config.minKeystoneLevel < 0}
InputLabelProps={{ shrink: true, style: { color: 'white' } }}
sx={style}
sx={{ ...style, maxWidth: '250px' }}
inputProps={{ min: 0, style: { color: 'white' } }}
/>
);
Expand All @@ -245,10 +324,12 @@ const PVESettings: React.FC = () => {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
width: '100%',
}}
>
{getRecordRaidSwitch()}
{getMinEncounterDurationField()}
{getRaidOverrunField()}
{getMinRaidDifficultySelect()}
</Box>

Expand All @@ -257,10 +338,12 @@ const PVESettings: React.FC = () => {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
width: '100%',
}}
>
{getRecordDungeonSwitch()}
{getMinKeystoneLevelField()}
{getDungeonOverrunField()}
</Box>
</Box>
);
Expand Down
35 changes: 34 additions & 1 deletion src/renderer/SettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,28 @@ const getGameSettingsInfoIcon = () => {
);
};

const getPVESettingsInfoIcon = () => {
const helptext = [
/* eslint-disable prettier/prettier */
['Record Raids', configSchema.recordRaids.description].join('\n'),
['Minimum Encounter Duration', configSchema.minEncounterDuration.description].join('\n'),
['Raid Overrun', configSchema.raidOverrun.description].join('\n'),
['Minimum Raid Difficulty', configSchema.minRaidDifficulty.description].join('\n'),
['Record Mythic+', configSchema.recordDungeons.description].join('\n'),
['Minimum Keystone Level', configSchema.minKeystoneLevel.description].join('\n'),
['Mythic+ Overrun', configSchema.dungeonOverrun.description].join('\n'),
// eslint-enable prettier/prettier */
].join('\n\n');

return (
<Tooltip title={<div style={{ whiteSpace: 'pre-line' }}>{helptext}</div>}>
<IconButton>
<InfoIcon style={{ color: 'white' }} />
</IconButton>
</Tooltip>
);
};

const SettingsPage: React.FC<IProps> = (props: IProps) => {
const { recorderStatus } = props;

Expand Down Expand Up @@ -145,7 +167,18 @@ const SettingsPage: React.FC<IProps> = (props: IProps) => {
<FlavourSettings recorderStatus={recorderStatus} />
</Box>

<Box sx={{ mx: 2 }}>{getHeading('PvE Settings')}</Box>
<Box
sx={{
mx: 2,
mt: 2,
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
}}
>
{getHeading('PvE Settings')}
{getPVESettingsInfoIcon()}
</Box>
<Box
sx={{
backgroundColor: boxColor,
Expand Down
7 changes: 4 additions & 3 deletions src/renderer/VideoBaseControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ const VideoBaseControls: FC<IProps> = (props: IProps) => {
}

return (
<FormControl size="small" sx={formControlStyle}>
<FormControl size="small" sx={{ ...formControlStyle, maxWidth: '150px' }}>
<InputLabel sx={selectStyle}>Canvas Resolution</InputLabel>
<Select
value={config.obsOutputResolution}
Expand Down Expand Up @@ -302,7 +302,7 @@ const VideoBaseControls: FC<IProps> = (props: IProps) => {
}

return (
<FormControl size="small" sx={formControlStyle}>
<FormControl size="small" sx={{ ...formControlStyle, maxWidth: '150px' }}>
<InputLabel sx={selectStyle}>Quality</InputLabel>
<Select
value={config.obsQuality}
Expand Down Expand Up @@ -336,7 +336,7 @@ const VideoBaseControls: FC<IProps> = (props: IProps) => {
}

return (
<FormControl size="small" sx={formControlStyle}>
<FormControl size="small" sx={{ ...formControlStyle, maxWidth: '250px' }}>
<InputLabel sx={selectStyle}>Video Encoder</InputLabel>
<Select
value={config.obsRecEncoder}
Expand Down Expand Up @@ -390,6 +390,7 @@ const VideoBaseControls: FC<IProps> = (props: IProps) => {
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
width: '100%',
}}
>
{getFPSToggle()}
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/useSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export const getSettings = (): ConfigurationSchema => {
pushToTalkMouseButton: getConfigValue<number>('pushToTalkMouseButton'),
pushToTalkModifiers: getConfigValue<string>('pushToTalkModifiers'),
obsAudioSuppression: getConfigValue<boolean>('obsAudioSuppression'),
raidOverrun: getConfigValue<number>('raidOverrun'),
dungeonOverrun: getConfigValue<number>('dungeonOverrun'),
};

return configValues;
Expand Down

0 comments on commit 7d88d70

Please sign in to comment.