Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---- _________ __ __ __ __ ----
- ---- \__ ___/ | | | | | \ / | ----
- ---- | | | |__ | | | \ / | ----
- ---- | | | ____ | | \/ | ----
- ---- | | | | | | | |\__/\ | ----
- ---- | | | | | | |__ |_ ----
- ---- ----
- --------------- Tribe House Manager ---------------
- --------- DEVELOPED AND MANAGED BY DEATHMATIC & ALLOUNETT -------------
- fly = false
- chamane = false
- vampire = false
- bootcamp = false
- survivor = false
- quizz = false
- robber = false
- hasVampired = false
- hasEndVampired = false
- keyWord = ""
- lang_name = "fr"
- currentQuestion = nil
- quizzTimer = 0
- questionTime = 0
- hasPosedQuestion = false
- hasAnswered = false
- hasWonQuiz = false
- coordShamX = 1000
- coordShamY = 1000
- robberSham = nil
- miceWithCheese = 0
- -- Liste des cartes bootcamp pouvant être jouées (en attendant de pouvoir jouer une carte aléatoire d'une rotation)
- bootcampMaps = {"@1427980", "@161434", "@216173", "@172621", "@500000", "@3908151", "@512887","@374995", "@306365", "@155606", "@333002", "@172547", "@3734998", "@1737914", "@2989803", "@3136410", "@438449", "@976944", "@1595965", "@1636814", "@2009003", "@3804078", "@3768117", "@3799357", "@3278138", "@3311534", "@3779861", "@3576303", "@3780618", "@2789121", "@2811229", "@3659983", "@3759157", "@597804", "@2998268", "@2132250", "@3745158", "@3338283", "@3062939", "@3137929", "@3560999", "@3182487", "@3725142", "@3012311", "@3493456", "@343456", "@208056", "@881158", "@492399", "@268915", "@505619", "@397469", "@729863", "@184648", "@156720", "@541693", "@842019", "@1303323", "@1807217", "@164916", "@174223", "@186066", "@191642", "@1014313", "@319443", "@176729", "@397478", "@1733211", "@365061", "@541223", "@306384", "@504485", "@496886", "@444589"}
- -- Liste des cartes survivor pouvant être jouées (en attendant de pouvoir jouer une carte aléatoire d'une rotation)
- survivorMaps = {"@3540608","@492283","@1026249","@1545834","@1659906","@1659906","@3295213","@3699989","@741041","@489470","@395246","@292672","@306106","@3584123","@1522692","@3107377","@2387888","@3685564","@787131","@2408376","@3670885","@3620709","@3584826","@3587860","@3549404","@481676","@3550350","@3480467"}
- -- Listes des cartes quizz pouvant être jouées
- quizzMaps = {"@4383191","@4400908","@4462955","@4463117"}
- -- Liste des cartes vampire pouvant être joueés
- vampireMaps = {"@2821033","@3808004","@1676629","@3296041"}
- -- Liste des cartes robber pouvant être jouées
- robberMaps = {"108", "109", "110", "111", "112", "113", "@4406148", "@4412311", "@4412333"}
- -- Durée d'une carte bootcamp (défaut: 6min soit 360 secondes)
- bootcampDuration = 360
- -- La file d'attente de cartes
- queue = {}
- -- La maison de tribu actuelle
- tribeHouse = nil
- tribeHousePicked = false
- tfm.exec.disableAfkDeath(false)
- tfm.exec.disableAutoShaman(false)
- tfm.exec.disableAutoNewGame(false)
- tfm.exec.disableAutoScore(false)
- tfm.exec.disableAllShamanSkills(false)
- tfm.exec.disableAutoTimeLeft(false)
- -- Themes
- themes = {}
- themes.classic = {
- background = 0x324650,
- bg_border = 0x6A8FA2,
- button = 0x3C5064,
- button_border = 0x3C5064,
- opacity = 1f
- }
- themes.dark = {
- background = 0x010101,
- bg_border = 0xFFFFFF,
- button = 0x202020,
- button_border = 0x9F9F9F,
- opacity = 0.7f
- }
- -- Textes
- lang = {}
- lang.fr = {
- aucun = "Aucun",
- credits = "Module par",
- help_1 = "<p align='center'><font color='#C2C2DA' size='35' >Aide</font></p><br /><font size='10'> • Appuyez sur la touche <font color='#BABD2F'>[",
- help_2 = "]</font> pour ouvrir <font color='#DEB51B'>le gestionnaire de mini-jeux</font></font>.<br /><font size='10'> • Appuyez sur la touche <font color='#BABD2F'>[",
- help_3 = "]</font> pour ouvrir <font color='#DEB51B'>les options</font></font>.<br /><font size='10'> • Appuyez sur la touche <font color='#BABD2F'>[",
- help_4 = "]</font> pour ouvrir <font color='#DEB51B'>le gestionnaire de thèmes</font></font>.<br /><br /> <font size='13'>Quelle catégorie souhaiteriez-vous consulter ?</font>",
- gest_label = "Gestionnaire de mini-jeux",
- gest_main = "Veuillez séléctionner le mini-jeu désiré :",
- commandes_label = "Commandes",
- commandes = "<p align='center'><font color='C2C2DA' size='35' >Commandes</font></p><br /><J> !help :<N> Affiche l'aide<br /><J> !stop :<N> Interrompt le mini-jeu en cours<br /><J> !mort :<N> Mourir instantanément<br /><J> !respawn :<N> Réapparaître instantanément<br /><J> !ch :<N> Vous serez chamane lors de la prochaine partie<br /><J> !meep :<N> Vous serez pourvu du pouvoir de meep<br /><J> !time <R>[secondes] <N>: Modifie le temps de la partie en cours<br /><J> !color <R>[code héxadécimal] <N>: Change la couleur de votre pseudo<br /><J> !next :<N> (mini-jeu bootcamp) Change de carte<br /><J> !bc <R>[@code] <N> : (mini-jeu bootcamp) Joue une carte en bootcamp<br /><J> !np <R>[@code] <N>: Joue une carte<br /><J> !q <R>[@code] <N>: Insère une carte dans la queue<br /><J> !remove <R>[index] <N>: Supprime dans la queue la carte qui porte l'index <R>[index]<N>.<br /> Si <R>[index] <N>n'est pas renseigné, alors la dernière carte ajoutée est effacée<br /><J> !removeall <N>: Efface la queue actuelle",
- minijeux_label = "Mini-jeux",
- minijeu_label = "Mini-jeu",
- minijeux = "<p align='center'><font color='C2C2DA' size='35' >Mini-jeux</font></p><br /><font color='#BABD2F'> • fly :</font> Volez autant que vous le pouvez !<br /><font color='#BABD2F'> • shaman :</font> Tout le monde béneficie des pouvoirs de chamane.<br /><font color='#BABD2F'> • vampire :</font> Évitez le vampire !<br /><font color='#BABD2F'> • bootcamp :</font> Un système intelligent d'entraînement au bootcamp.<br /><font color='#BABD2F'> • survivor :</font> Évitez les boulets que vous lance la chamane !<br /><font color='#BABD2F'> • quizz :</font> Répondez aux questions plus vite que vos adversaires ! Pour répondre, écrivez : !réponse. Aucune réponse ne contient de majuscules, et les accents sont pris en compte. <br /><font color='#BABD2F'> • cheese robber :</font> <N>Rattrapez la voleuse de fromage !",
- temps_critique = "Plus que 10 secondes !",
- temps_ecoule = "Temps écoulé !",
- gagnant_quizz_1 = "Bravo à ",
- gagnant_quizz_2 = ", la réponse était bien [",
- options = "Options",
- bind_gest_label = "Ouvrir le gestionnaire de mini-jeux :",
- bind_help_label = "Afficher l'aide : ",
- bind_settings_label = "Ouvrir les options :",
- bind_themes_label = "Changer le thème",
- press_touche = "Choisissez une touche",
- redefinir = "Redéfinir",
- themes_label = "Thèmes",
- themes_main = "Choisissez un thème :",
- classicTheme = "Classique",
- darkTheme = "Sombre"
- }
- lang.en = {
- aucun = "None",
- credits = "Module by",
- help_1 = "<p align='center'><font color='#C2C2DA' size='35' >Help</font></p><br /> • Press <font color='#BABD2F'>[",
- help_2 = "]</font> to open the <font color='#DEB51B'>mini-games manager</font></font>.<br /> • Press <font color='#BABD2F'>[",
- help_3 = "]</font> to open <font color='#DEB51B'>settings</font></font>.<br /> • Press <font color='#BABD2F'>[",
- help_4 = "]</font> to open the <font color='#DEB51B'>themes manager</font></font>.<br /><br /> <font size='13'>Which category would you like to consult ?</font>",
- gest_label = "Mini-games manager",
- gest_main = "Select a mini-game :",
- commandes_label = "Commands",
- commandes = "<p align='center'><font color='C2C2DA' size='35' >Commands</font></p><br /><J> !help :<N> Show the help<br /><J> !stop :<N> Interrupt the current mini-game<br /><J> !kill :<N> Die instantly<br /><J> !respawn :<N> Respawn instantly<br /><J> !ch :<N> You'll be the shaman for the next game<br /><J> !meep :<N> Get the power to meep !<br /><J> !time <R>[seconds] <N>: Modify the current game's time<br /><J> !color <R>[hexadecimal code] <N>: Change your nickname's color<br /><J> !next :<N> Play the next map (map queue or bootcamp mini-game)<br /><J> !bc <R>[@map] <N>: (bootcamp mini-game) Play this map as a bootcamp<br /><J> !np <R>[@map] <N>: Play a map<br /><J> !q <R>[@map] <N>: Put a map in the queue",
- minijeux_label = "Mini-games",
- minijeu_label = "Mini-game",
- minijeux = "<p align='center'><font color='C2C2DA' size='35' >Mini-games</font></p><br /><font color='#BABD2F'> • fly :</font> Fly as much as you can !<br /><font color='#BABD2F'> • shaman :</font> Everybody has the power of the shaman.<br /><font color='#BABD2F'> • vampire :</font> Avoid the vampire !<br /><font color='#BABD2F'> • bootcamp :</font> A smart bootcamp training system.<br /><font color='#BABD2F'> • survivor :</font> Dodge the shaman's cannons !<br /><font color='#BABD2F'> • quizz :</font> <font color='#6C77C1'>[not available in English]</font><br /><font color='#BABD2F'> • cheese robber :</font> A mouse has stolen the cheese ! Catch it !",
- temps_critique = "10 seconds remaining !",
- temps_ecoule = "Time out !",
- gagnant_quizz_1 = "Congratulations to ",
- gagnant_quizz_2 = ", the answer was [",
- options = "Settings",
- bind_gest_label = "Open the mini-games manager :",
- bind_help_label = "Show help :",
- bind_settings_label = "Open settings :",
- bind_themes_label = "Switch the theme",
- press_touche = "Press a key",
- redefinir = "Redefine",
- themes_label = "Themes",
- themes_main = "Choose a theme :",
- classicTheme = "Classic",
- darkTheme = "Dark"
- }
- -- Listes des IDs
- id = {}
- -- keys
- id["key_space"] = 32
- id["key_o"] = 79
- id["key_h"] = 72
- id["key_l"] = 76
- id["key_u"] = 85
- -- windows
- id["gest_window"] = 1
- id["help_window"] = 2
- id["settings_window"] = 3
- id["themes_window"] = 4
- -- textAreas
- -- Crédits
- id["credits"] = 1
- -- Aide
- id["main_help"] = 2
- id["close_help"] = 3
- id["commands_help"] = 4
- id["minijeux_help"] = 5
- -- Aide => Commandes
- id["main_commands"] = 6
- id["close_commands"] = 7
- id["accueil_commands"] = 8
- -- Aide => Mini-jeux
- id["main_minijeux"] = 9
- id["close_minijeux"] = 10
- id["accueil_minijeux"] = 11
- -- Gestionnaire de mini-jeux
- id["main_gest"] = 12
- id["close_gest"] = 13
- id["bootcamp_gest"] = 14
- id["chamane_gest"] = 15
- id["vampire_gest"] = 16
- id["fly_gest"] = 17
- id["survivor_gest"] = 18
- id["quizz_gest"] = 19
- id["robber_gest"] = 20
- id["nil_gest"] = 21
- id["stop_gest"] = 22
- -- Quizz
- id["question_quizz"] = 23
- id["quizz_rebours"] = 24
- id["bravo_quizz"] = 25
- id["time_quizz"] = 26
- -- Queue
- id["main_queue"] = 27
- -- Options
- id["main_settings"] = 28
- id["close_settings"] = 29
- id["redefinir_gest"] = 30
- id["bind_gest_label"] = 31
- id["bind_gest"] = 32
- id["redefinir_help"] = 33
- id["bind_help_label"] = 34
- id["bind_help"] = 35
- id["redefinir_settings"] = 36
- id["bind_settings_label"] = 37
- id["bind_settings"] = 38
- id["redefinir_themes"] = 39
- id["bind_themes_label"] = 40
- id["bind_themes"] = 41
- -- Themes
- id["main_themes"] = 42
- id["close_themes"] = 43
- id["classic_theme"] = 44
- id["dark_theme"] = 45
- -- Custom keys
- Key = {}
- Key[8] = "Backspace"
- Key[9] = "Tab"
- Key[13] = "Enter"
- Key[16] = "Shift"
- Key[17] = "Ctrl"
- Key[18] = "Alt"
- Key[19] = "Pause"
- Key[20] = "Caps Lock"
- Key[27] = "Esc"
- Key[32] = "Spacebar"
- Key[33] = "Page up"
- Key[34] = "Page down"
- Key[35] = "End"
- Key[36] = "Home"
- Key[37] = "Left arrow"
- Key[38] = "Up arrow"
- Key[39] = "Right arrow"
- Key[40] = "Down arrow"
- Key[45] = "Insert"
- Key[46] = "Delete"
- Key[48] = "0"
- Key[49] = "1"
- Key[50] = "2"
- Key[51] = "3"
- Key[52] = "4"
- Key[53] = "5"
- Key[54] = "6"
- Key[55] = "7"
- Key[56] = "8"
- Key[57] = "9"
- Key[65] = "A"
- Key[66] = "B"
- Key[67] = "C"
- Key[68] = "D"
- Key[69] = "E"
- Key[70] = "F"
- Key[71] = "G"
- Key[72] = "H"
- Key[73] = "I"
- Key[74] = "J"
- Key[75] = "K"
- Key[76] = "L"
- Key[77] = "M"
- Key[78] = "N"
- Key[79] = "O"
- Key[80] = "P"
- Key[81] = "Q"
- Key[82] = "R"
- Key[83] = "S"
- Key[84] = "T"
- Key[85] = "U"
- Key[86] = "V"
- Key[87] = "W"
- Key[88] = "X"
- Key[89] = "Y"
- Key[90] = "Z"
- Key[91] = "Windows-L"
- Key[92] = "Windows-R"
- Key[93] = "App"
- Key[97] = "1"
- Key[98] = "2"
- Key[99] = "3"
- Key[100] = "4"
- Key[101] = "5"
- Key[102] = "6"
- Key[103] = "7"
- Key[104] = "8"
- Key[105] = "9"
- Key[106] = "*"
- Key[107] = "+"
- Key[109] = "-"
- Key[110] = "."
- Key[111] = "/"
- Key[112] = "F1"
- Key[113] = "F2"
- Key[114] = "F3"
- Key[115] = "F4"
- Key[116] = "F5"
- Key[117] = "F6"
- Key[118] = "F7"
- Key[119] = "F8"
- Key[120] = "F9"
- Key[121] = "F10"
- Key[122] = "F11"
- Key[123] = "F12"
- Key[144] = "Numlock"
- Key[145] = "Scrolllock"
- Key[186] = ";"
- Key[187] = "="
- Key[188] = ","
- Key[189] = "-"
- Key[190] = "."
- Key[191] = "/"
- Key[192] = "`"
- Key[219] = "["
- Key[220] = "\\"
- Key[221] = "]"
- Key[222] = "'"
- -- Listes des questions/réponses du quizz
- bddquiz = {}
- bddquiz["Citez un des auteurs de THM"] = "deathmatic,allounett"
- bddquiz["Où se trouve le canal aménagé au XIXème siècle permet de relier les mers Méditerranée et Rouge ?"] = "suez"
- bddquiz["Quel est le plus long fleuve d'Europe ?"] = "danube"
- bddquiz["Qui fut nommé champion du monde de cyclisme en 2013 ?"] = "ruicosta"
- bddquiz["Quelle cité-état est surnommée la ville-lion ?"] = "singapour"
- bddquiz["En quelle année a eu lieu la chute du mur de Berlin ?"] = "1989"
- bddquiz["Comment les Romains antiques surnommaient-ils la mer Méditerranée ? ?"] = "marenostrum"
- bddquiz["Qui a peint « L'Origine du Monde » en 1866 ?"] = "courbet"
- bddquiz["Quel président des Etats-Unis a été assassiné en 1963 à Dallas ?"] = "kennedy"
- bddquiz["Quel physicien célèbre est également connu pour avoir inventé la chatière ?"] = "newton"
- bddquiz["Quel est le symbole de l'élément chimique sodium ?"] = "na"
- bddquiz["Quelle échelle permet de mesurer la force des piments ?"] = "scoville"
- bddquiz["Le mot magique est un ?"] = "adjectif"
- bddquiz["Quel est le plus petit état de l'Union européenne ?"] = "malte"
- bddquiz["Qu'est-ce qu'un amplificateur de lumière par émission stimulée de rayonnement ?"] = "laser"
- bddquiz["Quel animal est responsable du plus grand nombre de victimes humaines (excepté l'Homme lui-même) ?"] = "moustique"
- bddquiz["En kilomètres, quelle est la distance d'un marathon ?"] = "42"
- bddquiz["Combien les arachnides ont-ils de paires de pattes ?"] = "4"
- bddquiz["En quelle année a été ouvert au public le tunnel sous la Manche ?"] = "1994"
- bddquiz["Citez un fleuve des Enfers."] = "léthé,achéron,styx,phlégéthon,cocyte"
- bddquiz["Comment appelle-t-on un petit bout de terre entre deux mers (que l'on retrouve à Suez et à Panama notamment) ?"] = "isthme"
- bddquiz["Quel acteur a tourné le plus de film « James Bond ? » ?"] = "moore"
- bddquiz["Écrivez correctement le mot suivant : [ékimoz]"] = "ecchymose"
- bddquiz["Écrivez correctement le mot suivant : [bilveuzé]"] = "billeveusée"
- bddquiz["Écrivez correctement le mot suivant : [ilêtrey]"] = "illettré"
- bddquiz["Écrivez correctement le mot suivant : [sénete]"] = "saynette"
- bddquiz["Écrivez correctement le mot suivant : [paraleylaugram]"] = "parallélogramme"
- bddquiz["Écrivez correctement le mot suivant : [fuchya]"] = "fuchsia"
- bddquiz["Conjuguez le verbe « étendre » au passé simple à la deuxième personne du pluriel."] = "étendîtes"
- bddquiz["Quelle chaîne de montagnes considère-t-on traditionnellement comme une frontière naturelle entre l'Europe et l'Asie ?"] = "oural"
- bddquiz["Dans quel pays vivaient les dauphins d'eau douce du Yangzi, certainement disparus à ce jour ?"] = "chine"
- bddquiz["Quel animal associe-t-on généralement au physicien Erwin Schrödinger ?"] = "chat"
- bddquiz["Selon l'expression, si vous avez été dupé dans une affaire, vous êtes le dindon de la... "] = "farce"
- bddquiz["Dans la mythologie grecque, quelle montagne abrite le palais de Zeus ?"] = "olympe"
- bddquiz["Comment, en golf, appelle-t-on l'objet qu'on utilise pour lancer la balle ? "] = "club"
- bddquiz["Un pentagone a 5 côtés. Comment appelle-t-on un polygone à 12 côtés ? "] = "dodécagone"
- bddquiz["Dans la série de bande dessinée d'Uderzo et Goscinny, quel est le nom du chef du village d'Astérix ? "] = "abraracourcix"
- bddquiz["Quel acteur britannique incarne Harry Potter au cinéma ? (Son nom)"] = "radcliffe"
- bddquiz["Quel pays a pour langues officielles le tamoul et le cingalais ?"] = "srilanka"
- bddquiz["Qui a inventé la dynamite ?"] = "nobel"
- bddquiz["Quel mot désigne la cicatrice laissée par le cordon ombilical sur le ventre des mammifères ? "] = "nombril,ombilic"
- bddquiz["Quel mammifère pond des œufs ?"] = "ornithorynque,échidné"
- bddquiz["Quelle figure de style a pour but d'atténuer une idée désagréable (exemple : « Et qui dort son sommeil sous une humble pelouse » (Baudelaire) = enterrée) ?"] = "euphémisme"
- bddquiz["Quelle pierre précieuse est une variété cristallisée de carbone pur ?"] = "diamant"
- bddquiz["Quel crustacé d'eau douce élève-t-on en astaciculture ?"] = "écrevisse"
- bddquiz["Dans quel jeu de société un meurtre peut-il être commis par le colonel Moutarde dans la salle à manger ?"] = "cluedo"
- bddquiz["Dans la mythologie égyptienne, quel dieu représente-t-on sous la forme d'un homme à tête de faucon ? "] = "horus"
- bddquiz["Quel pays d'Afrique australe a pour capitale Gaborone ?"] = "botswana"
- bddquiz["Quelle est la capitale de l'Uruguay ?"] = "montevideo"
- bddquiz["Quel pokémon a pour nom anglais Gyarados ?"] = "léviator,leviator,"
- bddquiz["Qui a dit « De l'audace, encore de l'audace, et toujours de l'audace ! » ?"] = "danton"
- bddquiz["Comment appelle-t-on une fonction mathématique qui est soit croissante soit décroissante ?"] = "monotone"
- bddquiz["Vous connaissez sans doute l'expression « franchir le Rubicon », mais qu'est-ce que le Rubicon ?"] = "fleuve, rivière"
- bddquiz["Comment s'appellent les habitants de Tours ?"] = "tourangeaux"
- bddquiz["Qui est la première femme à avoir été enterrée au Panthéon ? (Son nom)"] = "curie"
- bddquiz["Comment appelle-t-on un régime politique gouverné par les plus riche ?"] = "ploutocratie"
- bddquiz["Combien la Terre a-t-elle de satellites naturels ?"] = "1"
- bddquiz["Combien de pays sont traversés par le Rhin ?"] = "6"
- isGestOpen = {}
- isHelpOpen = {}
- isSettingsOpen = {}
- isThemesOpen = {}
- customKeyGest = {}
- customKeyHelp = {}
- customKeySettings = {}
- customKeyThemes = {}
- listenKeyGest = {}
- listenKeyHelp = {}
- listenKeySettings = {}
- listenKeyThemes = {}
- text = lang[lang_name]
- theme = themes.classic
- function eventNewGame()
- displayCredits()
- displayHeader()
- displayQueue()
- ui.removeTextArea(id["question_quizz"])
- ui.removeTextArea(id["quizz_rebours"])
- ui.removeTextArea(id["bravo_quizz"])
- ui.removeTextArea(id["time_quizz"])
- hasVampired = false
- hasEndVampired = false
- currentQuestion = nil
- quizzTimer = 0
- questionTime = 0
- hasPosedQuestion = false
- hasAnswered = false
- hasWonQuiz = false
- coordShamX = 1000
- coordShamY = 1000
- robberSham = nil
- miceWithCheese = 0
- for playerName,_ in pairs(tfm.get.room.playerList) do
- if customKeyGest[playerName] == nil then
- customKeyGest[playerName] = id["key_o"]
- end
- if customKeyHelp[playerName] == nil then
- customKeyHelp[playerName] = id["key_h"]
- end
- if customKeySettings[playerName] == nil then
- customKeySettings[playerName] = id["key_l"]
- end
- if customKeyThemes[playerName] == nil then
- customKeyThemes[playerName] = id["key_u"]
- end
- listenKeyGest[playerName] = false
- listenKeyHelp[playerName] = false
- listenKeySettings[playerName] = false
- listenKeyThemes[playerName] = false
- isGestOpen[playerName] = false
- isHelpOpen[playerName] = false
- isSettingsOpen[playerName] = false
- isThemesOpen[playerName] = false
- if chamane==true then
- tfm.exec.setShaman(playerName)
- end
- for code,key_name in pairs(Key) do
- tfm.exec.bindKeyboard(playerName, code, true, true)
- end
- end
- if not tribeHousePicked then
- tribeHouse = tfm.get.room.currentMap
- tribeHousePicked = true
- end
- end
- function eventNewPlayer(playerName)
- displayCredits()
- displayHeader()
- displayQueue()
- if customKeyGest[playerName]==nil and customKeyHelp[playerName] == nil and customKeySettings[playerName] == nil and customKeyThemes[playerName] == nil then
- customKeyGest[playerName] = id["key_o"]
- customKeyHelp[playerName] = id["key_h"]
- customKeySettings[playerName] = id["key_l"]
- customKeyThemes[playerName] = id["key_u"]
- listenKeyGest[playerName] = false
- listenKeyHelp[playerName] = false
- listenKeySettings[playerName] = false
- listenKeyThemes[playerName] = false
- end
- for code,keyname in pairs(Key) do
- tfm.exec.bindKeyboard(playerName, code, true, true)
- end
- tfm.exec.respawnPlayer(playerName)
- isGestOpen[playerName] = false
- isHelpOpen[playerName] = false
- isSettingsOpen[playerName] = false
- isThemesOpen[playerName] = false
- if chamane==true then
- tfm.exec.setShaman(playerName)
- end
- if quizz==true then
- if hasPosedQuestion then
- askQuestion(currentQuestion, playerName, false)
- end
- end
- end
- function eventPlayerGetCheese(playerName)
- if robber then
- miceWithCheese = miceWithCheese + 1
- if miceWithCheese == 11 then
- tfm.exec.killPlayer(currentSham)
- coordShamX = 1000
- coordShamY = 1000
- end
- end
- end
- function eventPlayerWon(playerWon)
- if bootcamp then
- tfm.exec.respawnPlayer(playerWon)
- tfm.exec.setPlayerScore(playerWon, 20, true)
- end
- if quizz then
- tfm.exec.respawnPlayer(playerWon)
- tfm.exec.setPlayerScore(playerWon, 1, true)
- end
- end
- function eventPlayerDied(playerName)
- if bootcamp==true or quizz==true then
- tfm.exec.respawnPlayer(playerName)
- end
- if chamane==true then
- tfm.exec.respawnPlayer(playerName)
- tfm.exec.setShaman(playerName)
- end
- if survivor==true then
- tfm.exec.setPlayerScore(playerName, 1, true)
- if tfm.get.room.playerList[playerName].isShaman==true then
- tfm.exec.setPlayerScore(playerName, 0, false)
- activate("survivor")
- for p,_ in pairs(tfm.get.room.playerList) do
- if tfm.get.room.playerList[p].isShaman==false then
- if tfm.get.room.playerList[p].isDead==false then
- tfm.exec.setPlayerScore(p, math.random(3) + 15, true)
- end
- end
- end
- else
- survivorShaman = ""
- nbSurv = 0
- for p,_ in pairs(tfm.get.room.playerList) do
- if tfm.get.room.playerList[p].isShaman==false then
- if tfm.get.room.playerList[p].isDead==false then
- nbSurv = nbSurv + 1
- end
- else
- survivorShaman = p
- end
- end
- if nbSurv <= 1 then
- tfm.exec.setPlayerScore(survivorShaman, 0, false)
- activate("survivor")
- for p,_ in pairs(tfm.get.room.playerList) do
- if tfm.get.room.playerList[p].isShaman==false then
- if tfm.get.room.playerList[p].isDead==false then
- tfm.exec.setPlayerScore(p, math.random(3) + 15, true)
- end
- end
- end
- end
- end
- end
- if robber then
- local i = 0
- for _,player in pairs (tfm.get.room.playerList) do
- if not player.isDead then
- i=i+1
- end
- end
- if i == 0 then
- activate("robber")
- end
- end
- end
- function eventLoop(currentTime, timeRemaining)
- if queue[1]~= nil then
- if tfm.get.room.currentMap~=tribeHouse then
- if timeRemaining<=0 then
- activate(queue[1])
- table.remove(queue, 1)
- end
- else
- activate(queue[1])
- table.remove(queue, 1)
- end
- end
- if vampire then
- if timeRemaining<=105000 and timeRemaining > 1 then
- if hasVampired==false then
- hasVampired = true
- if hasEndVampired==false then
- tfm.exec.setVampirePlayer(randomPlayer())
- hasEndVampired = true
- end
- else
- if timeRemaining<=100000 then
- if hasEndVampired then
- local sourisVivantes = 0
- local sourisVampireVivantes = 0
- for p,_ in pairs(tfm.get.room.playerList) do
- if not tfm.get.room.playerList[p].isDead then
- sourisVivantes = sourisVivantes + 1
- if tfm.get.room.playerList[p].isVampire then
- sourisVampireVivantes = sourisVampireVivantes + 1
- end
- end
- end
- if sourisVampireVivantes == 0 then
- print("<ROSE>Tous les vampires sont morts ! Gloire aux survivants !")
- activate("vampire")
- elseif sourisVampireVivantes >= sourisVivantes then
- print("<ROSE>Les vampires ont contaminés tous les survivants !")
- activate("vampire")
- end
- end
- end
- end
- elseif timeRemaining<=0 then
- print("<ROSE>Les souris ont survécu face aux vampires !")
- activate("vampire")
- end
- end
- if bootcamp==true then
- if timeRemaining<=0 then
- activate("bootcamp")
- end
- end
- if survivor==true then
- if timeRemaining<=0 then
- for p,_ in pairs(tfm.get.room.playerList) do
- if tfm.get.room.playerList[p].isShaman==false then
- tfm.exec.setPlayerScore(p, math.random(3) + 15, true)
- else
- tfm.exec.setPlayerScore(p, 0, false)
- end
- end
- activate("survivor")
- end
- end
- if quizz==true then
- if not hasPosedQuestion then
- if quizzTimer < 14 then
- quizzTimer = quizzTimer + 1
- end
- if quizzTimer==8 then
- hasWonQuiz = false
- ui.removeTextArea(id["bravo_quizz"])
- hasAnswered = false
- if questionTime >= 60 then
- ui.removeTextArea(id["time_quizz"])
- questionTime = 0
- end
- ui.addTextArea(id["quizz_rebours"], "<p align='center'><font size='120' face='Soopafresh'>3</font></p>", NIL, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
- elseif quizzTimer==10 then
- ui.removeTextArea(id["quizz_rebours"])
- ui.addTextArea(id["quizz_rebours"], "<p align='center'><font size='120' face='Soopafresh'>2</font></p>", NIL, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
- elseif quizzTimer==12 then
- ui.removeTextArea(id["quizz_rebours"])
- ui.addTextArea(id["quizz_rebours"], "<p align='center'><font size='120' face='Soopafresh'>1</font></p>", NIL, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
- elseif quizzTimer==14 then
- ui.removeTextArea(id["quizz_rebours"])
- hasPosedQuestion = true
- question = randomQuestion()
- reponse = bddquiz[question]
- currentQuestion = question
- askQuestion(currentQuestion, nil, false)
- end
- else
- if questionTime < 60 then
- questionTime = questionTime + 1
- if questionTime==40 then
- ui.addTextArea(id["time_quizz"], "<p align='center'><font size='16'>"..text.temps_critique.."</font></p>", NIL, 225, 225, 350, 25, 0x010101, 0x010101, 1f)
- end
- else
- ui.removeTextArea(id["time_quizz"])
- ui.addTextArea(id["time_quizz"], "<p align='center'><font size='25' color='#E78585'>"..text.temps_ecoule.."</font></p>", NIL, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
- hasAnswered = true
- hasWonQuiz = false
- currentQuestion = nil
- quizzTimer = 0
- hasPosedQuestion = false
- end
- end
- end
- if robber then
- if timeRemaining <= 0 then
- activate("robber")
- end
- for name,player in pairs(tfm.get.room.playerList) do
- if timeRemaining<=117000 and player.isShaman then
- coordShamX = tfm.get.room.playerList[name].x
- coordShamY = tfm.get.room.playerList[name].y
- robberSham = name
- if not player.hasCheese then
- tfm.exec.giveCheese(name)
- end
- end
- if not player.hasCheese and not player.isShaman and timeRemaining<=117000 then
- if tfm.get.room.playerList[name].x<(coordShamX+30) and tfm.get.room.playerList[name].x>(coordShamX-30) then
- if tfm.get.room.playerList[name].y<(coordShamY+30) and tfm.get.room.playerList[name].y>(coordShamY-30) then
- tfm.exec.giveCheese(name)
- end
- end
- end
- end
- end
- end
- function eventKeyboard(playerName, keyCode, True, x, y)
- if listenKeyGest[playerName]==true or listenKeyHelp[playerName]==true or listenKeySettings[playerName] == true or listenKeyThemes[playerName] == true then
- if listenKeyGest[playerName] == true then
- customKeyGest[playerName] = keyCode
- listenKeyGest[playerName] = false
- ui.removeTextArea(id["bind_gest"])
- ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
- end
- if listenKeyHelp[playerName] == true then
- customKeyHelp[playerName] = keyCode
- listenKeyHelp[playerName] = false
- ui.removeTextArea(id["bind_help"])
- ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
- end
- if listenKeySettings[playerName] == true then
- customKeySettings[playerName] = keyCode
- listenKeySettings[playerName] = false
- ui.removeTextArea(id["bind_settings"])
- ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
- end
- if listenKeyThemes[playerName] == true then
- customKeyThemes[playerName] = keyCode
- listenKeyThemes[playerName] = false
- ui.removeTextArea(id["bind_themes"])
- ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
- end
- else
- if keyCode==customKeyGest[playerName] then
- updateWindow(id["gest_window"], playerName)
- elseif keyCode==customKeyHelp[playerName] then
- updateWindow(id["help_window"], playerName)
- elseif keyCode==customKeySettings[playerName] then
- updateWindow(id["settings_window"], playerName)
- if isSettingsOpen[playerName] == true then
- for p,_ in pairs(tfm.get.room.playerList) do
- if isSettingsOpen[p]==true then
- if p~=playerName then
- updateWindow(id["settings_window"], p)
- end
- end
- end
- end
- elseif keyCode==customKeyThemes[playerName] then
- updateWindow(id["themes_window"], playerName)
- elseif keyCode==27 then
- if isGestOpen[playerName] == true then updateWindow(id["gest_window"], playerName) end
- if isHelpOpen[playerName] == true then updateWindow(id["help_window"], playerName) end
- if isSettingsOpen[playerName] == true then updateWindow(id["settings_window"], playerName) end
- if isThemesOpen[playerName] == true then updateWindow(id["themes_window"], playerName) end
- end
- if fly==true then
- if keyCode==32 then
- tfm.exec.movePlayer(playerName, playerName.x, playerName.y, false, 0, -50, off)
- end
- end
- end
- end
- function eventChatCommand(playerName, message)
- local args = {}
- for arg in message:gmatch("[^%s]+") do
- table.insert(args, arg:lower())
- end
- if args[1] == "bc" and args[2]~=nil then
- if bootcamp==true then
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.newGame(args[2])
- tfm.exec.setGameTime(bootcampDuration)
- end
- end
- if args[1] == "time" and args[2] ~= nil then
- tfm.exec.setGameTime(args[2])
- end
- if args[1]=="color" and args[2] ~= nil then
- if string.len(message) > 6 then
- tfm.exec.setNameColor(playerName, "0x"..args[2])
- end
- end
- if args[1]=="np" and args[2]~= nil then
- tfm.exec.newGame(args[2])
- end
- if args[1]=="q" or args[1]=="queue" or args[1]=="npp" then
- if args[2]~=nil then
- local mapCode = string.gsub(args[2], "@", "")
- mapCode = tonumber(mapCode)
- table.insert(queue, #queue + 1, "@"..mapCode)
- for p,_ in pairs(tfm.get.room.playerList) do
- displayQueue()
- end
- end
- end
- if args[1]=="remove" and queue[1]~=nil then
- if args[2]~= nil then
- if tonumber(args[2]) < #queue and tonumber(args[2]) > 0 then
- table.remove(queue, tonumber(args[2]))
- end
- else
- table.remove(queue, #queue)
- end
- displayQueue()
- end
- if message=="stop" then
- activate(nil)
- elseif message=="next" then
- if queue[1]~= nil then
- activate(queue[1])
- table.remove(queue, 1)
- else
- if bootcamp then
- activate("bootcamp")
- end
- end
- elseif message=="kill" or message=="mort" then
- tfm.exec.killPlayer(playerName)
- elseif message=="ch" then
- tfm.exec.setPlayerScore(playerName, 9001 + math.random(1000), add)
- elseif message=="respawn" then
- if not survivor and not vampire and not robber then
- tfm.exec.respawnPlayer(playerName)
- end
- elseif message=="meep" then
- if not survivor and not vampire and not robber then
- tfm.exec.giveMeep(playerName)
- end
- elseif message=="removeall" then
- queue = {}
- displayQueue()
- elseif message=="help" then
- updateWindow(id["help_window"], playerName)
- elseif message=="fr" then
- changeLanguage("fr")
- elseif message=="en" then
- changeLanguage("en")
- else
- if quizz then
- local answers = {}
- if hasPosedQuestion then
- for w in bddquiz[currentQuestion]:gmatch("[^%,]+") do
- table.insert(answers, w)
- end
- if not hasAnswered then
- for _,answer in pairs(answers) do
- if message==answer then
- tfm.exec.giveCheese(playerName)
- tfm.exec.playerVictory(playerName)
- hasAnswered = true
- hasWonQuiz = true
- ui.addTextArea(2, "<p align='center'><font size='18' color='#BAB460'>"..text.gagnant_quizz_1..playerName..text.gagnant_quizz_2..answer:gsub("^%l", string.upper).."] !</font></p>", player, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
- currentQuestion = nil
- quizzTimer = 0
- questionTime = 0
- hasPosedQuestion = false
- hasAnswered = false
- end
- end
- end
- end
- end
- end
- end
- function eventTextAreaCallback(textAreaId, playerName, callback)
- if callback=="callbackClose" then
- updateWindow(id["help_window"], playerName)
- elseif callback=="callbackCommands" then
- updateWindow(id["help_window"], playerName)
- displayCommands(false, playerName)
- elseif callback=="callbackCloseCommands" then
- displayCommands(true, playerName)
- elseif callback=="callbackAccueilCommands" then
- displayCommands(true, playerName)
- updateWindow(id["help_window"], playerName)
- elseif callback=="callbackMinijeux" then
- updateWindow(id["help_window"], playerName)
- displayMinijeux(false, playerName)
- elseif callback=="callbackCloseMinijeux" then
- displayMinijeux(true, playerName)
- elseif callback=="callbackAccueilMinijeux" then
- displayMinijeux(true, playerName)
- updateWindow(id["help_window"], playerName)
- elseif callback=="callbackCloseGestionnaire" then
- updateWindow(id["gest_window"], playerName)
- elseif callback=="callbackCloseSettings" then
- updateWindow(id["settings_window"], playerName)
- elseif callback=="callbackCloseThemes" then
- updateWindow(id["themes_window"], playerName)
- elseif callback=="callbackThemeClassic" then
- changeTheme("classic")
- elseif callback=="callbackThemeDark" then
- changeTheme("dark")
- elseif callback=="callbackBootcamp" then
- updateWindow(id["gest_window"], playerName)
- activate("bootcamp")
- elseif callback=="callbackChamane" then
- updateWindow(id["gest_window"], playerName)
- activate("chamane")
- elseif callback=="callbackFly" then
- updateWindow(id["gest_window"], playerName)
- activate("fly")
- elseif callback=="callbackVampire" then
- updateWindow(id["gest_window"], playerName)
- activate("vampire")
- elseif callback=="callbackSurvivor" then
- updateWindow(id["gest_window"], playerName)
- activate("survivor")
- elseif callback=="callbackQuizz" then
- updateWindow(id["gest_window"], playerName)
- activate("quizz")
- elseif callback=="callbackrobber" then
- updateWindow(id["gest_window"], playerName)
- activate("robber")
- elseif callback=="callbackBindGest" then
- listenKeyGest[playerName] = true
- listenKeyHelp[playerName] = false
- listenKeySettings[playerName] = false
- listenKeyThemes[playerName] = false
- ui.removeTextArea(id["bind_gest"])
- ui.addTextArea(id["bind_gest"], "<p align='center'>"..text.press_touche.."</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_help"])
- ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_settings"])
- ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_themes"])
- ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
- elseif callback=="callbackBindHelp" then
- listenKeyHelp[playerName] = true
- listenKeyGest[playerName] = false
- listenKeySettings[playerName] = false
- listenKeyThemes[playerName] = false
- ui.removeTextArea(id["bind_help"])
- ui.addTextArea(id["bind_help"], "<p align='center'>"..text.press_touche.."</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_gest"])
- ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_settings"])
- ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_themes"])
- ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
- elseif callback=="callbackBindSettings" then
- listenKeySettings[playerName] = true
- listenKeyGest[playerName] = false
- listenKeyHelp[playerName] = false
- listenKeyThemes[playerName] = false
- ui.removeTextArea(id["bind_settings"])
- ui.addTextArea(id["bind_settings"], "<p align='center'>"..text.press_touche.."</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_gest"])
- ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_help"])
- ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_themes"])
- ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
- elseif callback=="callbackBindThemes" then
- listenKeyThemes[playerName] = true
- listenKeyGest[playerName] = false
- listenKeyHelp[playerName] = false
- listenKeySettings[playerName] = false
- ui.removeTextArea(id["bind_themes"])
- ui.addTextArea(id["bind_themes"], "<p align='center'>"..text.press_touche.."</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_gest"])
- ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_help"])
- ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.removeTextArea(id["bind_settings"])
- ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
- elseif callback=="callbackStop" then
- updateWindow(id["gest_window"], playerName)
- activate(nil)
- end
- end
- function displayHelp(doClose, playerName)
- if doClose==true then
- ui.removeTextArea(id["main_help"], playerName)
- ui.removeTextArea(id["close_help"], playerName)
- ui.removeTextArea(id["commands_help"], playerName)
- ui.removeTextArea(id["minijeux_help"], playerName)
- else
- ui.addTextArea(id["main_help"], text.help_1..Key[customKeyGest[playerName]]..text.help_2..Key[customKeySettings[playerName]]..text.help_3..Key[customKeyThemes[playerName]]..text.help_4, playerName, 200, 100, 400, 200, theme.background, theme.bg_border, theme.opacity)
- ui.addTextArea(id["close_help"], "<font size='15'><a href='event:callbackClose'>x</a></font>", playerName, 206, 105, 20, 30, theme.background, theme.background, 0f)
- ui.addTextArea(id["commands_help"], "<p align='center'><a href='event:callbackCommands'>"..text.commandes_label.."</a></p>", playerName, 275, 250, 100, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["minijeux_help"], "<p align='center'><a href='event:callbackMinijeux'>"..text.minijeux_label.."</a></p>", playerName, 425, 250, 100, 20, theme.button, theme.button_border, theme.opacity)
- end
- end
- function displayCommands(doClose, playerName)
- if doClose==true then
- ui.removeTextArea(id["main_commands"], playerName)
- ui.removeTextArea(id["close_commands"], playerName)
- ui.removeTextArea(id["accueil_commands"], playerName)
- else
- ui.addTextArea(id["main_commands"], text.commandes, playerName, 175, 60, 460, 260, theme.background, theme.bg_border, theme.opacity)
- ui.addTextArea(id["close_commands"], "<font size='15'><a href='event:callbackCloseCommands'>x</a></font>", playerName, 181, 65, 20, 30, theme.background, theme.background, 0f)
- ui.addTextArea(id["accueil_commands"], "<font size='15'><a href='event:callbackAccueilCommands'>←</a></font>", playerName, 610, 65, 20, 30, theme.background, theme.background, 0f)
- end
- end
- function displayMinijeux(doClose, playerName)
- if doClose==true then
- ui.removeTextArea(id["main_minijeux"], playerName)
- ui.removeTextArea(id["close_minijeux"], playerName)
- ui.removeTextArea(id["accueil_minijeux"], playerName)
- else
- ui.addTextArea(id["main_minijeux"], text.minijeux, playerName, 200, 100, 400, 200, theme.background, theme.bg_border, theme.opacity)
- ui.addTextArea(id["close_minijeux"], "<font size='15'><a href='event:callbackCloseMinijeux'>x</a></font>", playerName, 206, 105, 20, 30, theme.background, theme.background, 0f)
- ui.addTextArea(id["accueil_minijeux"], "<font size='15'><a href='event:callbackAccueilMinijeux'>←</a></font>", playerName, 570, 105, 20, 30, theme.background, theme.background, 0f)
- end
- end
- function displayGestionnaire(doClose, playerName)
- if doClose==true then
- ui.removeTextArea(id["main_gest"], playerName)
- ui.removeTextArea(id["close_gest"], playerName)
- ui.removeTextArea(id["bootcamp_gest"], playerName)
- ui.removeTextArea(id["chamane_gest"], playerName)
- ui.removeTextArea(id["vampire_gest"], playerName)
- ui.removeTextArea(id["fly_gest"], playerName)
- ui.removeTextArea(id["survivor_gest"], playerName)
- ui.removeTextArea(id["quizz_gest"], playerName)
- ui.removeTextArea(id["robber_gest"], playerName)
- ui.removeTextArea(id["nil_gest"], playerName)
- if isActivated(nil) then ui.removeTextArea(id["stop_gest"], playerName) end
- else
- y_ancre = -10
- if isActivated(nil) then
- y_ancre = y_ancre - 30
- ui.addTextArea(id["main_gest"], "<p align='center'><font color='#C2C2DA' size='25' >"..text.gest_label.."</font><br><br>"..text.gest_main, playerName, 200, 85+y_ancre, 400, 300, theme.background, theme.bg_border, theme.opacity)
- else
- ui.addTextArea(id["main_gest"], "<p align='center'><font color='#C2C2DA' size='25' >"..text.gest_label.."</font><br><br>"..text.gest_main, playerName, 200, 85, 400, 245, theme.background, theme.bg_border, theme.opacity)
- end
- ui.addTextArea(id["close_gest"], "<font size='15'><a href='event:callbackCloseGestionnaire'>x</a></font>", playerName, 205, 88+ y_ancre + 10, 20, 30, theme.background, theme.background, 0f)
- ui.addTextArea(id["bootcamp_gest"], "<p align='center'><a href='event:callbackBootcamp'>Bootcamp</a></p>", playerName, 225, 200+ y_ancre, 100, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["chamane_gest"], "<p align='center'><a href='event:callbackChamane'>Chamane</a></p>", playerName, 225, 250+ y_ancre, 100, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["vampire_gest"], "<p align='center'><a href='event:callbackVampire'>Vampire</a></p>", playerName, 350, 200+ y_ancre, 100, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["fly_gest"], "<p align='center'><a href='event:callbackFly'>Fly</a></p>", playerName, 350, 250+ y_ancre, 100, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["survivor_gest"], "<p align='center'><a href='event:callbackSurvivor'>Survivor</a></p>", playerName, 475, 200+ y_ancre, 100, 20, theme.button, theme.button_border, theme.opacity)
- if lang_name~="en" then ui.addTextArea(id["quizz_gest"], "<p align='center'><a href='event:callbackQuizz'>Quizz</a></p>", playerName, 475, 250+ y_ancre, 100, 20, theme.button, theme.button_border, theme.opacity)
- else ui.addTextArea(id["quizz_gest"], "<p align='center'><font color='#6C77C1'>Quizz</font></p>", playerName, 475, 250+ y_ancre, 100, 20, theme.button, theme.button_border, theme.opacity) end
- ui.addTextArea(id["robber_gest"], "<p align='center'><a href='event:callbackrobber'>Cheese robber !</a></p>", playerName, 225, 300+ y_ancre, 225, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["nil_gest"], "<p align='center'><a href='event:callbackNil'>-</a></p>", playerName, 475, 300+ y_ancre, 100, 20, theme.button, theme.button_border, theme.opacity)
- if isActivated(nil) then
- ui.addTextArea(id["stop_gest"], "<p align='center'><a href='event:callbackStop'>Arrêter le mini-jeu en cours</a></p>", playerName, 225, 350+ y_ancre, 350, 20, theme.button, theme.button_border, theme.opacity)
- end
- end
- end
- function displaySettings(doClose, playerName)
- if doClose==true then
- ui.removeTextArea(id["main_settings"])
- ui.removeTextArea(id["close_settings"])
- ui.removeTextArea(id["redefinir_gest"])
- ui.removeTextArea(id["bind_gest_label"])
- ui.removeTextArea(id["bind_gest"])
- ui.removeTextArea(id["redefinir_help"])
- ui.removeTextArea(id["bind_help_label"])
- ui.removeTextArea(id["bind_help"])
- ui.removeTextArea(id["redefinir_settings"])
- ui.removeTextArea(id["bind_settings_label"])
- ui.removeTextArea(id["bind_settings"])
- ui.removeTextArea(id["redefinir_themes"])
- ui.removeTextArea(id["bind_themes_label"])
- ui.removeTextArea(id["bind_themes"])
- listenKeyGest[playerName] = false
- listenKeyHelp[playerName] = false
- listenKeySettings[playerName] = false
- listenKeyThemes[playerName] = false
- else
- ui.addTextArea(id["main_settings"], "<p align='center'><font color='#C2C2DA' size='25'>"..text.options.."</font></p>", playerName, 175, 100, 450, 220, theme.background, theme.bg_border, theme.opacity)
- ui.addTextArea(id["close_settings"], "<font size='15'><a href='event:callbackCloseSettings'>x</a></font>", playerName, 181, 105, 20, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["redefinir_gest"], "<a href='event:callbackBindGest'><font color='#BABD2F'>["..text.redefinir.."]</font></a>", playerName, 175, 160, 70, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["bind_gest_label"], text.bind_gest_label, playerName, 240, 160, 225, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</a></p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["redefinir_help"], "<a href='event:callbackBindHelp'><font color='#BABD2F'>["..text.redefinir.."]</font></a>", playerName, 175, 200, 120, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["bind_help_label"], text.bind_help_label, playerName, 240, 200, 225, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["redefinir_settings"], "<a href='event:callbackBindSettings'><font color='#BABD2F'>["..text.redefinir.."]</font></a>", playerName, 175, 240, 120, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["bind_settings_label"], text.bind_settings_label, playerName, 240, 240, 225, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["redefinir_themes"], "<a href='event:callbackBindThemes'><font color='#BABD2F'>["..text.redefinir.."]</font></a>", playerName, 175, 280, 120, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["bind_themes_label"], text.bind_themes_label, playerName, 240, 280, 225, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
- end
- end
- function displayThemes(doClose, playerName)
- if doClose then
- ui.removeTextArea(id["main_themes"])
- ui.removeTextArea(id["close_themes"])
- ui.removeTextArea(id["classic_theme"])
- ui.removeTextArea(id["dark_theme"])
- else
- ui.addTextArea(id["main_themes"], "<p align='center'><font color='#C2C2DA' size='25' >"..text.themes_label.."</font><br><br>"..text.themes_main, playerName, 250, 140, 300, 120, theme.background, theme.bg_border, theme.opacity)
- ui.addTextArea(id["close_themes"], "<font size='15'><a href='event:callbackCloseThemes'>x</a></font>", playerName, 256, 145, 20, 20, theme.background, theme.background, 0f)
- ui.addTextArea(id["classic_theme"], "<p align='center'><a href='event:callbackThemeClassic'>"..text.classicTheme.."</a></p>", playerName, 270, 220, 120, 20, theme.button, theme.button_border, theme.opacity)
- ui.addTextArea(id["dark_theme"], "<p align='center'><a href='event:callbackThemeDark'>"..text.darkTheme.."</a></p>", playerName, 410, 220, 120, 20, theme.button, theme.button_border, theme.opacity)
- end
- end
- function displayCredits()
- ui.addTextArea(id["credits"], text.credits.." Deathmatic & Allounett", NIL, 5, 380, 400, 20, 0x6A7495, 0x6A7495, 0f)
- end
- function displayHeader()
- local currentMap = {}
- if tfm.get.room.xmlMapInfo ~= nil then
- if tfm.get.room.xmlMapInfo.author ~= nil then
- currentMap.code = tfm.get.room.currentMap
- currentMap.auteur = tfm.get.room.xmlMapInfo.author
- else
- currentMap.auteur = "Inconnu"
- end
- end
- local codetmp = string.gsub(currentMap.code, "@", "")
- codetmp = tonumber(codetmp)
- if codetmp < 900 then
- tfm.exec.setUIMapName(currentMap.code.." <font color='#60608F'>|</font> <font color='#C2C2DA'>"..text.minijeu_label.." :</font> <font color='#E5C66C'>"..keyWord.."</font>")
- else
- tfm.exec.setUIMapName(currentMap.auteur.." <font color='#6C77C1'>- "..currentMap.code.." </font><font color='#60608F'>|</font> <font color='#C2C2DA'>"..text.minijeu_label.." :</font> <font color='#E5C66C'>"..keyWord.."</font>")
- end
- end
- function displayQueue()
- local qvalue = ""
- local opacity = 0f
- local height = 8
- if #queue~=0 then
- opacity = 0.5f
- for id,map in pairs(queue) do
- qvalue = qvalue.."<J> ["..id.."] : <N>"..map.."<br />"
- height = height + 13
- end
- end
- ui.addTextArea(id["main_queue"], qvalue, nil, 5, 25, 100, height, 0x010101, 0xFFFFFF, opacity)
- end
- function askQuestion(question, player, isNext)
- if not isNext then
- ui.addTextArea(id["question_quizz"], "<p align='center'><font size='18'>"..question.."</font></p>", player, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
- end
- end
- function updateWindow(windowId, player)
- if windowId==id["gest_window"] then
- if isGestOpen[player] ~= nil then
- if isGestOpen[player] == true then
- displayGestionnaire(true, player)
- isGestOpen[player] = false
- else
- displayGestionnaire(false, player)
- isGestOpen[player] = true
- end
- end
- elseif windowId==id["help_window"] then
- if isHelpOpen[player] ~= nil then
- if isHelpOpen[player] == true then
- displayHelp(true, player)
- isHelpOpen[player] = false
- else
- displayHelp(false, player)
- isHelpOpen[player] = true
- end
- end
- elseif windowId==id["settings_window"] then
- if isSettingsOpen[player] ~= nil then
- if isSettingsOpen[player] == true then
- displaySettings(true, player)
- isSettingsOpen[player] = false
- else
- displaySettings(false, player)
- isSettingsOpen[player] = true
- end
- end
- elseif windowId==id["themes_window"] then
- if isThemesOpen[player] ~= nil then
- if isThemesOpen[player] == true then
- displayThemes(true, player)
- isThemesOpen[player] = false
- else
- displayThemes(false, player)
- isThemesOpen[player] = true
- end
- end
- end
- end
- function activate(target)
- if target=="bootcamp" then
- fly = false
- chamane = false
- vampire = false
- survivor = false
- quizz = false
- robber = false
- bootcamp = true
- keyWord = "Bootcamp"
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoTimeLeft(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAllShamanSkills(false)
- tfm.exec.newGame(bootcampMaps[math.random(#bootcampMaps)])
- tfm.exec.setGameTime(bootcampDuration)
- elseif target=="chamane" then
- fly = false
- vampire = false
- bootcamp = false
- survivor = false
- quizz = false
- robber = false
- chamane = true
- keyWord = "Shaman"
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAllShamanSkills(false)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.newGame(tfm.get.room.currentMap)
- elseif target=="fly" then
- chamane = false
- vampire = false
- bootcamp = false
- survivor = false
- quizz = false
- robber = false
- fly = true
- keyWord = "Fly"
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAllShamanSkills(false)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.newGame(tfm.get.room.currentMap)
- elseif target=="vampire" then
- fly = false
- chamane = false
- bootcamp = false
- survivor = false
- quizz = false
- robber = false
- hasVampired = false
- hasEndVampired = false
- vampire = true
- keyWord = "Vampire"
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.disableAllShamanSkills(false)
- tfm.exec.newGame(vampireMaps[math.random(#vampireMaps)])
- for p,_ in pairs(tfm.get.room.playerList) do
- tfm.exec.giveMeep(p)
- end
- elseif target=="survivor" then
- fly = false
- chamane = false
- bootcamp = false
- vampire = false
- quizz = false
- robber = false
- survivor = true
- keyWord = "Survivor"
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(false)
- tfm.exec.disableAllShamanSkills(true)
- tfm.exec.disableAfkDeath(false)
- tfm.exec.newGame(survivorMaps[math.random(#survivorMaps)])
- for p,_ in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(p, 0, false)
- end
- elseif target=="quizz" then
- fly = false
- chamane = false
- bootcamp = false
- vampire = false
- survivor = false
- robber = false
- quizz = true
- keyWord = "Quizz !"
- tfm.exec.disableAutoScore(true)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoShaman(true)
- tfm.exec.disableAllShamanSkills(true)
- tfm.exec.disableAfkDeath(true)
- tfm.exec.newGame(quizzMaps[math.random(#quizzMaps)])
- elseif target=="robber" then
- fly = false
- chamane = false
- bootcamp = false
- vampire = false
- survivor = false
- quizz = false
- robber = true
- keyWord = "Cheese robber !"
- tfm.exec.disableAfkDeath(false)
- tfm.exec.disableAutoShaman(false)
- tfm.exec.disableAutoNewGame(true)
- tfm.exec.disableAutoScore(false)
- tfm.exec.disableAllShamanSkills(true)
- tfm.exec.disableAutoTimeLeft(false)
- tfm.exec.newGame(robberMaps[math.random(#robberMaps)])
- else
- if quizz==true then
- ui.removeTextArea(id["question_quizz"], nil)
- ui.removeTextArea(id["quizz_rebours"], nil)
- ui.removeTextArea(id["bravo_quizz"], nil)
- ui.removeTextArea(id["time_quizz"], nil)
- end
- if target==nil then
- queue = {}
- for p,_ in pairs(tfm.get.room.playerList) do
- tfm.exec.setPlayerScore(p, 0, false)
- end
- end
- vampire = false
- chamane = false
- fly = false
- bootcamp = false
- survivor = false
- quizz = false
- robber = false
- keyWord = text.aucun
- hasVampired = false
- hasEndVampired = false
- currentQuestion = nil
- quizzTimer = 0
- hasPosedQuestion = false
- questionTime = 0
- hasAnswered = false
- hasWonQuiz = false
- tfm.exec.disableAfkDeath(false)
- tfm.exec.disableAutoShaman(false)
- tfm.exec.disableAutoNewGame(false)
- tfm.exec.disableAutoScore(false)
- tfm.exec.disableAllShamanSkills(false)
- tfm.exec.disableAutoTimeLeft(false)
- tfm.exec.newGame(target)
- end
- end
- function isActivated(target)
- if target=="bootcamp" then if bootcamp then return true end
- elseif target=="vampire" then if vampire then return true end
- elseif target=="survivor" then if survivor then return true end
- elseif target=="chamane" then if chamane then return true end
- elseif target=="fly" then if fly then return true end
- elseif target=="quizz" then if quizz then return true end
- elseif target=="robber" then if robber then return true end
- else if bootcamp or vampire or survivor or chamane or fly or quizz or robber then return true end end
- return false
- end
- function changeLanguage(language)
- if language=="fr" then
- lang_name = "fr"
- text = lang.fr
- else
- lang_name = "en"
- text = lang.en
- end
- if not isActivated(nil) then keyWord = text.aucun end
- displayHeader()
- displayCredits()
- for p,_ in pairs(tfm.get.room.playerList) do
- if isGestOpen[p] == true then
- updateWindow(id["gest_window"], p)
- updateWindow(id["gest_window"], p)
- end
- if isHelpOpen[p] == true then
- updateWindow(id["help_window"], p)
- updateWindow(id["help_window"], p)
- end
- if isSettingsOpen[p] == true then
- updateWindow(id["settings_window"], p)
- updateWindow(id["settings_window"], p)
- end
- if isThemesOpen[p] == true then
- updateWindow(id["themes_window"], p)
- updateWindow(id["themes_window"], p)
- end
- end
- end
- function changeTheme(theme_target)
- if theme_target=="dark" then
- theme = themes.dark
- else
- theme = themes.classic
- end
- for p,_ in pairs(tfm.get.room.playerList) do
- if isGestOpen[p] == true then
- updateWindow(id["gest_window"], p)
- updateWindow(id["gest_window"], p)
- end
- if isHelpOpen[p] == true then
- updateWindow(id["help_window"], p)
- updateWindow(id["help_window"], p)
- end
- if isSettingsOpen[p] == true then
- updateWindow(id["settings_window"], p)
- updateWindow(id["settings_window"], p)
- end
- if isThemesOpen[p] == true then
- updateWindow(id["themes_window"], p)
- end
- end
- end
- function randomQuestion()
- local tmpquestions = {}
- for quast,_ in pairs(bddquiz) do
- table.insert(tmpquestions, quast)
- end
- index = math.random(1, #tmpquestions)
- question = tmpquestions[index]
- return question
- end
- function table.random(t, associative)
- associative = associative or false
- if associative then
- local t2 = {}
- for k in pairs(t) do
- t2[#t2 + 1] = k
- end
- return t[table.random(t2)]
- else
- return t[math.random(1,#t)]
- end
- end
- function randomPlayer()
- return table.random(tfm.get.room.playerList, true)
- end
- activate(nil)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement