first alpha version 0.0.1
This commit is contained in:
commit
37a0f98d3e
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.vscode/*
|
||||
16
module.json
Normal file
16
module.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"id": "puckoprutt",
|
||||
"title": "puckoprutt",
|
||||
"description": "add communication to the puckoprutt web api",
|
||||
"authors": [
|
||||
{ "name": "Robin Riis" }
|
||||
],
|
||||
"version": "0.1.0",
|
||||
"compatability": {
|
||||
"minimum": "12",
|
||||
"verified": "12"
|
||||
},
|
||||
"scripts": [
|
||||
"scripts/puckochat/main.js"
|
||||
]
|
||||
}
|
||||
121
scripts/macros/start-conversation.js
Normal file
121
scripts/macros/start-conversation.js
Normal file
@ -0,0 +1,121 @@
|
||||
conversation_tavern();
|
||||
|
||||
async function talk_as(idx, name, theatre_idx, message, emote, delay=4500) {
|
||||
theatre.functions.activateStagedByID(theatre_idx);
|
||||
theatre._sendTypingEvent();
|
||||
theatre.setUserTyping(game.user.id, theatre.speakingAs);
|
||||
await new Promise(r => setTimeout(r, 800));
|
||||
theatre._sendTypingEvent();
|
||||
theatre.setUserTyping(game.user.id, theatre.speakingAs);
|
||||
theatre.setEmoteForInsertById(emote, "theatre-"+idx);
|
||||
await new Promise(r => setTimeout(r, 700));
|
||||
ChatMessage.create({
|
||||
user: game.user.id,
|
||||
speaker: ChatMessage.getSpeaker({token: canvas.tokens.objects.getChildByName(name)}),
|
||||
content: message
|
||||
});
|
||||
await new Promise(r => setTimeout(r, delay));
|
||||
theatre.setEmoteForInsertById("none", "theatre-"+idx);
|
||||
}
|
||||
|
||||
async function conversation_tavern() {
|
||||
// make sure we are in the correct scene.
|
||||
if(canvas.scene.name != "village") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove any staged player/npc
|
||||
Object.keys(theatre.stage).forEach(a => theatre._removeFromStage(a));
|
||||
|
||||
const name_laila = "Laila Joo";
|
||||
const name_voggusti = "Voggusti Waaland";
|
||||
const name_valeros = "Valeros";
|
||||
const name_merisiel = "Merisiel";
|
||||
const name_ezren = "Ezren";
|
||||
|
||||
let chat_ids = [];
|
||||
|
||||
// get logged in players.
|
||||
let players = await game.users;
|
||||
players = players.filter(user => !user.isGM);
|
||||
players.forEach(p => chat_ids.push(p.character._id));
|
||||
|
||||
// get npc's to stage.
|
||||
let idx_laila = canvas.tokens.objects.getChildByName(name_laila).actor.id; // id 0
|
||||
let idx_voggusti = canvas.tokens.objects.getChildByName(name_voggusti).actor.id; // id 1
|
||||
let idx_merisiel = canvas.tokens.objects.getChildByName(name_merisiel).actor.id; // id 2
|
||||
let idx_valeros = canvas.tokens.objects.getChildByName(name_valeros).actor.id; // id 3
|
||||
let idx_ezren = canvas.tokens.objects.getChildByName(name_ezren).actor.id; // id 4
|
||||
let participants = [idx_laila, idx_voggusti, idx_merisiel, idx_valeros, idx_ezren];
|
||||
participants.forEach(p => theatre.activateInsertById(p));
|
||||
|
||||
// Valeros talks.
|
||||
await talk_as(idx_valeros, name_valeros, 3, "Who the fuck are these guys? do you know them Marisiel?", "none");
|
||||
|
||||
// Remove Valeros from stage.
|
||||
theatre.functions.removeFromStagedByID(3);
|
||||
await new Promise(r => setTimeout(r, 1000));
|
||||
|
||||
// Merisiel talks.
|
||||
await talk_as(idx_merisiel, name_merisiel, 2, "Never seen them before.. you think they got some good loot to steal", "innocent");
|
||||
|
||||
// Voggusti talks.
|
||||
await talk_as(idx_voggusti, name_voggusti, 1, "Heeey Laaaaaila! can you bring me a ale daaaarling", "carefree", 1500);
|
||||
|
||||
// Remove Merisiel from stage.
|
||||
theatre.functions.removeFromStagedByID(2);
|
||||
await new Promise(r => setTimeout(r, 2000));
|
||||
|
||||
// Laila talks.
|
||||
await talk_as(idx_laila, name_laila, 0, "Mr. Vuggosti you are drunk af, please just go home you are scarring the customers!", "worried");
|
||||
|
||||
// Voggusti gets frustrated.
|
||||
theatre.setEmoteForInsertById("frustrated", "theatre-"+idx_voggusti);
|
||||
|
||||
// remove laila from stage.
|
||||
theatre.functions.removeFromStagedByID(0);
|
||||
|
||||
// Ezren talks
|
||||
await talk_as(idx_ezren, name_ezren, 4, "Calm down Merisiel please dont steal from these young adventurers. Remember when we started doing adventures in Otari.", "none");
|
||||
|
||||
// remove Voggusti from stage.
|
||||
theatre.functions.removeFromStagedByID(1);
|
||||
|
||||
// Merisiel talks
|
||||
await talk_as(idx_merisiel, name_merisiel, 2, "Yea of course i remember, our first mission when i stole that silver plate! it was beutiful.", "none");
|
||||
|
||||
// Ezren talks
|
||||
await talk_as(idx_ezren, name_ezren, 4, "yea these adventurers are gonna have as fun as we did, dont ruin it for them also.. Be nice", "none");
|
||||
|
||||
// Merisiel talks
|
||||
await talk_as(idx_merisiel, name_merisiel, 2, "you are so boring you damn sober tea drinking wizard.. it was just a joke..", "smug");
|
||||
|
||||
// remove Merisiel and ezren from stage
|
||||
theatre.functions.removeFromStagedByID(4);
|
||||
theatre.functions.removeFromStagedByID(2);
|
||||
|
||||
// Valeros talks
|
||||
await talk_as(idx_valeros, name_valeros, 3, "Can everyone just shut up and be happy? im trying to enjoy my beer here..", "none");
|
||||
|
||||
// remove valeros from stage.
|
||||
theatre.functions.removeFromStagedByID(3);
|
||||
|
||||
// voggusti talks.
|
||||
await talk_as(idx_voggusti, name_voggusti, 1, "You here that Laila, listen to the old tea geezer, be nice and bring me a beer", "carefree");
|
||||
|
||||
// laila talks.
|
||||
await talk_as(idx_laila, name_laila, 0, "well if everyone will be happy and enjoy my beer i could give you a beer voggusti.. but after this one you will leave.", "none");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* take everyone off stage
|
||||
*/
|
||||
await new Promise(r => setTimeout(r, 5000));
|
||||
// remove npc's from stage
|
||||
await theatre._removeFromStage("theatre-"+idx_laila);
|
||||
await theatre._removeFromStage("theatre-"+idx_voggusti);
|
||||
await theatre._removeFromStage("theatre-"+idx_merisiel);
|
||||
await theatre._removeFromStage("theatre-"+idx_valeros);
|
||||
await theatre._removeFromStage("theatre-"+idx_ezren);
|
||||
}
|
||||
13
scripts/puckochat/commands.js
Normal file
13
scripts/puckochat/commands.js
Normal file
@ -0,0 +1,13 @@
|
||||
function test(user) {
|
||||
return `hello ${user}`;
|
||||
}
|
||||
|
||||
export function command(isGM, user, world, log, message, data) {
|
||||
console.log(`isGM: ${isGM}`);
|
||||
console.log(`user: ${user}`);
|
||||
console.log(`world: ${world}`);
|
||||
console.log(`log: ${log}`);
|
||||
console.log(`message: ${message}`);
|
||||
console.log(`data: ${data}`);
|
||||
if(message[0] === "test") return test(user);
|
||||
}
|
||||
22
scripts/puckochat/main.js
Normal file
22
scripts/puckochat/main.js
Normal file
@ -0,0 +1,22 @@
|
||||
import "commands"
|
||||
|
||||
Hooks.on("init", function() {
|
||||
console.log("[puckoprutt] Hello Init");
|
||||
});
|
||||
|
||||
Hooks.on("ready", function() {
|
||||
console.log("[puckoprutt] Hello Ready");
|
||||
});
|
||||
|
||||
Hooks.on("chatMessage", (log, message, data) => {
|
||||
to_send = "";
|
||||
if(message[0] === "!") to_send = commands.command(log, message.slice(1).split(" "), data);
|
||||
|
||||
if(to_send !== "") {
|
||||
ChatMessage.create({
|
||||
user: Gamepad.user.id,
|
||||
speaker: ChatMessage.getSpeaker({actor: game.actors.getName("puckoprutt"), alias: "Almighty God"}),
|
||||
content: to_send
|
||||
});
|
||||
}
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user