Not even sure at this point
This commit is contained in:
@@ -1,13 +1,34 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="details">
|
<div class="details">
|
||||||
Hello There {{this.potato}}
|
<div class="character-name">Character to Archive: {{this.characterName}}</div>
|
||||||
<input class="character-handle" value="{{this.handle}}"/>
|
<input class="player-handle" value="{{this.playerHandle}}"/>
|
||||||
|
<input class="character-alias" value="{{this.characterAlias}}"/>
|
||||||
</div>
|
</div>
|
||||||
<div class="available-versions">
|
<div class="available-versions">
|
||||||
Avaiable Versions Go Here
|
Avaiable Versions Go Here
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Alias</th>
|
||||||
|
<th>Player</th>
|
||||||
|
<th>Table</th>
|
||||||
|
<th>Version</th>
|
||||||
|
</tr>
|
||||||
{{#each this.reads}}
|
{{#each this.reads}}
|
||||||
<div>{{this.characterName}} {{this.playerName}} {{this.sourceTable}} {{this.version}}</div>
|
<tr>
|
||||||
|
<td>{{this.characterName}}</td>
|
||||||
|
<td>{{this.playerName}}</td>
|
||||||
|
<td>{{this.sourceTable}}</td>
|
||||||
|
<td>{{this.version}}</td>
|
||||||
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
<tr>
|
||||||
|
<td><input class="character-alias" value="{{this.characterAlias}}"/></td>
|
||||||
|
<td><input class="player-handle" value="{{this.playerHandle}}"/>
|
||||||
|
</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<button class="archive-button">Archive</button>
|
<button class="archive-button">Archive</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ interface CharacterArchiverData {
|
|||||||
potato: string;
|
potato: string;
|
||||||
reads: Character[];
|
reads: Character[];
|
||||||
playerHandle: string;
|
playerHandle: string;
|
||||||
|
characterName: string;
|
||||||
|
characterAlias: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CharacterArchiver extends Application {
|
export class CharacterArchiver extends Application {
|
||||||
@@ -24,13 +26,16 @@ export class CharacterArchiver extends Application {
|
|||||||
data: CharacterArchiverData = {
|
data: CharacterArchiverData = {
|
||||||
potato: "po tato potato",
|
potato: "po tato potato",
|
||||||
reads: [],
|
reads: [],
|
||||||
playerHandle: "default"
|
playerHandle: "default",
|
||||||
|
characterName: "",
|
||||||
|
characterAlias: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(characterId: string) {
|
constructor(characterId: string, tableName: string) {
|
||||||
super()
|
super()
|
||||||
this.characterId = characterId;
|
this.characterId = characterId;
|
||||||
this.character = (game as Game).actors!.get(characterId);
|
this.character = (game as Game).actors!.get(characterId);
|
||||||
|
this.data.characterName = this.character!.name || "";;
|
||||||
}
|
}
|
||||||
|
|
||||||
static override get defaultOptions() {
|
static override get defaultOptions() {
|
||||||
@@ -80,9 +85,10 @@ export class CharacterArchiver extends Application {
|
|||||||
characterData: characterMsg
|
characterData: characterMsg
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("HERE: " + JSON.stringify(request));
|
this.client.createCharacter(request).then((response) => {
|
||||||
|
this.render(true);
|
||||||
this.client.createCharacter(request);
|
return response;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout: NodeJS.Timeout | undefined;
|
timeout: NodeJS.Timeout | undefined;
|
||||||
@@ -90,17 +96,15 @@ export class CharacterArchiver extends Application {
|
|||||||
private async handleChange(e: Event) {
|
private async handleChange(e: Event) {
|
||||||
clearTimeout(this.timeout);
|
clearTimeout(this.timeout);
|
||||||
this.timeout = setTimeout(async () => {
|
this.timeout = setTimeout(async () => {
|
||||||
console.log(e.target);
|
|
||||||
const target = e.target as HTMLTextAreaElement;
|
const target = e.target as HTMLTextAreaElement;
|
||||||
this.data.playerHandle = target.value;
|
this.data.playerHandle = target.value;
|
||||||
console.log(this.data.playerHandle);
|
console.log(this.data.playerHandle);
|
||||||
console.log(await this.loadArchiveList());
|
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async loadArchiveList(): Promise<Character[]> {
|
private async loadArchiveList(): Promise<Character[]> {
|
||||||
return this.client.listCharacters({
|
return this.client.listCharacters({
|
||||||
playerName: "iamBadgers",
|
playerName: "",
|
||||||
characterName: this.character!.name || ""
|
characterName: this.character!.name || ""
|
||||||
}).response
|
}).response
|
||||||
.then((response) => response.characters);
|
.then((response) => response.characters);
|
||||||
|
|||||||
@@ -3,16 +3,4 @@ export const MODULE_ID = "rush-character-archive-foundry-module";
|
|||||||
|
|
||||||
export const URI_SETTING_NAME = "uri_setting";
|
export const URI_SETTING_NAME = "uri_setting";
|
||||||
export const API_KEY_NAME = "api_key";
|
export const API_KEY_NAME = "api_key";
|
||||||
|
export const TABLE_NAME = "table_name";
|
||||||
export function debounce<P extends any[]>(
|
|
||||||
callback: (...args: P) => any,
|
|
||||||
time: number
|
|
||||||
): (...args: P) => void {
|
|
||||||
let timer: NodeJS.Timeout | undefined;
|
|
||||||
return function (this: any, ...args: P) {
|
|
||||||
clearTimeout(timer);
|
|
||||||
timer = setTimeout(() => callback.apply(this, args), time);
|
|
||||||
return timer;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import {MODULE_ID, URI_SETTING_NAME, API_KEY_NAME} from "./common.js"
|
import {MODULE_ID, URI_SETTING_NAME, API_KEY_NAME, TABLE_NAME} from "./common"
|
||||||
|
|
||||||
export function initializeSettings() {
|
export function initializeSettings() {
|
||||||
(game as Game).settings!.register(MODULE_ID, URI_SETTING_NAME, {
|
if ((game as Game).settings) {
|
||||||
|
(game as Game).settings.register(MODULE_ID, URI_SETTING_NAME, {
|
||||||
name: "Archive Server URI",
|
name: "Archive Server URI",
|
||||||
hint: "Address of the character archive server.",
|
hint: "Address of the character archive server.",
|
||||||
scope: "world",
|
scope: "world",
|
||||||
@@ -11,7 +12,7 @@ export function initializeSettings() {
|
|||||||
type: String,
|
type: String,
|
||||||
});
|
});
|
||||||
|
|
||||||
(game as Game).settings!.register(MODULE_ID, API_KEY_NAME, {
|
(game as Game).settings.register(MODULE_ID, API_KEY_NAME, {
|
||||||
name: "API Key",
|
name: "API Key",
|
||||||
hint: "API key to use when communicating with the archive server.",
|
hint: "API key to use when communicating with the archive server.",
|
||||||
scope: "world",
|
scope: "world",
|
||||||
@@ -20,4 +21,14 @@ export function initializeSettings() {
|
|||||||
default: "",
|
default: "",
|
||||||
type: String,
|
type: String,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
(game as Game).settings.register(MODULE_ID, TABLE_NAME, {
|
||||||
|
name: "Table Name",
|
||||||
|
hint: "Table name to attatch to archived characters.",
|
||||||
|
scope: "world",
|
||||||
|
config: true,
|
||||||
|
default: "My Table",
|
||||||
|
type: String,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user