-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #126 from BUTR/collections-wip
Collection Support
- Loading branch information
Showing
146 changed files
with
4,645 additions
and
2,754 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
# Project-specific editor formatting options | ||
[*] | ||
charset = utf-8 | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { actions, types } from 'vortex-api'; | ||
import { findBLSEMod } from './utils'; | ||
import { hasSettingsInterfacePrimaryTool } from '../vortex'; | ||
import { GAME_ID } from '../common'; | ||
|
||
export const didDeployBLSE = (api: types.IExtensionApi): Promise<void> => { | ||
const state = api.getState(); | ||
|
||
if (!hasSettingsInterfacePrimaryTool(state.settings.interface)) { | ||
return Promise.resolve(); | ||
} | ||
|
||
const primaryTool = state.settings.interface.primaryTool.mountandblade2bannerlord; | ||
|
||
const blseMod = findBLSEMod(state); | ||
if (blseMod && primaryTool === undefined) { | ||
api.store?.dispatch(actions.setPrimaryTool(GAME_ID, 'blse-cli')); | ||
} | ||
if (!blseMod && primaryTool === 'blse-cli') { | ||
api.store?.dispatch(actions.setPrimaryTool(GAME_ID, undefined!)); | ||
} | ||
|
||
return Promise.resolve(); | ||
}; | ||
|
||
/** | ||
* Event function, be careful | ||
*/ | ||
export const didPurgeBLSE = (api: types.IExtensionApi): Promise<void> => { | ||
const state = api.getState(); | ||
|
||
if (!hasSettingsInterfacePrimaryTool(state.settings.interface)) { | ||
return Promise.resolve(); | ||
} | ||
|
||
const primaryTool = state.settings.interface.primaryTool.mountandblade2bannerlord; | ||
if (primaryTool !== 'blse-cli') { | ||
return Promise.resolve(); | ||
} | ||
|
||
const blseMod = findBLSEMod(state); | ||
if (blseMod) { | ||
api.store?.dispatch(actions.setPrimaryTool(GAME_ID, undefined!)); | ||
} | ||
|
||
return Promise.resolve(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export * from './events'; | ||
export * from './installer'; | ||
export * from './modType'; | ||
export * from './utils'; | ||
export * from './vortex'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { selectors, types } from 'vortex-api'; | ||
import { BLSE_CLI_EXE } from '../../common'; | ||
import { BLSE_CLI_EXE } from '../common'; | ||
|
||
export const getInstallPathBLSE = (api: types.IExtensionApi, game: types.IGame): string => { | ||
const discovery: types.IDiscoveryResult | undefined = selectors.discoveryByGame(api.getState(), game.id); | ||
return discovery?.path ?? ``; | ||
}; | ||
|
||
export const isModTypeBLSE = (instructions: types.IInstruction[]): boolean => { | ||
return instructions.some((inst) => inst.type === 'copy' && inst.source && inst.source.endsWith(BLSE_CLI_EXE)); | ||
return instructions.some( | ||
(inst) => inst.type === 'copy' && inst.source !== undefined && inst.source.endsWith(BLSE_CLI_EXE) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.