Utilisateur:Skrool/AF2020.js
Aller à la navigation
Aller à la recherche
Note : après avoir publié vos modifications, il se peut que vous deviez forcer le rechargement complet du cache de votre navigateur pour voir les changements.
- Firefox / Safari : maintenez la touche Maj (Shift) en cliquant sur le bouton Actualiser ou appuyez sur Ctrl + F5 ou Ctrl + R (⌘ + R sur un Mac).
- Google Chrome : appuyez sur Ctrl + Maj + R (⌘ + Shift + R sur un Mac).
- Internet Explorer / Edge : maintenez la touche Ctrl en cliquant sur le bouton Actualiser ou pressez Ctrl + F5.
- Opera : appuyez sur Ctrl + F5.
/* Global settings */ let SadBrahamSettings = {"lang":"fr", "sound":true, "cname":"Commandant", "useCustomName":false, "writeAnimation":true}; /* Entry points */ let SadBrahamEntryPoints = ["point-0", "charisme-0", "pq-0", "jeu-0", "cantha-0", "faren-0", "gazette-0", "bag"]; // List of possible entry points let SadBrahamEntryPoint = ""; // Variable set to determine which entry point will be used (Do not change) /* Dialogues data */ let dialogues = { "bag" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"...", "en":"...", }, "react":"bag", "answers": [ { "type":"default", "fr":"Oh non...", "en":"Oh no...", }, { "type":"default", "fr":"Oh non...", "en":"Oh no...", }, ] }, "crying-chain-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Je crois que je vais pleurer...", "en":"I think I'm gonna cry...", }, "react":"sad1", "answers": [ { "type":"default", "to":"crying-chain-1", "fr":"Oh non...", "en":"Oh no...", }, { "type":"default", "to":"crying-chain-1", "fr":"Oh non...", "en":"Oh no...", }, ] }, "crying-chain-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Bouhouhouhouhou...", "en":"<em>Sobs</em>", }, "react":"crying", "to" : "crying-chain-2" }, "crying-chain-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Bouhouhouhouhouhouhou...", "en":"<em>Sobs</em>", }, "react":"crying", "to" : "crying-chain-3" }, "crying-chain-3" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Bouhouhouhouhou... snif... bouhouhou...", "en":"<em>Sobs even more, somehow</em>", }, "react":"crying", "to" : "crying-chain-4" }, "crying-chain-4" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Bouhouhouhouhou...", "en":"<em>Sobs (again)</em>", }, "react":"crying", "to" : "crying-chain-2" }, "point-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"%name%? J'aurais besoin de parler...", "en":"%name%? I need to talk...", }, "react":"sad1", "answers": [ { "type":"default", "to":"point-1-1", "fr":"Je t'écoute Braham", "en":"I am listening, Braham.", }, { "type":"default", "to":"point-2-1", "fr":"Je n'ai pas trop le temps, Braham.", "en":"I don't have the time for that, Braham.", }, ] }, "point-1-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"J'aimerais faire le point sur ma vie...<br/>J'ai l'impression d'être inutile...", "en":"I would like to take a step back and think about my life...<br/>I have the feeling of being useless...", }, "react":"sad1", "answers": [ { "type":"default", "to":"point-1-2", "fr":"Oh non...", "en":"Oh no...", }, { "type":"default", "to":"crying-chain-0", "fr":"Effectivement.", "en":"Yes you are.", }, ] }, "point-1-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"J'ai jamais réussi à faire ce que je voulais... Je voulais construire ma légende... mais j'arrive même pas à faire mes lacets...", "en":"I have never managed to do what I wanted... I wanted to forge my legend but... I can't even tie my shoelaces...", }, "react":"sad1", "answers": [ { "type":"default", "to":"point-1-4", "fr":"C'est pas grave... Ca va venir...", "en":"Don't worry... You will make it...", }, { "type":"default", "to":"point-1-3", "fr":"Mais Braham... Tu n'as pas de lacets...", "en":"But Braham... You have no shoelaces...", }, ] }, "point-1-3" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"...", "en":"...", }, "react":"dreaming", "to":"point-1-3-2" }, "point-1-3-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"...<br/>...", "en":"...<br/>...", }, "react":"dreaming", "to":"point-1-3-3" }, "point-1-3-3" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"...", "en":"...", }, "react":"dreaming", "to":"point-1-3-4" }, "point-1-3-4" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"MAIS C'ETAIT POUR CA!", "en":"SO THAT'S WHY!", }, "react":"surprised", "answers": [ { "type":"default", "fr":"...", "en":"...", }, { "type":"default", "fr":"...", "en":"...", }, ] }, "point-1-4" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Mais j'ai jamais rien accomplis d'intéressant... J'ai échoué à tuer Jormag, sauver ma mère, construire un couple durable, apprendre à lire...", "en":"But I haven't done anything interesting... I failed killing Jormag, saving my mother, building a long-lasting relationship, learn how to read...", }, "react":"sad1", "answers": [ { "type":"default", "to":"point-1-5", "fr":"C'est pas grave... Ca va venir...", "en":"Don't worry... You will make it...", }, { "type":"default", "to":"crying-chain-0", "fr":"Effectivement, tu es mauvais.", "en":"Indeed, you're bad.", }, ] }, "point-1-5" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"En plus, j'ai aucun charisme... J'ai beau me promener torse nu... personne n'est impressionné...", "en":"On top of that I have no charisma... I am walking aroud bare-chested... and no one is impressed...", }, "react":"sad1", "answers": [ { "type":"ferocity", "to":"crying-chain-0", "fr":"Effectivement, tu es mauvais.", "en":"Indeed, you're bad.", }, { "type":"charm", "to":"point-1-6", "fr":"Moi j'aime bien", "en":"I like it personally.", }, { "type":"ferocity", "to":"crying-chain-0", "fr":"Effectivement, tu es mauvais.", "en":"Indeed, you're bad.", }, { "type":"ferocity", "to":"crying-chain-0", "fr":"Effectivement, tu es mauvais.", "en":"Indeed, you're bad.", }, ] }, "point-1-6" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"C-c'est vrais?", "en":"R-really?", }, "react":"surprised", "answers": [ { "type":"ferocity", "to":"crying-chain-0", "fr":"Non.", "en":"No.", }, { "type":"ferocity", "to":"crying-chain-0", "fr":"Non.", "en":"No.", }, { "type":"ferocity", "to":"crying-chain-0", "fr":"Non.", "en":"No.", }, { "type":"ferocity", "to":"crying-chain-0", "fr":"Non.", "en":"No.", }, ] }, "point-2-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Mais... mais...<br/>%name%... on forme une équipe non?<br/>On est censé se supporter, non?", "en":"But... but...<br/>%name%... we are a team, aren't we?<br/>Aren't we supposed to be there for eachother?", }, "react":"sad1", "answers": [ { "type":"default", "to":"point-1-1", "fr":"Bon... je t'écoute...", "en":"Fiiine... I am listening...", }, { "type":"default", "to":"point-2-2", "fr":"Effectivement. Mais pas maintenant.", "en":"Indeed, but not now.", }, { "type":"default", "to":"crying-chain-0", "fr":"Effectivement. Mais pas pour toi.", "en":"Indeed, but not for you.", }, ] }, "point-2-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Mais... mais...", "en":"But... but...", }, "react":"sad2", "answers": [ { "type":"default", "to":"point-2-3", "fr":"Shhhhhhh! Silence maintenant.", "en":"Shhhhhhh! Silence now.", }, ] }, "point-2-3" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"", "en":"", }, "react":"sad2", }, "charisme-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"%name%? J'aurais besoin de conseils...", "en":"%name%? I need advices...", }, "react":"sad1", "to":"charisme-1" }, "charisme-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Je n'ai aucun charisme... Comment je dois faire pour améliorer ça ?", "en":"I have no charisma... How can I fix that?", }, "react":"sad1", "answers": [ { "type":"dignity", "to":"charisme-inspirer-1", "fr":"Inspire toi des meilleurs", "en":"Draw your inspiration from the best", }, { "type":"ferocity", "to":"charisme-stop-1", "fr":"Arrête de parler", "en":"Stop talking", }, ] }, "charisme-inspirer-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Hmm... Je vais tenter quelque chose...", "en":"Hmmm... Let me try something...", }, "react":"dreaming", "to":"charisme-inspirer-2" }, "charisme-inspirer-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Tadaaa! Qu'en penses-tu ?", "en":"Tadaaa! What do you think?", }, "react":"charismatic", "answers": [ { "type":"default", "to":"charisme-inspirer-3", "fr":"...", "en":"...", }, ], "to":"charisme-inspirer-3" }, "charisme-inspirer-3" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Là au moins j'ai l'air de quelque chose!", "en":"Now I'm looking like something!", }, "react":"charismatic", "to":"charisme-inspirer-4" }, "charisme-inspirer-4" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Je vais enfin être respecté!", "en":"I will get the respect I deserve!", }, "react":"charismatic", "to":"charisme-inspirer-5" }, "charisme-inspirer-5" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Alors?", "en":"So?", }, "react":"charismatic", "answers": [ { "type":"leave", "fr":"Il y a du boulot...", "en":"There is still some work needed...", }, { "type":"leave", "fr":"Quelle horreur...", "en":"Horrible.", }, ] }, "charisme-stop-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"...", "en":"...", }, "react":"sad2" }, "jeu-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"%name%?", "en":"%name%?", }, "react":"sad1", "answers": [ { "type":"default", "fr":"Oui Braham?", "en":"Yes Braham?", "to":"jeu-1" }, ] }, "jeu-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"%name% ? J'ai besoin d'aide.", "en":"%name%? I need help.", }, "react":"sad1", "answers": [ { "type":"default", "fr":"Qu'est-ce qui ne va pas ?", "en":"What is happening?", "to":"jeu-2" }, { "type":"leave", "fr":"Je n'ai pas le temps.", "en":"I don't have the time for that.", }, ] }, "jeu-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Je n'arrive pas à vaincre ce boss, sur ce jeu que Taimi m'a donné...", "en":"I can't manage to kill the boss on that game Taimi gave me...", }, "react":"sad2", "answers": [ { "type":"default", "fr":"Quoi ?", "en":"What ?", "to":"jeu-3" }, { "type":"leave", "fr":"Alors demande à Taimi.", "en":"Then ask Taimi.", }, ] }, "jeu-3" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Oui je sais... même pour ça, je suis nul <em>(sanglots)</em>", "en":"I know... even for that I'm incompetent <em>(sobs)</em>", }, "react":"crying", "answers": [ { "type":"leave", "fr":"Taimi peut sûrement t'aider.", "en":"Taimi can certainly help you.", }, { "type":"leave", "fr":"Je n'ai pas le temps.", "en":"I don't have the time for that.", }, ] }, "faren-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Dites %name%, vous qui êtes de la Haute... vous connaîtriez le Seigneur Faren ?", "en":"Say %name%, since you walk among the most important... do you know Lord Faren?", }, "react":"happy1", "answers": [ { "type":"default", "fr":"Heu... oui ?", "en":"... yes?", "to":"faren-1" }, { "type":"leave", "fr":"Qui? Jamais entendu parlé. Au revoir!", "en":"Who? Never heard about them. Bye!", }, ] }, "faren-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"J'ai vu son calendrier et...", "en":"I saw his calendar and...", }, "react":"smirk", "answers": [ { "type":"default", "fr":"Et ?", "en":"And?", "to":"faren-2" }, { "type":"leave", "fr":"<em>Raccrocher</em>", "en":"<em>Hang up</em>", }, ] }, "faren-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"... et j'aimerai savoir si son tailleur peut me faire un <span style=\"color:#f43f85;\">Slip légendaire de Faren</span> à ma taille.", "en":"... and I would like to know if his tailor could make me one of his <span style=\"color:#f43f85;\">Legendary Faren's underwear</span> to my size.", }, "react":"smirk", "answers": [ { "type":"charm", "fr":"Quelle idée merveilleuse !", "en":"What an amazing idea!", }, { "type":"dignity", "fr":"Si cela peut te redonner confiance en toi...", "en":"If it can help you being more confident...", }, { "type":"ferocity", "fr":"Ne m'appelle plus !", "en":"Never talk to me again!", }, { "type":"leave", "fr":"<em>Raccrocher</em>", "en":"<em>Hang up</em>", }, ] }, "cantha-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Dites %name%, je suis en train de préparer mon sac pour Cantha...", "en":"Say %name%, I'm preparing my bag for Cantha...", }, "react":"happy1", "answers": [ { "type":"default", "fr":"Tu sais que ce n'est pas pour demain ?", "en":"You are aware that it is not for tomorrow, aren't you?", "to":"cantha-1" }, { "type":"leave", "fr":"Tant mieux pour toi", "en":"Nice for you.", }, ] }, "cantha-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Oui, mais j'avais une question très importante !", "en":"Yes, but I had a really important question!", }, "react":"happy1", "answers": [ { "type":"default", "fr":"Je t'écoute ?", "en":"I am listening?", "to":"cantha-2" }, { "type":"leave", "fr":"Et bien, je te suggère de la garder pour toi.", "en":"Then you can keep this very important question to yourself.", }, ] }, "cantha-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Est-ce que je dois prévoir mon maillot de bain ? Et si oui, la couleur a-t-elle une importance ?", "en":"Do I have to think about my swimmwear? If so, is the color important?", }, "react":"happy2", "answers": [ { "type":"charm", "fr":"Bien sûr ! Kasmeer devrait pouvoir te prêter ça !", "en":"Of course! I am sure Kasmeer would be glad to share some of hers.", }, { "type":"dignity", "fr":"Je te suggère simplement d'enlever un peu de fourrure sur ton armure, et ça devrait suffire.", "en":"With a bit less of fur on your armor, it should be enough.", }, { "type":"ferocity", "fr":"Braham, nous n'irons pas à Cantha pour profiter du soleil. Et évite de m'appeler pour ce genre de considération...", "en":"Braham, we are not travelling to enjoy the sun. And please do not call me for this kind of topics.", }, { "type":"leave", "fr":"<em>Raccrocher</em>", "en":"<em>Hang up</em>", }, ] }, "pq-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Au secours %name% ! A l'aide !", "en":"%name%! Help! Help!", }, "react":"surprised", "answers": [ { "type":"default", "fr":"Que se passe-t-il, Braham ?", "en":"What is happening, Braham?", "to":"pq-1" }, { "type":"leave", "fr":"Crr... crrr... Ca ne capte pas très bien!", "en":"Crr... crrr... The signal is really low!", }, ] }, "pq-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"C'est épouvantable, %name%, venez vite !", "en":"It's really horrible, %name%, come quick!", }, "react":"surprised", "answers": [ { "type":"default", "fr":"Quoi ? Qu'y a-t-il Braham ?", "en":"What? What is it Braham?", "to":"pq-2" }, { "type":"leave", "fr":"<em>Jeter le communicateur le plus loin possible</em>", "en":"<em>Throwing the communicator as far away as possible</em>", }, ] }, "pq-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Je n'ai plus de papier toilette !", "en":"I have no toilet paper left!", }, "react":"crying", "answers": [ { "type":"charm", "fr":"Tu as de la chance, j'en ai acheté tellement que je n'ai plus de place dans ma zone personnelle !", "en":"You are lucky! I bought so much that my home instance is full!", }, { "type":"dignity", "fr":"C'est ballot !", "en":"What a bummer!", }, { "type":"ferocity", "fr":"Débrouille toi!", "en":"It's your problem.", }, { "type":"leave", "fr":"Moi non plus.", "en":"Me nether.", }, ] }, "gazette-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"%name%, Mordremoth est de retour !", "en":"%name%, Mordremoth is back!", }, "react":"surprised", "answers": [ { "type":"default", "fr":"Comment ça ?", "en":"What do you mean?", "to":"gazette-1" }, { "type":"leave", "fr":"C'est bien, Braham. Tu veux un cookie ?", "en":"Goood Braham, goood! Do you want a cookie?", }, ] }, "gazette-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Vous n'avez pas lu la Gazette tyrienne dernièrement ?", "en":"Haven't your read the Tyrian Gazette recently?", }, "react":"explain", "answers": [ { "type":"default", "fr":"Non, pas du tout.", "en":"Not at all", "to":"gazette-2" }, { "type":"leave", "fr":"Non, elle était en rupture de stock.", "en":"No, it was out of stock.", }, ] }, "gazette-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Il tente de prendre le contrôle de la Tyrie avec des Choya !", "en":"They try to take back Tyria with armies of Choya!", }, "react":"surprised", "answers": [ { "type":"charm", "fr":"Parfait ! Un nouveau compagnon pour ma zone personnelle, et un nouveau familier pour mon rôdeur !", "en":"Wonderful, a new friend in my personal area, and a new pet for my ranger!", }, { "type":"dignity", "fr":"Braham, je pense que c'est une fake news... Nous avons tué Mordremoth.", "en":"Braham, it's obviously another fake news... We killed Mordremoth.", }, { "type":"ferocity", "fr":"Braham, c'est toi qui va devenir une choya si tu continue !", "en":"Braham, you are the one ending like a choya if you continue like this!", }, { "type":"leave", "fr":"Mais oui, mais oui...", "en":"Of course... Of course...", }, ] }, "braham-0" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Heu... %name% ? Vous ne seriez pas en train de me stalker là ?", "en":"%name%? What are you doing on this page?", }, "react":"surprised", "answers": [ { "type":"default", "fr":"Oh pardon, je cherche des informations sur des Dolyacks... La ressemblance était frappante.", "en":"Oops! Sorry! I was looking for informations about Dolyacks... I was not that far.", "to":"braham-1" }, { "type":"leave", "fr":"Désolé, je me suis perdu...", "en":"Sorry, I got lost...", }, ] }, "braham-1" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Mais... mais... c'est pas gentil ça !", "en":"But... but... it was not kind!", }, "react":"sad2", "answers": [ { "type":"default", "fr":"Roooh ! C'est bon ! C'était un blague !", "en":"Roooh! That's fine! It was just a joke!", "to":"braham-3" }, { "type":"leave", "fr":"La véritée est comme Kormir: personne ne l'aime, et ça fait mal de la regarder en face.", "en":"Truth is like Kormir. No one like it, and it hurts to face it.", }, ] }, "braham-2" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Mais... mais...", "en":"But... but...", }, "react":"pouting", "answers": [ { "type":"aggressive", "fr":"Tu vas faire quoi? Tu vas pleurer?", "en":"What are you going to do? Crying?", "to":"braham-3" },, ] }, "braham-3" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Ah ouais ? Si c'est comme ça, je casse ta page ! C'est tout ce que tu auras gagné !", "en":"Yeah? And I'm going to break your page, that's all you deserve!", }, "react":"pouting", "answers": [ { "type":"default", "fr":"Quoi?", "en":"What?", "to":"braham-4" }, ] }, "braham-4" : { "from": { "fr":"Braham", "en":"Braham", }, "text": { "fr":"Voilà! On fait moins le malin maintenant?", "en":"There! Who is the smart one, now?", }, "action":"break", "react":"pouting", "answers": [ { "type":"leave", "fr":"C'est stupide...", "en":"That's stupid..." }, ] }, }; let SadBrahamReactImg = { "smirk" : "https://wiki-fr.guildwars2.com/images/c/c5/Utilisateur_Skrool_-_Braham_Smirk.png", "sad2" : "https://wiki-fr.guildwars2.com/images/6/62/Utilisateur_Skrool_-_Braham_Sad_2.png", "sad1" : "https://wiki-fr.guildwars2.com/images/8/80/Utilisateur_Skrool_-_Braham_Sad_1.png", "happy2" : "https://wiki-fr.guildwars2.com/images/1/13/Utilisateur_Skrool_-_Braham_Happy_2.png", "happy1" : "https://wiki-fr.guildwars2.com/images/8/8d/Utilisateur_Skrool_-_Braham_Happy_1.png", "glitch" : "https://wiki-fr.guildwars2.com/images/4/4f/Utilisateur_Skrool_-_Braham_Glitchy.png", "explain" : "https://wiki-fr.guildwars2.com/images/c/c4/Utilisateur_Skrool_-_Braham_Explain.png", "dreaming" : "https://wiki-fr.guildwars2.com/images/2/24/Utilisateur_Skrool_-_Braham_Dreaming.png", "crying" : "https://wiki-fr.guildwars2.com/images/1/1b/Utilisateur_Skrool_-_Braham_Crying.png", "bag" : "https://wiki-fr.guildwars2.com/images/a/a6/Utilisateur_Skrool_-_Braham_Bag.png", "surprised":"https://wiki-fr.guildwars2.com/images/3/3f/Utilisateur_Skrool_-_Braham_Surprised.png", "pouting" : "https://wiki-fr.guildwars2.com/images/8/8a/Utilisateur_Skrool_-_Braham_Pouting.png", "charismatic" : "https://wiki-fr.guildwars2.com/images/f/f7/Utilisateur_Skrool_-_Braham_Charismatic.png" } /* Print a character at a time */ function printTick(element, txt, time, callback = null) { if (element.textContent == txt) { callback(); } else { element.textContent += txt.charAt(element.innerHTML.length); setTimeout(() => {printTick(element, txt, time, callback);}, time); } } function printCharacterByCharacter(element, text, frequency = 8) { element.done = false; let waitingList = []; function processNodes(e, asFragment = false) { let clone = asFragment ? document.createDocumentFragment() : e.cloneNode(false); e.childNodes.forEach(n => { // Element if (n.nodeType == 1) { clone.appendChild(processNodes(n)); } // Text else if (n.nodeType == 3) { let node = document.createTextNode(""); clone.appendChild(node); waitingList.push({"node":node, "text":n.data}); } }); return clone; } function nextChar(node, text) { if (node.data.length == text.length) { nextNode(); } else if (!element.done) { node.data += text.charAt(node.data.length) setTimeout(() => {nextChar(node, text)}, frequency); } else if (element.onTextDisplayed) element.onTextDisplayed(); } function nextNode() { if (waitingList.length == 0) { element.done = true; if (element.onTextDisplayed) element.onTextDisplayed(); return; } let currrent = waitingList.shift(); nextChar(currrent.node, currrent.text); } let dum = document.createElement("div"); dum.innerHTML = text; element.appendChild(processNodes(dum, true)); nextNode(); } /* Show settings */ function showSettings() { let settings = document.getElementById("sad-braham-settings"); if (!settings) { settings = document.createElement("div"); settings.id = "sad-braham-settings"; document.body.appendChild(settings); } settings.classList.remove("closed"); refreshSettings(settings); } /* Hide settings */ function hideSettings() { let settings = document.getElementById("sad-braham-settings"); if (!settings) { settings = document.createElement("div"); settings.id = "sad-braham-settings"; document.body.appendChild(settings); } settings.classList.add("closed"); } /* Refresh settings */ function refreshSettings(settings) { let loc_list = { "fr": ["Options", "Langue :", "Français", "Anglais", "Nom personalisé", "Utiliser un nom personalisé", "Nom personalisé :", "(Laisser vide pour \"Commandant\")", "Annuler", "Accepter", "Animation de texte", "Utiliser l'animation de texte"], "en": ["Settings", "Language:", "French", "English", "Custom name", "Use a custom name", "Custom name:", "(Leave empty for \"Commander\")", "Cancel", "Accept", "Text animation", "Use text animation"]}; let loc; if (SadBrahamSettings.lang == "fr") loc = loc_list["fr"]; else loc = loc_list["en"]; settings.innerHTML = "<h2>" + loc[0] + "</h2>" + "<h3>" + loc[1] + "</h3>" + "<label><input type=\"radio\" name=\"sb-lang\" value=\"fr\"" + (SadBrahamSettings.lang == "fr" ? "checked" : "") + ">" + loc[2] + "</label><br/>" + "<label><input type=\"radio\" name=\"sb-lang\" value=\"en\"" + (SadBrahamSettings.lang == "en" ? "checked" : "") + ">" + loc[3] + "</label><br/>" + "<h3>" + loc[10] + "</h3>" + "<label><input type=\"checkbox\" name=\"sb-typing\"" + (SadBrahamSettings.writeAnimation ? "checked" : "") + ">" + loc[11] + "</label><br/><br/>" + "<h3>" + loc[4] + "</h3>" + "<label><input type=\"checkbox\" name=\"sb-use-cname\"" + (SadBrahamSettings.useCustomName ? "checked" : "") + ">" + loc[5] + "</label><br/><br/>" + "<label>" + loc[6] +"<br/><input type=\"textfield\" name=\"sb-cname\" value=\"" + SadBrahamSettings.cname + "\"></label><br/>" + "<small>" + loc[7] + "</small><br/><br/>" + "<button onclick=\"hideSettings()\">" + loc[8] + "</button>" + "<button onclick=\"saveSettings(); hideSettings()\">" + loc[9] + "</button>"; } /* Save settings */ function sbSetCookie(name, value, days_before_expiration) { var d = new Date(); d.setTime(d.getTime() + (days_before_expiration * 24 * 60 * 60 * 1000)); var expires = "expires="+ d.toUTCString(); document.cookie = name + "=" + value + ";" + expires + ";path=/"; } function saveSettings() { // @ts-ignore SadBrahamSettings.lang = document.querySelector('[name=sb-lang]:checked').value || "fr"; // @ts-ignore SadBrahamSettings.useCustomName = document.querySelector('[name=sb-use-cname]').checked; // @ts-ignore SadBrahamSettings.writeAnimation = document.querySelector('[name=sb-typing]').checked; // @ts-ignore SadBrahamSettings.cname = document.querySelector('[name=sb-cname]').value; // Cookies sbSetCookie("sblang", SadBrahamSettings.lang, 365); sbSetCookie("sbuseCustomName", SadBrahamSettings.useCustomName ? "true" : "false", 365); sbSetCookie("sbwriteAnimation", SadBrahamSettings.writeAnimation ? "true" : "false", 365); sbSetCookie("sbcname", SadBrahamSettings.cname, 365); } /* Load settings from cookies */ function sbGetCookie(cname) { let name = cname + "="; let decodedCookie = decodeURIComponent(document.cookie); let ca = decodedCookie.split(';'); for (let i = 0; i <ca.length; i++) { let c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { return c.substring(name.length, c.length); } } return undefined; } function loadSettings() { {let v = sbGetCookie("sblang"); if (v) SadBrahamSettings.lang = v;} {let v = sbGetCookie("sbuseCustomName"); if (v) SadBrahamSettings.useCustomName = (v == "true");} {let v = sbGetCookie("sbwriteAnimation"); if (v) SadBrahamSettings.writeAnimation = (v == "true");} {let v = sbGetCookie("sbcname"); if (v) SadBrahamSettings.cname = v;} } /* Get the communicator */ function getCommunicator() { let communicator = document.getElementById("sad-braham-communicator"); if (!communicator) { communicator = document.createElement("div"); communicator.id = "sad-braham-communicator"; communicator.onclick = () => {closeCommunicator(); openDialogueBox();}; let communicator_extra = document.createElement("div"); communicator_extra.innerText = (SadBrahamSettings.lang == "fr") ? "Vous avez un appel de : Braham" : "You have a call from: Braham"; communicator.appendChild(communicator_extra); document.body.appendChild(communicator); } return communicator; } /* Close the communicator */ function closeCommunicator(communicator = null) { if (!communicator) communicator = getCommunicator(); communicator.classList.add("closed"); } /* Show the communicator */ function openCommunicator(communicator = null) { if (!communicator) communicator = getCommunicator(); communicator.classList.remove("closed"); communicator.classList.remove("urgency-low"); communicator.classList.remove("urgency-high"); communicator.classList.remove("urgency-seriously-answer"); setTimeout(() => {setCommunicatorUrgency("urgency-low");}, 18000); setTimeout(() => {setCommunicatorUrgency("urgency-high");}, 26000); setTimeout(() => {setCommunicatorUrgency("urgency-seriously-answer");}, 50000); } /* Set communicator urgency */ function setCommunicatorUrgency(urgency, communicator = null) { if (!communicator) communicator = getCommunicator(); if (communicator.classList.contains("closed")) return; if (!communicator.classList.contains(urgency)) { communicator.classList.add(urgency); } } /* Get the dialogue container */ function getContainer() { var container = document.getElementById("sad-braham-dialogue-container"); if (!container) { container = document.createElement("div"); container.id = "sad-braham-dialogue-container"; document.body.appendChild(container); } return container; } /* Get the dialogue box */ function getReactImage() { var reactImg = document.getElementById("sad-braham-react"); if (!reactImg) { var container = getContainer(); reactImg = document.createElement("img"); reactImg.id = "sad-braham-react"; clearDialogue(reactImg); container.appendChild(reactImg); } return reactImg; } /* Get the dialogue box */ function getDialogueBox() { var dialogue_box = document.getElementById("sad-braham-dialogue"); if (!dialogue_box) { var container = getContainer(); dialogue_box = document.createElement("div"); dialogue_box.id = "sad-braham-dialogue"; clearDialogue(dialogue_box); container.appendChild(dialogue_box); // Start dialogue if (SadBrahamEntryPoint == "") chooseEntryPoint(); printDialogue(SadBrahamEntryPoint); } return dialogue_box; } /* Close the dialogue box */ function closeDialogueBox(dialogue_box = null) { if (!dialogue_box) dialogue_box = getDialogueBox(); dialogue_box.classList.add("closed"); getReactImage().classList.add("closed"); } /* Show the dialogue box */ function openDialogueBox(dialogue_box = null) { if (!dialogue_box) dialogue_box = getDialogueBox(); dialogue_box.classList.remove("closed"); getReactImage().classList.remove("closed"); } /* Clear the dialogue box */ function clearDialogue(dialogue_box = null) { if (!dialogue_box) dialogue_box = getDialogueBox(); dialogue_box.innerHTML = ""; dialogue_box.classList.remove("clickable"); var cross_button = document.createElement("button"); cross_button.id = "dialogue-leave"; cross_button.innerText = "⛌"; cross_button.onclick = () => {closeDialogueBox(dialogue_box); openCommunicator();}; dialogue_box.appendChild(cross_button); } /* Get Logged in user name */ function getName() { var nameElement = document.getElementById("pt-userpage"); return nameElement ? nameElement.innerText : null; } /* Get default name */ function getDefaultName() { if (SadBrahamSettings.lang == "fr") return "Commandant"; else return "Commander"; } /* Apply a callback function on every affected node string content */ function modifyNodeContent(callbackfn) { document.querySelectorAll("a, span, li, ul, p, h1, h2, h3, h4, h5," + " h6, div, td, th, legend, i, b, dt, dd").forEach(e => { var child = e.firstChild; if (e.style.display != "hidden") { while (child) { if (child.nodeType == 3) { if (child.data !== undefined && child.data.trim().length !== 0 && e.style.display != "hidden"){ child.data = callbackfn(child.data); } } child = child.nextSibling; } } } ); } /* Detroy layout */ function destroyLayout(angle) { document.querySelectorAll("div.portal, #content div, div#content h1," + " div#content h2, div#content #firstHeading, a, li, #p-search," + "img").forEach(e => { var offset = Math.floor((Math.random() * angle * 2) - angle); e.style.transform = "rotate(" + offset + "deg)"; }); } function destroyLayoutRepeated(angle, iteration, delay) { if (iteration > 0) { setTimeout(function() { destroyLayoutRepeated(angle, iteration - 1, delay) }, delay); destroyLayout(angle); } } /* break action */ function action_break() { modifyNodeContent(e => { return "KABAM!BRAHAM!"; }); destroyLayoutRepeated(5, 4200, 1000); } /* Get a random letter */ function randomLetter() { var index = Math.floor(Math.random() * 61); if (index > 51) return String.fromCharCode(index - 4); else if (index > 25) return String.fromCharCode(index + 39); else return String.fromCharCode(index + 97); } /* Apply the substitutions on dialogue strings */ function processDialogueString(str) { // Name substitution var name = SadBrahamSettings.useCustomName ? (SadBrahamSettings.cname.length > 0 ? SadBrahamSettings.cname : getDefaultName()) : getName() || getDefaultName(); str = str.replace("%name%", name); return str; } /* Load a dialogue and print it in the dialogue box */ function printDialogue(id) { let dialogue_box = getDialogueBox(); clearDialogue(dialogue_box); // Close dialogue box if id is null/undefined if (!id) { clearDialogue(dialogue_box); closeDialogueBox(dialogue_box); return; } // Get dialogue from its ID let dialogue = dialogues[id]; if (!dialogue) { console.warn("Incorrect dialogue id: " + id); return; } // Display image if (dialogue.react){ let reactImg = getReactImage(); // @ts-ignore if (reactImg.src != dialogue.react) { reactImg.classList.add("loading"); // @ts-ignore setTimeout(() => {reactImg.src = SadBrahamReactImg[dialogue.react]; reactImg.classList.remove("loading");}, 300); } } // Create elements of the dialogue box let fragment = document.createDocumentFragment(); let name_span = document.createElement("div"); name_span.classList.add("name"); name_span.innerText = processDialogueString(dialogue.from[SadBrahamSettings.lang]) + ":"; fragment.appendChild(name_span); let content_span = document.createElement("div"); content_span.classList.add("dialogue"); let main_text_span = document.createElement("span"); let txt = processDialogueString(dialogue.text[SadBrahamSettings.lang]); content_span.appendChild(main_text_span); // Print main dialogue if (!SadBrahamSettings.writeAnimation) { main_text_span.innerHTML = txt; // @ts-ignore setTimeout(() => {main_text_span.done = true;}, 300); } else { main_text_span.innerHTML = ""; printCharacterByCharacter(main_text_span, txt); } fragment.appendChild(content_span); // Clicking on the dialogue box to skip to the next dialogue let callback = (next_id) => (event) => { if (event.target.id != "dialogue-leave"){ // @ts-ignore if (main_text_span.done) printDialogue(next_id); else { // @ts-ignore main_text_span.done = true; main_text_span.innerHTML = txt; } }; }; // Buttons to get to next dialogue if (dialogue.answers) { // With answers let option_container = document.createElement("div"); option_container.classList.add("options"); // Create a button for each possible answer for (let i = 0; i < dialogue.answers.length; i++) { let option = document.createElement("button"); option.innerHTML = processDialogueString(dialogue.answers[i][SadBrahamSettings.lang]); // Personality icons if (dialogue.answers[i].type) { let img = document.createElement("img"); if (dialogue.answers[i].type == "ferocity") { img.src = "https://wiki-fr.guildwars2.com/images/3/33/Ic%C3%B4ne_dialogue_f%C3%A9rocit%C3%A9.png"; option.prepend(img); } else if (dialogue.answers[i].type == "dignity") { img.src = "https://wiki-fr.guildwars2.com/images/0/0a/Ic%C3%B4ne_dialogue_dignit%C3%A9.png"; option.prepend(img); } else if (dialogue.answers[i].type == "charm") { img.src = "https://wiki-fr.guildwars2.com/images/5/53/Ic%C3%B4ne_dialogue_gr%C3%A2ce.png"; option.prepend(img); } else if (dialogue.answers[i].type == "merchand") { img.src = "https://wiki-fr.guildwars2.com/images/0/07/Ic%C3%B4ne_dialogue_or.png"; option.prepend(img); } else if (dialogue.answers[i].type == "battle") { img.src = "https://wiki-fr.guildwars2.com/images/b/b9/Ic%C3%B4ne_dialogue_combat.png"; option.prepend(img); } else if (dialogue.answers[i].type == "leave") { img.src = "https://wiki-fr.guildwars2.com/images/e/e1/Ic%C3%B4ne_dialogue_fermer.png"; option.prepend(img); } } option.onclick = callback(dialogue.answers[i].to); option_container.appendChild(option); } fragment.appendChild(option_container); } else // No answers { let cursor = document.createElement("span"); cursor.innerText = "▼"; cursor.classList.add("cursor"); content_span.appendChild(cursor); dialogue_box.onclick = callback(dialogue.to); // @ts-ignore main_text_span.onTextDisplayed = () => {dialogue_box.classList.add("clickable");}; } if (dialogue.action) { if (dialogue.action == "break") action_break(); } dialogue_box.appendChild(fragment); } /* Get Page name */ function PageName(){ try { return document.getElementById("firstHeading").innerText; } catch (error) { console.error("Unable to get page name"); return "Something"; } } /* Choose an entry point and preload images */ function chooseEntryPoint(){ // Choose a random dialogue id in the list of possible entry points if (PageName() != "Braham Eirsson") SadBrahamEntryPoint = SadBrahamEntryPoints[Math.floor(Math.random() * SadBrahamEntryPoints.length)]; else SadBrahamEntryPoint = "braham-0"; // Load every image needed in the dialogue now, so it'll be rarer to have missing reaction image let loadedDialogues = []; let loadedImages = []; let loadingStack = [SadBrahamEntryPoint]; while (loadingStack.length > 0) { let current = dialogues[loadingStack.pop()]; // Fill the stack if (current.to && !loadedDialogues.includes(current.to)) { loadedDialogues.push(current.to); loadingStack.push(current.to); } if (current.answers) { current.answers.forEach(answer => { if (answer.to && !loadedDialogues.includes(answer.to)) { loadedDialogues.push(answer.to); loadingStack.push(answer.to); } }); } // Preload the current image if (current.react && !loadedImages.includes(current.react)){ let img = new Image(); img.src = SadBrahamReactImg[current.react]; loadedImages.push(current.react); } } } function randomMainPageSadBraham() { let array = [ "sad2", "sad1", "pouting", "smirk", "crying", "happy2", "bag" ]; let leftImg = document.querySelector('[alt="Accueil-Balthazar-PoF.png"]'); let rightImg = document.querySelector('[alt="Accueil-Monture-PoF.png"]'); if (leftImg) { leftImg.src = SadBrahamReactImg[array[ Math.floor((Math.random() * array.length))]]; leftImg.width = 360; leftImg.height = 540; leftImg.style.transform = "scaleX(-1)"; } if (rightImg) { rightImg.src = SadBrahamReactImg[array[ Math.floor((Math.random() * array.length))]]; rightImg.width = 360; rightImg.height = 540; rightImg.parentElement.style.top = "150px"; } } /** SNOW (ノ^ヮ^)ノ :・゚✧ * */ function NeigeraOuNeigeraPas() { var para = document.createElement("li"); para.id = 'neige'; var box = document.createElement("input"); box.type = "checkbox"; box.id = "neigeOuPas"; box.title = "Activer ou désactiver la neige."; box.checked = JSON.parse(localStorage.getItem('snowToggle')); var label = document.createElement("label"); label.title = "Activer ou désactiver la neige."; label.innerHTML = "<span>Neige :</span>"; var element = document.getElementById( 'p-personal' ); var child = element.getElementsByTagName( 'ul' )[0]; label.appendChild(box); para.appendChild(label); child.insertBefore(para, child.firstChild); $('#neigeOuPas').click(function() { if (typeof snowStorm === 'undefined') { console.warn("NeigeraOuNeigeraPas : snowStorm not loaded."); return; } if(box.checked) { snowStorm.show(); snowStorm.resume(); } else { snowStorm.stop(); snowStorm.freeze(); } localStorage.removeItem('snowToggle'); localStorage.setItem('snowToggle', JSON.stringify(box.checked)); }); } function initNeige(){ if (typeof snowStorm === 'undefined'){ console.warn("initNeige : snowStorm not loaded"); return; } var checked = JSON.parse(localStorage.getItem('snowToggle')); if (!checked) { snowStorm.start(); snowStorm.stop(); snowStorm.freeze(); } else { snowStorm.start(); } } /* Start the sadeness */ function initSadness() { // Load settings loadSettings(); // Init panels closeCommunicator(); setTimeout(() => {openCommunicator();}, 1800); // Choose this page dialogue and start loading images chooseEntryPoint(); // Add setting buttons let panel = document.getElementById("mw-panel") || document.getElementById("mw-mf-page-left"); let div = document.createElement("div"); div.innerHTML = "<button id=\"sad-braham-setting-button\"onclick=\"showSettings()\"><img src=\"https://wiki-fr.guildwars2.com/images/d/d2/Utilisateur_Skrool_-_Preferences.png\"</img></button>"; panel.appendChild(div); // Main page images randomMainPageSadBraham(); } function onReady(f) { if (document.readyState === 'complete') { f(); } else { window.onload = f; } } onReady(function() { initSadness() var pagename = 'MediaWiki:SnowStorm.js'; pagename = encodeURI( pagename.replace( ' ', '_' ) ); var src = '/index.php?title=' + pagename + '&action=raw&ctype=text/javascript'; if (typeof snowStorm == 'undefined') $.getScript(src, function(){ NeigeraOuNeigeraPas(); initNeige(); }); });