Not even sure at this point
This commit is contained in:
@@ -1,13 +1,34 @@
|
||||
<div>
|
||||
<div class="details">
|
||||
Hello There {{this.potato}}
|
||||
<input class="character-handle" value="{{this.handle}}"/>
|
||||
<div class="character-name">Character to Archive: {{this.characterName}}</div>
|
||||
<input class="player-handle" value="{{this.playerHandle}}"/>
|
||||
<input class="character-alias" value="{{this.characterAlias}}"/>
|
||||
</div>
|
||||
<div class="available-versions">
|
||||
Avaiable Versions Go Here
|
||||
<table>
|
||||
<tr>
|
||||
<th>Alias</th>
|
||||
<th>Player</th>
|
||||
<th>Table</th>
|
||||
<th>Version</th>
|
||||
</tr>
|
||||
{{#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}}
|
||||
<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>
|
||||
<button class="archive-button">Archive</button>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,8 @@ interface CharacterArchiverData {
|
||||
potato: string;
|
||||
reads: Character[];
|
||||
playerHandle: string;
|
||||
characterName: string;
|
||||
characterAlias: string;
|
||||
}
|
||||
|
||||
export class CharacterArchiver extends Application {
|
||||
@@ -24,13 +26,16 @@ export class CharacterArchiver extends Application {
|
||||
data: CharacterArchiverData = {
|
||||
potato: "po tato potato",
|
||||
reads: [],
|
||||
playerHandle: "default"
|
||||
playerHandle: "default",
|
||||
characterName: "",
|
||||
characterAlias: "",
|
||||
}
|
||||
|
||||
constructor(characterId: string) {
|
||||
constructor(characterId: string, tableName: string) {
|
||||
super()
|
||||
this.characterId = characterId;
|
||||
this.character = (game as Game).actors!.get(characterId);
|
||||
this.data.characterName = this.character!.name || "";;
|
||||
}
|
||||
|
||||
static override get defaultOptions() {
|
||||
@@ -80,9 +85,10 @@ export class CharacterArchiver extends Application {
|
||||
characterData: characterMsg
|
||||
};
|
||||
|
||||
console.log("HERE: " + JSON.stringify(request));
|
||||
|
||||
this.client.createCharacter(request);
|
||||
this.client.createCharacter(request).then((response) => {
|
||||
this.render(true);
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
timeout: NodeJS.Timeout | undefined;
|
||||
@@ -90,17 +96,15 @@ export class CharacterArchiver extends Application {
|
||||
private async handleChange(e: Event) {
|
||||
clearTimeout(this.timeout);
|
||||
this.timeout = setTimeout(async () => {
|
||||
console.log(e.target);
|
||||
const target = e.target as HTMLTextAreaElement;
|
||||
this.data.playerHandle = target.value;
|
||||
console.log(this.data.playerHandle);
|
||||
console.log(await this.loadArchiveList());
|
||||
}, 500);
|
||||
}
|
||||
|
||||
private async loadArchiveList(): Promise<Character[]> {
|
||||
return this.client.listCharacters({
|
||||
playerName: "iamBadgers",
|
||||
playerName: "",
|
||||
characterName: this.character!.name || ""
|
||||
}).response
|
||||
.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 API_KEY_NAME = "api_key";
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
export const TABLE_NAME = "table_name";
|
||||
|
||||
@@ -1,23 +1,34 @@
|
||||
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() {
|
||||
(game as Game).settings!.register(MODULE_ID, URI_SETTING_NAME, {
|
||||
name: "Archive Server URI",
|
||||
hint: "Address of the character archive server.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
// restricted: true,
|
||||
default: "https://chararchive.cyberpunkrush.com",
|
||||
type: String,
|
||||
});
|
||||
if ((game as Game).settings) {
|
||||
(game as Game).settings.register(MODULE_ID, URI_SETTING_NAME, {
|
||||
name: "Archive Server URI",
|
||||
hint: "Address of the character archive server.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
// restricted: true,
|
||||
default: "https://chararchive.cyberpunkrush.com",
|
||||
type: String,
|
||||
});
|
||||
|
||||
(game as Game).settings!.register(MODULE_ID, API_KEY_NAME, {
|
||||
name: "API Key",
|
||||
hint: "API key to use when communicating with the archive server.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
// restricted: true,
|
||||
default: "",
|
||||
type: String,
|
||||
});
|
||||
(game as Game).settings.register(MODULE_ID, API_KEY_NAME, {
|
||||
name: "API Key",
|
||||
hint: "API key to use when communicating with the archive server.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
// restricted: true,
|
||||
default: "",
|
||||
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