mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 23:54:48 +01:00
Add non-elevated game option
This commit is contained in:
@@ -39,6 +39,8 @@ interface IState {
|
||||
swag: boolean
|
||||
akebiSet: boolean
|
||||
migotoSet: boolean
|
||||
|
||||
unElevated: boolean
|
||||
}
|
||||
|
||||
export default class ServerLaunchSection extends React.Component<IProps, IState> {
|
||||
@@ -62,6 +64,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
|
||||
swag: false,
|
||||
akebiSet: false,
|
||||
migotoSet: false,
|
||||
unElevated: false,
|
||||
}
|
||||
|
||||
this.toggleGrasscutter = this.toggleGrasscutter.bind(this)
|
||||
@@ -93,6 +96,7 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
|
||||
swag: config.swag_mode || false,
|
||||
akebiSet: config.akebi_path !== '',
|
||||
migotoSet: config.migoto_path !== '',
|
||||
unElevated: config.un_elevated || false,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -188,7 +192,14 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
|
||||
path: exe || config.game_install_path,
|
||||
})
|
||||
|
||||
if (gameExists) await invoke('run_program_relative', { path: exe || config.game_install_path })
|
||||
if (gameExists)
|
||||
if (config.un_elevated) {
|
||||
await invoke('run_un_elevated', {
|
||||
path: config.game_install_path,
|
||||
})
|
||||
} else {
|
||||
await invoke('run_program_relative', { path: exe || config.game_install_path })
|
||||
}
|
||||
else alert('Game not found! At: ' + (exe || config.game_install_path))
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ interface IState {
|
||||
auto_mongodb: boolean
|
||||
swag: boolean
|
||||
platform: string
|
||||
un_elevated: boolean
|
||||
|
||||
// Swag stuff
|
||||
akebi_path: string
|
||||
@@ -70,6 +71,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
swag: false,
|
||||
auto_mongodb: false,
|
||||
platform: '',
|
||||
un_elevated: false,
|
||||
|
||||
// Swag stuff
|
||||
akebi_path: '',
|
||||
@@ -87,6 +89,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
this.toggleEncryption = this.toggleEncryption.bind(this)
|
||||
this.removeRSA = this.removeRSA.bind(this)
|
||||
this.addMigotoDelay = this.addMigotoDelay.bind(this)
|
||||
this.toggleUnElevatedGame = this.toggleUnElevatedGame.bind(this)
|
||||
}
|
||||
|
||||
async componentDidMount() {
|
||||
@@ -119,6 +122,7 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
swag: config.swag_mode || false,
|
||||
auto_mongodb: config.auto_mongodb || false,
|
||||
platform,
|
||||
un_elevated: config.un_elevated || false,
|
||||
|
||||
// Swag stuff
|
||||
akebi_path: config.akebi_path || '',
|
||||
@@ -274,6 +278,15 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
}
|
||||
}
|
||||
|
||||
async toggleUnElevatedGame() {
|
||||
const changedVal = !(await getConfigOption('un_elevated'))
|
||||
setConfigOption('un_elevated', changedVal)
|
||||
|
||||
this.setState({
|
||||
un_elevated: changedVal,
|
||||
})
|
||||
}
|
||||
|
||||
async removeRSA() {
|
||||
await meta.unpatchGame()
|
||||
}
|
||||
@@ -455,6 +468,18 @@ export default class Options extends React.Component<IProps, IState> {
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="OptionSection" id="menuOptionsContainerUEGame">
|
||||
<div className="OptionLabel" id="menuOptionsLabelUEGame">
|
||||
<Tr text="options.un_elevated" />
|
||||
</div>
|
||||
<div className="OptionValue" id="menuOptionsCheckboxUEGame">
|
||||
<Checkbox
|
||||
onChange={() => this.toggleOption('un_elevated')}
|
||||
checked={this.state?.un_elevated}
|
||||
id="unElevatedGame"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{this.state.swag ? (
|
||||
<div className="OptionSection" id="menuOptionsContainerHorny">
|
||||
<div className="OptionLabel" id="menuOptionsLabelHorny">
|
||||
|
||||
@@ -25,6 +25,7 @@ let defaultConfig: Configuration
|
||||
wipe_login: false,
|
||||
horny_mode: false,
|
||||
auto_mongodb: false,
|
||||
un_elevated: false,
|
||||
}
|
||||
})()
|
||||
|
||||
@@ -53,6 +54,7 @@ export interface Configuration {
|
||||
horny_mode: boolean
|
||||
swag_mode?: boolean
|
||||
auto_mongodb: boolean
|
||||
un_elevated: boolean
|
||||
|
||||
// Swag stuff
|
||||
akebi_path?: string
|
||||
|
||||
Reference in New Issue
Block a user