Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Foundry V12. #119

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@
# SyrinControl - provides integration with Syrinscape Online

> [!IMPORTANT]
>
> # This module is no longer maintained.
>
> Sorry! I really didn't find time or motivation to continue maintaining this project.
>
>
> First of all, I was always driven by my own campaign that is probably going to end in next 3-4 sessions (4 years of running Masks Of Nyarlathotep :) ).
>
>
> Then, I overestimated my players need for Syrinscape - They don't really feel that much difference. It was an amazing tool for me to get into the right
> creative space, especially that Syrinscape provides soundsets for my campaign, but... They just mute it and play their own moods with the help of YouTube.
> creative space, especially that Syrinscape provides soundsets for my campaign, but... They just mute it and play their own moods with the help of YouTube.
>
> And then, final nail to the coffin - recently we started playing using only discord, rolling physical dices (and trusting each other)... So not only I
> use less Syrinscape, but Foundry as well...
>
> ## Okay, what's next?
>
> Well... I am not going to update this module or fix bugs in it. It is obvious that I ignored that project and all people asking for the change for too long.
> Sorry for that. I was lying to myself "if only I had a weekend free", etc. But in the end, after a week of vacation break I still didn't touch the project so it is the best to just be transparent and honest (also with myself).
> Sorry for that. I was lying to myself "if only I had a weekend free", etc. But in the end, after a week of vacation break I still didn't touch the project so it is the best to just be transparent and honest (also with myself).
>
> **If there is someone willing to maintain this module, I can transfer ownership.**
>
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineConfig({
runMode: 2
},
e2e: {
baseUrl: 'https://127.0.0.1:9443',
baseUrl: 'https://localhost:9443',
experimentalStudio: true,
setupNodeEvents(on, _config) {
on('before:browser:launch', (browser, launchOptions) => {
Expand Down
1 change: 1 addition & 0 deletions cypress/e2e/config.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
describe('config', () => {
beforeEach(() => {
Cypress.Keyboard.defaults({ keystrokeDelay: 20 });
cy.login('Gamemaster');
cy.clearWorld();
cy.mockAPI();
Expand Down
5 changes: 1 addition & 4 deletions cypress/e2e/importer/play.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ describe('importer.playing mood', () => {
});

it('should show stop button when mood is currently playing', () => {
cy.onHook('ready', () => {
cy.callSyrinHook('moodChange', 1234);
});

cy.callSyrinHook('moodChange', 1234);
cy.importerExpandSoundset('first');
cy.wait('@requestMoods');

Expand Down
6 changes: 3 additions & 3 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Cypress.Commands.add('login', (who: string) => {
cy.visit('/join');
cy.intercept('/game').as('loginRequest');
cy.get('select').select(who);
cy.get(':nth-child(1) > button').click();
cy.get('button[name=join]').click();
cy.wait('@loginRequest');
});
cy.visit('/game');
Expand All @@ -29,7 +29,7 @@ Cypress.Commands.add('gotoSettings', () => {
});

Cypress.Commands.add('openSidebar', (tab: string) => {
cy.get(`#sidebar-tabs > [data-tab="${tab}"]`).click();
cy.get(`#sidebar-tabs > [data-tab="${tab}"]`).should('be.visible').click();
});
Cypress.Commands.add('openImporter', () => {
cy.openSidebar('playlists');
Expand Down Expand Up @@ -141,7 +141,7 @@ Cypress.Commands.add('importPlaylist', () => {

cy.get('[data-test="syrin-import-playlists-btn"]').as('importBtn').click();

cy.get('.header-button').click();
cy.get('.header-button').click().should('not.exist');
cy.get('.notification > .close').should('be.visible').click({ multiple: true });
});

Expand Down
4 changes: 2 additions & 2 deletions docs/foundry/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
version: '3.3'
services:
foundry:
image: foundry_dev:v11
image: foundry_dev:v12
build:
context: .
dockerfile: Dockerfile
args:
version: v11
version: v12
command: '--adminKey=1 --noupdate --world=e2e'
ports:
- '3000:30000'
Expand Down
12 changes: 6 additions & 6 deletions docs/how_to_setup_dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,28 @@ This populates `./dist` folder with built SyrinControl
cd docs/foundry
```

3. Copy `FoundryVTT-11.xxx.zip` to `docs/foundry`
3. Copy `FoundryVTT-12.xxx.zip` to `docs/foundry`

```
cp ~/Downloads/FoundryVTT-11.xxx.zip .
cp ~/Downloads/FoundryVTT-12.xxx.zip .
```

4. Create a new folder called `foundryvtt-v11` inside of `docs/foundry`
4. Create a new folder called `foundryvtt-v12` inside of `docs/foundry`

```
mkdir foundryvtt-v11
mkdir foundryvtt-v12
```

5. unpack zip **to this new folder**:

```
unzip ./FoundryVTT-11.xxx.zip -d foundryvtt-v11
unzip ./FoundryVTT-12.xxx.zip -d foundryvtt-v12
```

6. Remove zip file

```
rm ./FoundryVTT-11.xxx.zip
rm ./FoundryVTT-12.xxx.zip
```

8. Build the docker image.
Expand Down
36 changes: 0 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions public/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"version": "0.1.0",
"compatibility": {
"minimum": 10,
"verified": "11",
"maximum": "11"
"verified": "12",
"maximum": "12"
},
"library": false,
"esmodules": ["index.js"],
Expand Down
24 changes: 12 additions & 12 deletions src/components/config/ambient-sound/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<div class={class_} {style} data-test="syrin-ambient-sound-config">
<div>
<p class="notes">
{ctx.game.localizeCore('SOUND.ConfigHint')}
{ctx.game.localizeCore('SOUND.ConfigTitle')}
</p>

<div class="form-group">
Expand Down Expand Up @@ -103,7 +103,7 @@
</div>
</div>
<div class="form-group">
<label for="">{ctx.game.localizeCore('SOUND.Radius')}</label>
<label for="">{ctx.game.localizeCore('AMBIENT_SOUND.FIELDS.radius.label')}</label>
<div class="form-fields">
<input
type="number"
Expand All @@ -115,14 +115,14 @@
</div>
</div>
<div class="form-group">
<label for="">{ctx.game.localizeCore('SOUND.Walls')}</label>
<label for="">{ctx.game.localizeCore('AMBIENT_SOUND.FIELDS.walls.label')}</label>
<input type="checkbox" data-test="syrin-walls" name="walls" bind:checked={walls} />
<p class="hint">
{ctx.game.localizeCore('SOUND.WallsHint')}
{ctx.game.localizeCore('AMBIENT_SOUND.FIELDS.walls.hint')}
</p>
</div>
<div class="form-group">
<label for="">{ctx.game.localizeCore('SOUND.DarknessRange')}</label>
<label for="">{ctx.game.localizeCore('AMBIENT_SOUND.FIELDS.darkness.label')}</label>
<div class="form-fields">
<label for="darkness.min">{ctx.game.localizeCore('Between')}</label>
<input
Expand All @@ -148,7 +148,7 @@
/>
</div>
<p class="hint">
{ctx.game.localizeCore('SOUND.DarknessRangeHint')}
{ctx.game.localizeCore('AMBIENT_SOUND.FIELDS.darkness.hint')}
</p>
</div>
</div>
Expand All @@ -174,15 +174,19 @@
<button type="submit">
<i class="far fa-save" />
{#if create}
{ctx.game.localizeCore('SOUND.Create')}
{ctx.game.localizeCore('AMBIENT_SOUND.ACTIONS.CREATE')}
{:else}
{ctx.game.localizeCore('SOUND.Update')}
{ctx.game.localizeCore('AMBIENT_SOUND.ACTIONS.UPDATE')}
{/if}
</button>
</div>
</div>

<style>
div {
padding: 2px;
}

.inner {
padding: 8px;
display: flex;
Expand All @@ -199,8 +203,4 @@
.inner-invert .units {
color: var(--color-text-light-highlight);
}
.inner button,
.inner input {
background: url(/ui/parchment.jpg) repeat;
}
</style>
15 changes: 12 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,18 @@ Hooks.once('init', function () {
Hooks.on('renderPlaylistSoundConfig', async (_: any, node: JQuery<Element>, details: any) => {
await onPlaylistSoundConfig(ctx, node, details);
});
Hooks.on('renderAmbientSoundConfig', async (_: any, node: JQuery<Element>, details: any) => {
await onAmbientSoundConfig(ctx, node, details);
});
Hooks.on(
'renderAmbientSoundConfig',
async (ambientSoundConfig: AmbientSoundConfig, node: JQuery<Element>, details: any) => {
if (details === undefined) {
// V12 Compatibility
details = { data: ambientSoundConfig.document };
node = $(node);
}

await onAmbientSoundConfig(ctx, node, details);
}
);

Hooks.on('closeSettingsConfig', async () => {
if (!ctx.game.isGM()) {
Expand Down
14 changes: 12 additions & 2 deletions src/services/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,19 @@ export class FVTTGameImpl implements FVTTGame {
const { game } = this;
const audio = game.audio as any;
if (audio.unlock !== undefined) {
// V10
// V10+
await audio.unlock;
const context = game.audio.getAudioContext();
var context = null;

// V12 - Type info is still not updated so access as `any`.
if (audio.getAnalyzerContext !== undefined) {
context = audio.getAnalyzerContext();
}
// V10-11
else if (game.audio.getAudioContext !== undefined) {
context = game.audio.getAudioContext();
}

if (context === null) return undefined;
return context;
} else {
Expand Down
5 changes: 4 additions & 1 deletion src/ui/ambientSoundConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ export async function onAmbientSoundConfig(
if (details.data.flags?.syrinscape === undefined) {
return;
}

const windowContent = window.find('.window-content');
windowContent.attr('style', 'padding: 0;');
let form = windowContent.find('form');

// Changed structure in V12 - Root window is the entire form, window content needs to be replaced.
let form = window.is('form') ? windowContent : windowContent.find('form');
form.empty();

let component = new AmbientSoundConfigComponent({
Expand Down
Loading
Loading