Advertisement
Allounett_Deathmatic

TribeHouseManager v1.9 [FR]

Nov 20th, 2013
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         ----   _________    __     __     __      __   ----
  2.         ----   \__   ___/  |  |   |  |   |  \    /  |  ----
  3.         ----      |  |     |  |__ |  |   |   \  /   |  ----
  4.         ----      |  |     |  ____   |   |    \/    |  ----
  5.         ----      |  |     |  |   |  |   |  |\__/\  |  ----
  6.         ----      |  |     |  |   |  |   |__      |_   ----
  7.         ----                                           ----
  8.         --------------- Tribe House Manager ---------------
  9.  
  10. --------- DEVELOPED AND MANAGED BY DEATHMATIC & ALLOUNETT -------------
  11.  
  12. fly = false
  13. chamane = false
  14. vampire = false
  15. bootcamp = false
  16. survivor = false
  17. quizz = false
  18. robber = false
  19.  
  20. hasVampired = false
  21. hasEndVampired = false
  22.  
  23. keyWord = ""
  24.  
  25. lang_name = "fr"
  26.  
  27. currentQuestion = nil
  28. quizzTimer = 0
  29. questionTime = 0
  30. hasPosedQuestion = false
  31. hasAnswered = false
  32. hasWonQuiz = false
  33. coordShamX = 1000
  34. coordShamY = 1000
  35. robberSham = nil
  36. miceWithCheese = 0
  37.  
  38. -- Liste des cartes bootcamp pouvant être jouées (en attendant de pouvoir jouer une carte aléatoire d'une rotation)
  39. 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"}
  40.  
  41. -- Liste des cartes survivor pouvant être jouées (en attendant de pouvoir jouer une carte aléatoire d'une rotation)
  42. 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"}
  43.  
  44. -- Listes des cartes quizz pouvant être jouées
  45. quizzMaps = {"@4383191","@4400908","@4462955","@4463117"}
  46.  
  47. -- Liste des cartes vampire pouvant être joueés
  48. vampireMaps = {"@2821033","@3808004","@1676629","@3296041"}
  49.  
  50. -- Liste des cartes robber pouvant être jouées
  51. robberMaps = {"108", "109", "110", "111", "112", "113", "@4406148", "@4412311", "@4412333"}
  52.  
  53. -- Durée d'une carte bootcamp (défaut: 6min soit 360 secondes)
  54. bootcampDuration = 360
  55.  
  56. -- La file d'attente de cartes
  57. queue = {}
  58.  
  59. -- La maison de tribu actuelle
  60. tribeHouse = nil
  61. tribeHousePicked = false
  62.  
  63. tfm.exec.disableAfkDeath(false)
  64.  
  65. tfm.exec.disableAutoShaman(false)
  66. tfm.exec.disableAutoNewGame(false)
  67. tfm.exec.disableAutoScore(false)
  68. tfm.exec.disableAllShamanSkills(false)
  69. tfm.exec.disableAutoTimeLeft(false)
  70.  
  71. -- Themes
  72. themes = {}
  73.  
  74. themes.classic = {
  75.   background = 0x324650,
  76.   bg_border = 0x6A8FA2,
  77.   button = 0x3C5064,
  78.   button_border = 0x3C5064,
  79.   opacity = 1f
  80. }
  81.  
  82. themes.dark = {
  83.   background = 0x010101,
  84.   bg_border = 0xFFFFFF,
  85.   button = 0x202020,
  86.   button_border = 0x9F9F9F,
  87.   opacity = 0.7f
  88. }
  89.  
  90. -- Textes
  91. lang = {}
  92.  
  93. lang.fr = {
  94.   aucun = "Aucun",
  95.   credits = "Module par",
  96.   help_1 = "<p align='center'><font color='#C2C2DA' size='35' >Aide</font></p><br /><font size='10'>  • Appuyez sur la touche <font color='#BABD2F'>[",
  97.   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'>[",
  98.   help_3 = "]</font> pour ouvrir <font color='#DEB51B'>les options</font></font>.<br /><font size='10'>  • Appuyez sur la touche <font color='#BABD2F'>[",
  99.   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>",
  100.   gest_label = "Gestionnaire de mini-jeux",
  101.   gest_main = "Veuillez séléctionner le mini-jeu désiré :",
  102.   commandes_label = "Commandes",
  103.   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",
  104.   minijeux_label = "Mini-jeux",
  105.   minijeu_label = "Mini-jeu",
  106.   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 !",
  107.   temps_critique = "Plus que 10 secondes !",
  108.   temps_ecoule = "Temps écoulé !",
  109.   gagnant_quizz_1 = "Bravo à ",
  110.   gagnant_quizz_2 = ", la réponse était bien [",
  111.   options = "Options",
  112.   bind_gest_label = "Ouvrir le gestionnaire de mini-jeux :",
  113.   bind_help_label = "Afficher l'aide : ",
  114.   bind_settings_label = "Ouvrir les options :",
  115.   bind_themes_label = "Changer le thème",
  116.   press_touche = "Choisissez une touche",
  117.   redefinir = "Redéfinir",
  118.   themes_label = "Thèmes",
  119.   themes_main = "Choisissez un thème :",
  120.   classicTheme = "Classique",
  121.   darkTheme = "Sombre"
  122. }
  123.  
  124. lang.en = {
  125.   aucun = "None",
  126.   credits = "Module by",
  127.   help_1 = "<p align='center'><font color='#C2C2DA' size='35' >Help</font></p><br /> • Press <font color='#BABD2F'>[",
  128.   help_2 = "]</font> to open the <font color='#DEB51B'>mini-games manager</font></font>.<br /> • Press <font color='#BABD2F'>[",
  129.   help_3 = "]</font> to open <font color='#DEB51B'>settings</font></font>.<br /> • Press <font color='#BABD2F'>[",
  130.   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>",
  131.   gest_label = "Mini-games manager",
  132.   gest_main = "Select a mini-game :",
  133.   commandes_label = "Commands",
  134.   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",
  135.   minijeux_label = "Mini-games",
  136.   minijeu_label = "Mini-game",
  137.   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 !",
  138.   temps_critique = "10 seconds remaining !",
  139.   temps_ecoule = "Time out !",
  140.   gagnant_quizz_1 = "Congratulations to ",
  141.   gagnant_quizz_2 = ", the answer was [",
  142.   options = "Settings",
  143.   bind_gest_label = "Open the mini-games manager :",
  144.   bind_help_label = "Show help :",
  145.   bind_settings_label = "Open settings :",
  146.   bind_themes_label = "Switch the theme",
  147.   press_touche = "Press a key",
  148.   redefinir = "Redefine",
  149.   themes_label = "Themes",
  150.   themes_main = "Choose a theme :",
  151.   classicTheme = "Classic",
  152.   darkTheme = "Dark"
  153. }
  154.  
  155. -- Listes des IDs
  156.   id = {}
  157.  
  158.   -- keys
  159.     id["key_space"] = 32
  160.     id["key_o"] = 79
  161.     id["key_h"] = 72
  162.     id["key_l"] = 76
  163.     id["key_u"] = 85
  164.  
  165.   -- windows
  166.     id["gest_window"] = 1
  167.     id["help_window"] = 2
  168.     id["settings_window"] = 3
  169.     id["themes_window"] = 4
  170.  
  171.   -- textAreas
  172.     -- Crédits
  173.     id["credits"] = 1
  174.    
  175.     -- Aide
  176.     id["main_help"] = 2
  177.     id["close_help"] = 3
  178.     id["commands_help"] = 4
  179.     id["minijeux_help"] = 5
  180.    
  181.     -- Aide => Commandes
  182.     id["main_commands"] = 6
  183.     id["close_commands"] = 7
  184.     id["accueil_commands"] = 8
  185.    
  186.     -- Aide => Mini-jeux
  187.     id["main_minijeux"] = 9
  188.     id["close_minijeux"] = 10
  189.     id["accueil_minijeux"] = 11
  190.    
  191.     -- Gestionnaire de mini-jeux
  192.     id["main_gest"] = 12
  193.     id["close_gest"] = 13
  194.     id["bootcamp_gest"] = 14
  195.     id["chamane_gest"] = 15
  196.     id["vampire_gest"] = 16
  197.     id["fly_gest"] = 17
  198.     id["survivor_gest"] = 18
  199.     id["quizz_gest"] = 19
  200.     id["robber_gest"] = 20
  201.     id["nil_gest"] = 21
  202.     id["stop_gest"] = 22
  203.  
  204.     -- Quizz
  205.     id["question_quizz"] = 23
  206.     id["quizz_rebours"] = 24
  207.     id["bravo_quizz"] = 25
  208.     id["time_quizz"] = 26
  209.    
  210.     -- Queue
  211.     id["main_queue"] = 27
  212.    
  213.     -- Options
  214.     id["main_settings"] = 28
  215.     id["close_settings"] = 29
  216.     id["redefinir_gest"] = 30
  217.     id["bind_gest_label"] = 31
  218.     id["bind_gest"] = 32
  219.     id["redefinir_help"] = 33
  220.     id["bind_help_label"] = 34
  221.     id["bind_help"] = 35
  222.     id["redefinir_settings"] = 36
  223.     id["bind_settings_label"] = 37
  224.     id["bind_settings"] = 38
  225.     id["redefinir_themes"] = 39
  226.     id["bind_themes_label"] = 40
  227.     id["bind_themes"] = 41
  228.    
  229.     -- Themes
  230.     id["main_themes"] = 42
  231.     id["close_themes"] = 43
  232.     id["classic_theme"] = 44
  233.     id["dark_theme"] = 45
  234.  
  235. -- Custom keys
  236. Key = {}
  237.  
  238. Key[8] = "Backspace"
  239. Key[9] = "Tab"
  240. Key[13] = "Enter"
  241. Key[16] = "Shift"
  242. Key[17] = "Ctrl"
  243. Key[18] = "Alt"
  244. Key[19] = "Pause"
  245. Key[20] = "Caps Lock"
  246. Key[27] = "Esc"
  247. Key[32] = "Spacebar"
  248. Key[33] = "Page up"
  249. Key[34] = "Page down"
  250. Key[35] = "End"
  251. Key[36] = "Home"
  252. Key[37] = "Left arrow"
  253. Key[38] = "Up arrow"
  254. Key[39] = "Right arrow"
  255. Key[40] = "Down arrow"
  256. Key[45] = "Insert"
  257. Key[46] = "Delete"
  258. Key[48] = "0"
  259. Key[49] = "1"
  260. Key[50] = "2"
  261. Key[51] = "3"
  262. Key[52] = "4"
  263. Key[53] = "5"
  264. Key[54] = "6"
  265. Key[55] = "7"
  266. Key[56] = "8"
  267. Key[57] = "9"
  268. Key[65] = "A"
  269. Key[66] = "B"
  270. Key[67] = "C"
  271. Key[68] = "D"
  272. Key[69] = "E"
  273. Key[70] = "F"
  274. Key[71] = "G"
  275. Key[72] = "H"
  276. Key[73] = "I"
  277. Key[74] = "J"
  278. Key[75] = "K"
  279. Key[76] = "L"
  280. Key[77] = "M"
  281. Key[78] = "N"
  282. Key[79] = "O"
  283. Key[80] = "P"
  284. Key[81] = "Q"
  285. Key[82] = "R"
  286. Key[83] = "S"
  287. Key[84] = "T"
  288. Key[85] = "U"
  289. Key[86] = "V"
  290. Key[87] = "W"
  291. Key[88] = "X"
  292. Key[89] = "Y"
  293. Key[90] = "Z"
  294. Key[91] = "Windows-L"
  295. Key[92] = "Windows-R"
  296. Key[93] = "App"
  297. Key[97] = "1"
  298. Key[98] = "2"
  299. Key[99] = "3"
  300. Key[100] = "4"
  301. Key[101] = "5"
  302. Key[102] = "6"
  303. Key[103] = "7"
  304. Key[104] = "8"
  305. Key[105] = "9"
  306. Key[106] = "*"
  307. Key[107] = "+"
  308. Key[109] = "-"
  309. Key[110] = "."
  310. Key[111] = "/"
  311. Key[112] = "F1"
  312. Key[113] = "F2"
  313. Key[114] = "F3"
  314. Key[115] = "F4"
  315. Key[116] = "F5"
  316. Key[117] = "F6"
  317. Key[118] = "F7"
  318. Key[119] = "F8"
  319. Key[120] = "F9"
  320. Key[121] = "F10"
  321. Key[122] = "F11"
  322. Key[123] = "F12"
  323. Key[144] = "Numlock"
  324. Key[145] = "Scrolllock"
  325. Key[186] = ";"
  326. Key[187] = "="
  327. Key[188] = ","
  328. Key[189] = "-"
  329. Key[190] = "."
  330. Key[191] = "/"
  331. Key[192] = "`"
  332. Key[219] = "["
  333. Key[220] = "\\"
  334. Key[221] = "]"
  335. Key[222] = "'"
  336.  
  337. -- Listes des questions/réponses du quizz
  338.   bddquiz = {}
  339.   bddquiz["Citez un des auteurs de THM"] = "deathmatic,allounett"
  340.   bddquiz["Où se trouve le canal aménagé au XIXème siècle permet de relier les mers Méditerranée et Rouge ?"] = "suez"
  341.   bddquiz["Quel est le plus long fleuve d'Europe ?"] = "danube"
  342.   bddquiz["Qui fut nommé champion du monde de cyclisme en 2013 ?"] = "ruicosta"
  343.   bddquiz["Quelle cité-état est surnommée la ville-lion ?"] = "singapour"
  344.   bddquiz["En quelle année a eu lieu la chute du mur de Berlin ?"] = "1989"
  345.   bddquiz["Comment les Romains antiques surnommaient-ils la mer Méditerranée ? ?"] = "marenostrum"
  346.   bddquiz["Qui a peint « L'Origine du Monde » en 1866 ?"] = "courbet"
  347.   bddquiz["Quel président des Etats-Unis a été assassiné en 1963 à Dallas ?"] = "kennedy"
  348.   bddquiz["Quel physicien célèbre est également connu pour avoir inventé la chatière ?"] = "newton"
  349.   bddquiz["Quel est le symbole de l'élément chimique sodium ?"] = "na"
  350.   bddquiz["Quelle échelle permet de mesurer la force des piments ?"] = "scoville"
  351.   bddquiz["Le mot magique est un ?"] = "adjectif"
  352.   bddquiz["Quel est le plus petit état de l'Union européenne ?"] = "malte"
  353.   bddquiz["Qu'est-ce qu'un amplificateur de lumière par émission stimulée de rayonnement ?"] = "laser"
  354.   bddquiz["Quel animal est responsable du plus grand nombre de victimes humaines (excepté l'Homme lui-même) ?"] = "moustique"
  355.   bddquiz["En kilomètres, quelle est la distance d'un marathon ?"] = "42"
  356.   bddquiz["Combien les arachnides ont-ils de paires de pattes ?"] = "4"
  357.   bddquiz["En quelle année a été ouvert au public le tunnel sous la Manche ?"] = "1994"
  358.   bddquiz["Citez un fleuve des Enfers."] = "léthé,achéron,styx,phlégéthon,cocyte"
  359.   bddquiz["Comment appelle-t-on un petit bout de terre entre deux mers (que l'on retrouve à Suez et à Panama notamment) ?"] = "isthme"
  360.   bddquiz["Quel acteur a tourné le plus de film « James Bond ? » ?"] = "moore"
  361.   bddquiz["Écrivez correctement le mot suivant : [ékimoz]"] = "ecchymose"
  362.   bddquiz["Écrivez correctement le mot suivant : [bilveuzé]"] = "billeveusée"
  363.   bddquiz["Écrivez correctement le mot suivant : [ilêtrey]"] = "illettré"
  364.   bddquiz["Écrivez correctement le mot suivant : [sénete]"] = "saynette"
  365.   bddquiz["Écrivez correctement le mot suivant : [paraleylaugram]"] = "parallélogramme"
  366.   bddquiz["Écrivez correctement le mot suivant : [fuchya]"] = "fuchsia"
  367.   bddquiz["Conjuguez le verbe « étendre » au passé simple à la deuxième personne du pluriel."] = "étendîtes"
  368.   bddquiz["Quelle chaîne de montagnes considère-t-on traditionnellement comme une frontière naturelle entre l'Europe et l'Asie ?"] = "oural"
  369.   bddquiz["Dans quel pays vivaient les dauphins d'eau douce du Yangzi, certainement disparus à ce jour ?"] = "chine"
  370.   bddquiz["Quel animal associe-t-on généralement au physicien Erwin Schrödinger ?"] = "chat"
  371.   bddquiz["Selon l'expression, si vous avez été dupé dans une affaire, vous êtes le dindon de la... "] = "farce"
  372.   bddquiz["Dans la mythologie grecque, quelle montagne abrite le palais de Zeus ?"] = "olympe"
  373.   bddquiz["Comment, en golf, appelle-t-on l'objet qu'on utilise pour lancer la balle ? "] = "club"
  374.   bddquiz["Un pentagone a 5 côtés. Comment appelle-t-on un polygone à 12 côtés ? "] = "dodécagone"
  375.   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"
  376.   bddquiz["Quel acteur britannique incarne Harry Potter au cinéma ? (Son nom)"] = "radcliffe"
  377.   bddquiz["Quel pays a pour langues officielles le tamoul et le cingalais ?"] = "srilanka"
  378.   bddquiz["Qui a inventé la dynamite ?"] = "nobel"
  379.   bddquiz["Quel mot désigne la cicatrice laissée par le cordon ombilical sur le ventre des mammifères ? "] = "nombril,ombilic"
  380.   bddquiz["Quel mammifère pond des œufs ?"] = "ornithorynque,échidné"
  381.   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"
  382.   bddquiz["Quelle pierre précieuse est une variété cristallisée de carbone pur ?"] = "diamant"
  383.   bddquiz["Quel crustacé d'eau douce élève-t-on en astaciculture ?"] = "écrevisse"
  384.   bddquiz["Dans quel jeu de société un meurtre peut-il être commis par le colonel Moutarde dans la salle à manger ?"] = "cluedo"
  385.   bddquiz["Dans la mythologie égyptienne, quel dieu représente-t-on sous la forme d'un homme à tête de faucon ? "] = "horus"
  386.   bddquiz["Quel pays d'Afrique australe a pour capitale Gaborone ?"] = "botswana"
  387.   bddquiz["Quelle est la capitale de l'Uruguay ?"] = "montevideo"
  388.   bddquiz["Quel pokémon a pour nom anglais Gyarados ?"] = "léviator,leviator,"
  389.   bddquiz["Qui a dit « De l'audace, encore de l'audace, et toujours de l'audace ! » ?"] = "danton"
  390.   bddquiz["Comment appelle-t-on une fonction mathématique qui est soit croissante soit décroissante ?"] = "monotone"
  391.   bddquiz["Vous connaissez sans doute l'expression « franchir le Rubicon », mais qu'est-ce que le Rubicon ?"] = "fleuve, rivière"
  392.   bddquiz["Comment s'appellent les habitants de Tours ?"] = "tourangeaux"
  393.   bddquiz["Qui est la première femme à avoir été enterrée au Panthéon ? (Son nom)"] = "curie"
  394.   bddquiz["Comment appelle-t-on un régime politique gouverné par les plus riche ?"] = "ploutocratie"
  395.   bddquiz["Combien la Terre a-t-elle de satellites naturels ?"] = "1"
  396.   bddquiz["Combien de pays sont traversés par le Rhin ?"] = "6"
  397.  
  398. isGestOpen = {}
  399. isHelpOpen = {}
  400. isSettingsOpen = {}
  401. isThemesOpen = {}
  402.  
  403. customKeyGest = {}
  404. customKeyHelp = {}
  405. customKeySettings = {}
  406. customKeyThemes = {}
  407.  
  408. listenKeyGest = {}
  409. listenKeyHelp = {}
  410. listenKeySettings = {}
  411. listenKeyThemes = {}
  412.  
  413. text = lang[lang_name]
  414. theme = themes.classic
  415.  
  416. function eventNewGame()
  417.   displayCredits()
  418.   displayHeader()
  419.   displayQueue()
  420.  
  421.   ui.removeTextArea(id["question_quizz"])
  422.   ui.removeTextArea(id["quizz_rebours"])
  423.   ui.removeTextArea(id["bravo_quizz"])
  424.   ui.removeTextArea(id["time_quizz"])
  425.  
  426.   hasVampired = false
  427.   hasEndVampired = false
  428.   currentQuestion = nil
  429.   quizzTimer = 0
  430.   questionTime = 0
  431.   hasPosedQuestion = false
  432.   hasAnswered = false
  433.   hasWonQuiz = false
  434.   coordShamX = 1000
  435.   coordShamY = 1000
  436.   robberSham = nil
  437.   miceWithCheese = 0
  438.  
  439.     for playerName,_ in pairs(tfm.get.room.playerList) do
  440.     if customKeyGest[playerName] == nil then
  441.       customKeyGest[playerName] = id["key_o"]
  442.     end
  443.    
  444.     if customKeyHelp[playerName] == nil then
  445.       customKeyHelp[playerName] = id["key_h"]
  446.     end
  447.    
  448.     if customKeySettings[playerName] == nil then
  449.       customKeySettings[playerName] = id["key_l"]
  450.     end
  451.    
  452.     if customKeyThemes[playerName] == nil then
  453.       customKeyThemes[playerName] = id["key_u"]
  454.     end
  455.        
  456.     listenKeyGest[playerName] = false
  457.     listenKeyHelp[playerName] = false
  458.     listenKeySettings[playerName] = false
  459.     listenKeyThemes[playerName] = false
  460.    
  461.     isGestOpen[playerName] = false
  462.     isHelpOpen[playerName] = false
  463.     isSettingsOpen[playerName] = false
  464.     isThemesOpen[playerName] = false
  465.  
  466.     if chamane==true then
  467.       tfm.exec.setShaman(playerName)
  468.     end
  469.    
  470.     for code,key_name in pairs(Key) do
  471.       tfm.exec.bindKeyboard(playerName, code, true, true)
  472.     end
  473.     end
  474.  
  475.   if not tribeHousePicked then
  476.     tribeHouse = tfm.get.room.currentMap
  477.     tribeHousePicked = true
  478.   end
  479. end
  480.  
  481. function eventNewPlayer(playerName)
  482.   displayCredits()
  483.   displayHeader()
  484.   displayQueue()
  485.  
  486.   if customKeyGest[playerName]==nil and customKeyHelp[playerName] == nil and customKeySettings[playerName] == nil and customKeyThemes[playerName] == nil then
  487.     customKeyGest[playerName] = id["key_o"]
  488.     customKeyHelp[playerName] = id["key_h"]
  489.     customKeySettings[playerName] = id["key_l"]
  490.     customKeyThemes[playerName] = id["key_u"]
  491.      
  492.     listenKeyGest[playerName] = false
  493.     listenKeyHelp[playerName] = false
  494.     listenKeySettings[playerName] = false
  495.     listenKeyThemes[playerName] = false
  496.   end
  497.    
  498.   for code,keyname in pairs(Key) do
  499.     tfm.exec.bindKeyboard(playerName, code, true, true)
  500.   end
  501.    
  502.     tfm.exec.respawnPlayer(playerName)
  503.  
  504.   isGestOpen[playerName] = false
  505.   isHelpOpen[playerName] = false
  506.   isSettingsOpen[playerName] = false
  507.   isThemesOpen[playerName] = false
  508.  
  509.     if chamane==true then
  510.         tfm.exec.setShaman(playerName)
  511.     end
  512.  
  513.   if quizz==true then
  514.     if hasPosedQuestion then
  515.       askQuestion(currentQuestion, playerName, false)
  516.     end
  517.   end
  518. end
  519.  
  520. function eventPlayerGetCheese(playerName)
  521.   if robber then
  522.     miceWithCheese = miceWithCheese + 1
  523.  
  524.     if miceWithCheese == 11 then
  525.       tfm.exec.killPlayer(currentSham)
  526.       coordShamX = 1000
  527.       coordShamY = 1000
  528.     end
  529.   end
  530. end
  531.  
  532. function eventPlayerWon(playerWon)
  533.   if bootcamp then
  534.     tfm.exec.respawnPlayer(playerWon)
  535.     tfm.exec.setPlayerScore(playerWon, 20, true)
  536.   end
  537.   if quizz then
  538.     tfm.exec.respawnPlayer(playerWon)
  539.     tfm.exec.setPlayerScore(playerWon, 1, true)
  540.   end
  541. end
  542.  
  543. function eventPlayerDied(playerName)
  544.   if bootcamp==true or quizz==true then
  545.     tfm.exec.respawnPlayer(playerName)
  546.   end
  547.  
  548.   if chamane==true then
  549.     tfm.exec.respawnPlayer(playerName)
  550.     tfm.exec.setShaman(playerName)
  551.   end
  552.  
  553.   if survivor==true then
  554.     tfm.exec.setPlayerScore(playerName, 1, true)
  555.    
  556.     if tfm.get.room.playerList[playerName].isShaman==true then
  557.       tfm.exec.setPlayerScore(playerName, 0, false)
  558.       activate("survivor")
  559.      
  560.       for p,_ in pairs(tfm.get.room.playerList) do
  561.         if tfm.get.room.playerList[p].isShaman==false then
  562.           if tfm.get.room.playerList[p].isDead==false then
  563.             tfm.exec.setPlayerScore(p, math.random(3) + 15, true)
  564.           end
  565.         end
  566.       end
  567.  
  568.     else
  569.       survivorShaman = ""
  570.       nbSurv = 0
  571.       for p,_ in pairs(tfm.get.room.playerList) do
  572.         if tfm.get.room.playerList[p].isShaman==false then
  573.           if tfm.get.room.playerList[p].isDead==false then
  574.             nbSurv = nbSurv + 1
  575.           end
  576.         else
  577.           survivorShaman = p
  578.         end
  579.       end
  580.      
  581.       if nbSurv <= 1 then
  582.         tfm.exec.setPlayerScore(survivorShaman, 0, false)
  583.         activate("survivor")
  584.         for p,_ in pairs(tfm.get.room.playerList) do
  585.           if tfm.get.room.playerList[p].isShaman==false then
  586.             if tfm.get.room.playerList[p].isDead==false then
  587.               tfm.exec.setPlayerScore(p, math.random(3) + 15, true)
  588.             end
  589.         end
  590.       end
  591.       end
  592.     end
  593.   end
  594.  
  595.   if robber then
  596.     local i = 0
  597.    
  598.     for _,player in pairs (tfm.get.room.playerList) do
  599.       if not player.isDead then
  600.         i=i+1
  601.       end
  602.     end
  603.    
  604.     if i == 0 then
  605.       activate("robber")
  606.     end
  607.   end
  608. end
  609.  
  610. function eventLoop(currentTime, timeRemaining)
  611.   if queue[1]~= nil then
  612.     if tfm.get.room.currentMap~=tribeHouse then
  613.       if timeRemaining<=0 then
  614.         activate(queue[1])
  615.         table.remove(queue, 1)
  616.       end
  617.     else
  618.       activate(queue[1])
  619.       table.remove(queue, 1)
  620.     end
  621.   end
  622.  
  623.     if vampire then
  624.         if timeRemaining<=105000 and timeRemaining > 1 then
  625.       if hasVampired==false then
  626.         hasVampired = true
  627.         if hasEndVampired==false then
  628.           tfm.exec.setVampirePlayer(randomPlayer())
  629.           hasEndVampired = true
  630.         end
  631.       else
  632.         if timeRemaining<=100000 then
  633.           if hasEndVampired then
  634.             local sourisVivantes = 0
  635.             local sourisVampireVivantes = 0
  636.              
  637.             for p,_ in pairs(tfm.get.room.playerList) do
  638.               if not tfm.get.room.playerList[p].isDead then
  639.                 sourisVivantes = sourisVivantes + 1
  640.                 if tfm.get.room.playerList[p].isVampire then
  641.                   sourisVampireVivantes = sourisVampireVivantes + 1
  642.                 end
  643.               end
  644.             end
  645.              
  646.             if sourisVampireVivantes == 0 then
  647.               print("<ROSE>Tous les vampires sont morts ! Gloire aux survivants !")
  648.               activate("vampire")
  649.             elseif sourisVampireVivantes >= sourisVivantes then
  650.               print("<ROSE>Les vampires ont contaminés tous les survivants !")
  651.               activate("vampire")
  652.             end
  653.           end
  654.         end
  655.       end
  656.     elseif timeRemaining<=0 then
  657.       print("<ROSE>Les souris ont survécu face aux vampires !")
  658.       activate("vampire")
  659.     end
  660.     end
  661.  
  662.   if bootcamp==true then
  663.     if timeRemaining<=0 then
  664.       activate("bootcamp")
  665.     end
  666.   end
  667.  
  668.   if survivor==true then
  669.     if timeRemaining<=0 then
  670.       for p,_ in pairs(tfm.get.room.playerList) do
  671.         if tfm.get.room.playerList[p].isShaman==false then
  672.           tfm.exec.setPlayerScore(p, math.random(3) + 15, true)
  673.         else
  674.           tfm.exec.setPlayerScore(p, 0, false)
  675.         end
  676.       end
  677.      
  678.       activate("survivor")
  679.     end
  680.   end
  681.  
  682.   if quizz==true then
  683.     if not hasPosedQuestion then
  684.       if quizzTimer < 14 then
  685.         quizzTimer = quizzTimer + 1
  686.       end
  687.      
  688.       if quizzTimer==8 then
  689.         hasWonQuiz = false
  690.         ui.removeTextArea(id["bravo_quizz"])
  691.         hasAnswered = false
  692.         if questionTime >= 60 then
  693.           ui.removeTextArea(id["time_quizz"])
  694.           questionTime = 0
  695.         end
  696.         ui.addTextArea(id["quizz_rebours"], "<p align='center'><font size='120' face='Soopafresh'>3</font></p>", NIL, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
  697.       elseif quizzTimer==10 then
  698.         ui.removeTextArea(id["quizz_rebours"])
  699.         ui.addTextArea(id["quizz_rebours"], "<p align='center'><font size='120' face='Soopafresh'>2</font></p>", NIL, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
  700.       elseif quizzTimer==12 then
  701.         ui.removeTextArea(id["quizz_rebours"])
  702.         ui.addTextArea(id["quizz_rebours"], "<p align='center'><font size='120' face='Soopafresh'>1</font></p>", NIL, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
  703.       elseif quizzTimer==14 then
  704.         ui.removeTextArea(id["quizz_rebours"])
  705.         hasPosedQuestion = true
  706.         question = randomQuestion()
  707.         reponse = bddquiz[question]
  708.         currentQuestion = question
  709.         askQuestion(currentQuestion, nil, false)
  710.       end
  711.     else
  712.       if questionTime < 60 then
  713.         questionTime = questionTime + 1
  714.        
  715.         if questionTime==40 then
  716.           ui.addTextArea(id["time_quizz"], "<p align='center'><font size='16'>"..text.temps_critique.."</font></p>", NIL, 225, 225, 350, 25, 0x010101, 0x010101, 1f)
  717.         end
  718.       else
  719.         ui.removeTextArea(id["time_quizz"])
  720.         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)
  721.         hasAnswered = true
  722.         hasWonQuiz = false
  723.         currentQuestion = nil
  724.         quizzTimer = 0
  725.         hasPosedQuestion = false
  726.       end
  727.     end
  728.   end
  729.  
  730.   if robber then
  731.     if timeRemaining <= 0 then
  732.       activate("robber")
  733.     end
  734.    
  735.     for name,player in pairs(tfm.get.room.playerList) do
  736.       if timeRemaining<=117000 and player.isShaman then
  737.         coordShamX = tfm.get.room.playerList[name].x
  738.         coordShamY = tfm.get.room.playerList[name].y
  739.         robberSham = name
  740.        
  741.         if not player.hasCheese then
  742.           tfm.exec.giveCheese(name)
  743.         end
  744.       end
  745.      
  746.       if not player.hasCheese and not player.isShaman and timeRemaining<=117000 then
  747.         if tfm.get.room.playerList[name].x<(coordShamX+30) and tfm.get.room.playerList[name].x>(coordShamX-30) then
  748.           if tfm.get.room.playerList[name].y<(coordShamY+30) and tfm.get.room.playerList[name].y>(coordShamY-30) then
  749.             tfm.exec.giveCheese(name)
  750.           end
  751.         end
  752.       end
  753.     end
  754.   end
  755. end
  756.  
  757. function eventKeyboard(playerName, keyCode, True, x, y)
  758.   if listenKeyGest[playerName]==true or listenKeyHelp[playerName]==true or listenKeySettings[playerName] == true or listenKeyThemes[playerName] == true then
  759.     if listenKeyGest[playerName] == true then
  760.       customKeyGest[playerName] = keyCode
  761.       listenKeyGest[playerName] = false
  762.       ui.removeTextArea(id["bind_gest"])
  763.       ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
  764.     end
  765.    
  766.     if listenKeyHelp[playerName] == true then
  767.       customKeyHelp[playerName] = keyCode
  768.       listenKeyHelp[playerName] = false
  769.       ui.removeTextArea(id["bind_help"])
  770.       ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
  771.     end
  772.    
  773.     if listenKeySettings[playerName] == true then
  774.       customKeySettings[playerName] = keyCode
  775.       listenKeySettings[playerName] = false
  776.       ui.removeTextArea(id["bind_settings"])
  777.       ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
  778.     end
  779.    
  780.     if listenKeyThemes[playerName] == true then
  781.       customKeyThemes[playerName] = keyCode
  782.       listenKeyThemes[playerName] = false
  783.       ui.removeTextArea(id["bind_themes"])
  784.       ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
  785.     end
  786.    
  787.   else
  788.     if keyCode==customKeyGest[playerName] then
  789.       updateWindow(id["gest_window"], playerName)
  790.  
  791.     elseif keyCode==customKeyHelp[playerName] then
  792.       updateWindow(id["help_window"], playerName)
  793.  
  794.     elseif keyCode==customKeySettings[playerName] then
  795.       updateWindow(id["settings_window"], playerName)
  796.       if isSettingsOpen[playerName] == true then
  797.         for p,_ in pairs(tfm.get.room.playerList) do
  798.           if isSettingsOpen[p]==true then
  799.             if p~=playerName then
  800.               updateWindow(id["settings_window"], p)
  801.             end
  802.           end
  803.         end
  804.       end
  805.    
  806.     elseif keyCode==customKeyThemes[playerName] then
  807.       updateWindow(id["themes_window"], playerName)
  808.    
  809.     elseif keyCode==27 then
  810.       if isGestOpen[playerName] == true then updateWindow(id["gest_window"], playerName) end
  811.       if isHelpOpen[playerName] == true then updateWindow(id["help_window"], playerName) end
  812.       if isSettingsOpen[playerName] == true then updateWindow(id["settings_window"], playerName) end
  813.       if isThemesOpen[playerName] == true then updateWindow(id["themes_window"], playerName) end
  814.     end
  815.  
  816.     if fly==true then
  817.       if keyCode==32 then
  818.         tfm.exec.movePlayer(playerName, playerName.x, playerName.y, false, 0, -50, off)
  819.       end
  820.     end
  821.   end
  822. end
  823.  
  824. function eventChatCommand(playerName, message)
  825.   local args = {}
  826.  
  827.   for arg in message:gmatch("[^%s]+") do
  828.     table.insert(args, arg:lower())
  829.   end
  830.  
  831.   if args[1] == "bc" and args[2]~=nil then
  832.     if bootcamp==true then
  833.       tfm.exec.disableAutoScore(true)
  834.       tfm.exec.disableAutoShaman(true)
  835.       tfm.exec.disableAfkDeath(true)
  836.       tfm.exec.disableAutoTimeLeft(true)
  837.       tfm.exec.disableAutoNewGame(true)
  838.       tfm.exec.newGame(args[2])
  839.       tfm.exec.setGameTime(bootcampDuration)
  840.     end
  841.   end
  842.  
  843.     if args[1] == "time" and args[2] ~= nil then
  844.         tfm.exec.setGameTime(args[2])
  845.     end
  846.    
  847.     if args[1]=="color" and args[2] ~= nil then
  848.         if string.len(message) > 6 then
  849.             tfm.exec.setNameColor(playerName, "0x"..args[2])
  850.         end
  851.     end
  852.  
  853.   if args[1]=="np" and args[2]~= nil then
  854.     tfm.exec.newGame(args[2])
  855.   end
  856.  
  857.   if args[1]=="q" or args[1]=="queue" or args[1]=="npp" then
  858.     if args[2]~=nil then
  859.       local mapCode = string.gsub(args[2], "@", "")
  860.       mapCode = tonumber(mapCode)
  861.      
  862.       table.insert(queue, #queue + 1, "@"..mapCode)
  863.      
  864.       for p,_ in pairs(tfm.get.room.playerList) do
  865.         displayQueue()
  866.       end
  867.     end
  868.   end
  869.  
  870.   if args[1]=="remove" and queue[1]~=nil then
  871.     if args[2]~= nil then
  872.       if tonumber(args[2]) < #queue and tonumber(args[2]) > 0 then
  873.         table.remove(queue, tonumber(args[2]))
  874.       end
  875.     else
  876.       table.remove(queue, #queue)
  877.     end
  878.     displayQueue()
  879.   end
  880.  
  881.     if message=="stop" then
  882.     activate(nil)
  883.    
  884.   elseif message=="next" then
  885.     if queue[1]~= nil then
  886.       activate(queue[1])
  887.       table.remove(queue, 1)
  888.     else
  889.       if bootcamp then
  890.         activate("bootcamp")
  891.       end
  892.     end
  893.  
  894.     elseif message=="kill" or message=="mort" then
  895.         tfm.exec.killPlayer(playerName)
  896.  
  897.     elseif message=="ch" then
  898.         tfm.exec.setPlayerScore(playerName, 9001 + math.random(1000), add)
  899.  
  900.     elseif message=="respawn" then
  901.         if not survivor and not vampire and not robber then
  902.       tfm.exec.respawnPlayer(playerName)
  903.     end
  904.  
  905.     elseif message=="meep" then
  906.     if not survivor and not vampire and not robber then
  907.       tfm.exec.giveMeep(playerName)
  908.     end
  909.  
  910.   elseif message=="removeall" then
  911.     queue = {}
  912.     displayQueue()
  913.  
  914.     elseif message=="help" then
  915.         updateWindow(id["help_window"], playerName)
  916.    
  917.   elseif message=="fr" then
  918.     changeLanguage("fr")
  919.  
  920.   elseif message=="en" then
  921.     changeLanguage("en")
  922.    
  923.   else
  924.     if quizz then
  925.       local answers = {}
  926.       if hasPosedQuestion then
  927.         for w in bddquiz[currentQuestion]:gmatch("[^%,]+") do
  928.           table.insert(answers, w)
  929.         end
  930.        
  931.         if not hasAnswered then
  932.           for _,answer in pairs(answers) do
  933.             if message==answer then
  934.               tfm.exec.giveCheese(playerName)
  935.               tfm.exec.playerVictory(playerName)
  936.               hasAnswered = true
  937.               hasWonQuiz = true
  938.               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)
  939.              
  940.               currentQuestion = nil
  941.               quizzTimer = 0
  942.               questionTime = 0
  943.               hasPosedQuestion = false
  944.               hasAnswered = false
  945.             end
  946.           end
  947.         end
  948.       end
  949.     end
  950.   end
  951. end
  952.  
  953. function eventTextAreaCallback(textAreaId, playerName, callback)
  954.     if callback=="callbackClose" then
  955.         updateWindow(id["help_window"], playerName)
  956.    
  957.     elseif callback=="callbackCommands" then
  958.     updateWindow(id["help_window"], playerName)
  959.         displayCommands(false, playerName)
  960.    
  961.     elseif callback=="callbackCloseCommands" then
  962.         displayCommands(true, playerName)
  963.    
  964.     elseif callback=="callbackAccueilCommands" then
  965.         displayCommands(true, playerName)
  966.         updateWindow(id["help_window"], playerName)
  967.    
  968.     elseif callback=="callbackMinijeux" then
  969.         updateWindow(id["help_window"], playerName)
  970.     displayMinijeux(false, playerName)
  971.    
  972.     elseif callback=="callbackCloseMinijeux" then
  973.         displayMinijeux(true, playerName)
  974.    
  975.     elseif callback=="callbackAccueilMinijeux" then
  976.         displayMinijeux(true, playerName)
  977.     updateWindow(id["help_window"], playerName)
  978.    
  979.   elseif callback=="callbackCloseGestionnaire" then
  980.     updateWindow(id["gest_window"], playerName)
  981.    
  982.   elseif callback=="callbackCloseSettings" then
  983.     updateWindow(id["settings_window"], playerName)
  984.  
  985.   elseif callback=="callbackCloseThemes" then
  986.     updateWindow(id["themes_window"], playerName)
  987.    
  988.   elseif callback=="callbackThemeClassic" then
  989.     changeTheme("classic")
  990.  
  991.   elseif callback=="callbackThemeDark" then
  992.     changeTheme("dark")
  993.    
  994.   elseif callback=="callbackBootcamp" then
  995.     updateWindow(id["gest_window"], playerName)
  996.     activate("bootcamp")
  997.    
  998.   elseif callback=="callbackChamane" then
  999.     updateWindow(id["gest_window"], playerName)
  1000.     activate("chamane")
  1001.    
  1002.   elseif callback=="callbackFly" then
  1003.     updateWindow(id["gest_window"], playerName)
  1004.     activate("fly")
  1005.    
  1006.   elseif callback=="callbackVampire" then
  1007.     updateWindow(id["gest_window"], playerName)
  1008.     activate("vampire")
  1009.    
  1010.   elseif callback=="callbackSurvivor" then
  1011.     updateWindow(id["gest_window"], playerName)
  1012.     activate("survivor")
  1013.  
  1014.   elseif callback=="callbackQuizz" then
  1015.     updateWindow(id["gest_window"], playerName)
  1016.     activate("quizz")
  1017.  
  1018.   elseif callback=="callbackrobber" then
  1019.     updateWindow(id["gest_window"], playerName)
  1020.     activate("robber")
  1021.  
  1022.   elseif callback=="callbackBindGest" then
  1023.     listenKeyGest[playerName] = true
  1024.    
  1025.     listenKeyHelp[playerName] = false
  1026.     listenKeySettings[playerName] = false
  1027.     listenKeyThemes[playerName] = false
  1028.    
  1029.     ui.removeTextArea(id["bind_gest"])
  1030.     ui.addTextArea(id["bind_gest"], "<p align='center'>"..text.press_touche.."</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
  1031.    
  1032.     ui.removeTextArea(id["bind_help"])
  1033.     ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
  1034.    
  1035.     ui.removeTextArea(id["bind_settings"])
  1036.     ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
  1037.    
  1038.     ui.removeTextArea(id["bind_themes"])
  1039.     ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
  1040.  
  1041.   elseif callback=="callbackBindHelp" then
  1042.     listenKeyHelp[playerName] = true
  1043.    
  1044.     listenKeyGest[playerName] = false
  1045.     listenKeySettings[playerName] = false
  1046.     listenKeyThemes[playerName] = false
  1047.    
  1048.     ui.removeTextArea(id["bind_help"])
  1049.     ui.addTextArea(id["bind_help"], "<p align='center'>"..text.press_touche.."</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
  1050.    
  1051.     ui.removeTextArea(id["bind_gest"])
  1052.     ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
  1053.    
  1054.     ui.removeTextArea(id["bind_settings"])
  1055.     ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
  1056.    
  1057.     ui.removeTextArea(id["bind_themes"])
  1058.     ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
  1059.  
  1060.   elseif callback=="callbackBindSettings" then
  1061.     listenKeySettings[playerName] = true
  1062.    
  1063.     listenKeyGest[playerName] = false
  1064.     listenKeyHelp[playerName] = false
  1065.     listenKeyThemes[playerName] = false
  1066.    
  1067.     ui.removeTextArea(id["bind_settings"])
  1068.     ui.addTextArea(id["bind_settings"], "<p align='center'>"..text.press_touche.."</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
  1069.    
  1070.     ui.removeTextArea(id["bind_gest"])
  1071.     ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
  1072.    
  1073.     ui.removeTextArea(id["bind_help"])
  1074.     ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
  1075.    
  1076.     ui.removeTextArea(id["bind_themes"])
  1077.     ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
  1078.    
  1079.   elseif callback=="callbackBindThemes" then
  1080.     listenKeyThemes[playerName] = true
  1081.    
  1082.     listenKeyGest[playerName] = false
  1083.     listenKeyHelp[playerName] = false
  1084.     listenKeySettings[playerName] = false
  1085.    
  1086.     ui.removeTextArea(id["bind_themes"])
  1087.     ui.addTextArea(id["bind_themes"], "<p align='center'>"..text.press_touche.."</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
  1088.    
  1089.     ui.removeTextArea(id["bind_gest"])
  1090.     ui.addTextArea(id["bind_gest"], "<p align='center'>["..Key[customKeyGest[playerName]].."]</p>", playerName, 465, 160, 150, 20, theme.button, theme.button_border, theme.opacity)
  1091.    
  1092.     ui.removeTextArea(id["bind_help"])
  1093.     ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
  1094.    
  1095.     ui.removeTextArea(id["bind_settings"])
  1096.     ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
  1097.  
  1098.   elseif callback=="callbackStop" then
  1099.     updateWindow(id["gest_window"], playerName)
  1100.     activate(nil)
  1101.   end
  1102. end
  1103.  
  1104. function displayHelp(doClose, playerName)
  1105.   if doClose==true then
  1106.     ui.removeTextArea(id["main_help"], playerName)
  1107.         ui.removeTextArea(id["close_help"], playerName)
  1108.         ui.removeTextArea(id["commands_help"], playerName)
  1109.         ui.removeTextArea(id["minijeux_help"], playerName)
  1110.   else
  1111.     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)
  1112.         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)
  1113.         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)
  1114.         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)
  1115.   end
  1116. end
  1117.  
  1118. function displayCommands(doClose, playerName)
  1119.   if doClose==true then
  1120.     ui.removeTextArea(id["main_commands"], playerName)
  1121.         ui.removeTextArea(id["close_commands"], playerName)
  1122.         ui.removeTextArea(id["accueil_commands"], playerName)
  1123.   else
  1124.     ui.addTextArea(id["main_commands"], text.commandes, playerName, 175, 60, 460, 260, theme.background, theme.bg_border, theme.opacity)
  1125.         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)
  1126.         ui.addTextArea(id["accueil_commands"], "<font size='15'><a href='event:callbackAccueilCommands'>←</a></font>", playerName, 610, 65, 20, 30, theme.background, theme.background, 0f)
  1127.   end
  1128. end
  1129.  
  1130. function displayMinijeux(doClose, playerName)
  1131.   if doClose==true then
  1132.     ui.removeTextArea(id["main_minijeux"], playerName)
  1133.         ui.removeTextArea(id["close_minijeux"], playerName)
  1134.         ui.removeTextArea(id["accueil_minijeux"], playerName)
  1135.   else
  1136.     ui.addTextArea(id["main_minijeux"], text.minijeux, playerName, 200, 100, 400, 200, theme.background, theme.bg_border, theme.opacity)
  1137.         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)
  1138.         ui.addTextArea(id["accueil_minijeux"], "<font size='15'><a href='event:callbackAccueilMinijeux'>←</a></font>", playerName, 570, 105, 20, 30, theme.background, theme.background, 0f)
  1139.   end
  1140. end
  1141.  
  1142. function displayGestionnaire(doClose, playerName)
  1143.   if doClose==true then
  1144.     ui.removeTextArea(id["main_gest"], playerName)
  1145.     ui.removeTextArea(id["close_gest"], playerName)
  1146.     ui.removeTextArea(id["bootcamp_gest"], playerName)
  1147.     ui.removeTextArea(id["chamane_gest"], playerName)
  1148.     ui.removeTextArea(id["vampire_gest"], playerName)
  1149.     ui.removeTextArea(id["fly_gest"], playerName)
  1150.     ui.removeTextArea(id["survivor_gest"], playerName)
  1151.     ui.removeTextArea(id["quizz_gest"], playerName)
  1152.     ui.removeTextArea(id["robber_gest"], playerName)
  1153.     ui.removeTextArea(id["nil_gest"], playerName)
  1154.     if isActivated(nil) then ui.removeTextArea(id["stop_gest"], playerName) end
  1155.   else
  1156.     y_ancre = -10
  1157.    
  1158.     if isActivated(nil) then
  1159.       y_ancre = y_ancre - 30
  1160.       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)
  1161.     else
  1162.       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)
  1163.     end
  1164.     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)
  1165.     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)
  1166.     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)
  1167.     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)
  1168.     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)
  1169.     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)
  1170.     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)
  1171.     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
  1172.     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)
  1173.     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)
  1174.     if isActivated(nil) then
  1175.       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)
  1176.     end
  1177.   end
  1178. end
  1179.  
  1180. function displaySettings(doClose, playerName)
  1181.   if doClose==true then
  1182.     ui.removeTextArea(id["main_settings"])
  1183.     ui.removeTextArea(id["close_settings"])
  1184.     ui.removeTextArea(id["redefinir_gest"])
  1185.     ui.removeTextArea(id["bind_gest_label"])
  1186.     ui.removeTextArea(id["bind_gest"])
  1187.     ui.removeTextArea(id["redefinir_help"])
  1188.     ui.removeTextArea(id["bind_help_label"])
  1189.     ui.removeTextArea(id["bind_help"])
  1190.     ui.removeTextArea(id["redefinir_settings"])
  1191.     ui.removeTextArea(id["bind_settings_label"])
  1192.     ui.removeTextArea(id["bind_settings"])
  1193.     ui.removeTextArea(id["redefinir_themes"])
  1194.     ui.removeTextArea(id["bind_themes_label"])
  1195.     ui.removeTextArea(id["bind_themes"])
  1196.    
  1197.     listenKeyGest[playerName] = false
  1198.     listenKeyHelp[playerName] = false
  1199.     listenKeySettings[playerName] = false
  1200.     listenKeyThemes[playerName] = false
  1201.   else
  1202.     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)
  1203.     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)
  1204.     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)
  1205.     ui.addTextArea(id["bind_gest_label"], text.bind_gest_label, playerName, 240, 160, 225, 20, theme.background, theme.background, 0f)
  1206.     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)
  1207.     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)
  1208.     ui.addTextArea(id["bind_help_label"], text.bind_help_label, playerName, 240, 200, 225, 20, theme.background, theme.background, 0f)
  1209.     ui.addTextArea(id["bind_help"], "<p align='center'>["..Key[customKeyHelp[playerName]].."]</p>", playerName, 465, 200, 150, 20, theme.button, theme.button_border, theme.opacity)
  1210.     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)
  1211.     ui.addTextArea(id["bind_settings_label"], text.bind_settings_label, playerName, 240, 240, 225, 20, theme.background, theme.background, 0f)
  1212.     ui.addTextArea(id["bind_settings"], "<p align='center'>["..Key[customKeySettings[playerName]].."]</p>", playerName, 465, 240, 150, 20, theme.button, theme.button_border, theme.opacity)
  1213.     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)
  1214.     ui.addTextArea(id["bind_themes_label"], text.bind_themes_label, playerName, 240, 280, 225, 20, theme.background, theme.background, 0f)
  1215.     ui.addTextArea(id["bind_themes"], "<p align='center'>["..Key[customKeyThemes[playerName]].."]</p>", playerName, 465, 280, 150, 20, theme.button, theme.button_border, theme.opacity)
  1216.   end
  1217. end
  1218.  
  1219. function displayThemes(doClose, playerName)
  1220.   if doClose then
  1221.     ui.removeTextArea(id["main_themes"])
  1222.     ui.removeTextArea(id["close_themes"])
  1223.     ui.removeTextArea(id["classic_theme"])
  1224.     ui.removeTextArea(id["dark_theme"])
  1225.   else
  1226.     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)
  1227.     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)
  1228.     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)
  1229.     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)
  1230.   end
  1231. end
  1232.  
  1233. function displayCredits()
  1234.   ui.addTextArea(id["credits"], text.credits.." Deathmatic & Allounett", NIL, 5, 380, 400, 20, 0x6A7495, 0x6A7495, 0f)
  1235. end
  1236.  
  1237. function displayHeader()
  1238.   local currentMap = {}
  1239.  
  1240.   if tfm.get.room.xmlMapInfo ~= nil then
  1241.     if tfm.get.room.xmlMapInfo.author ~= nil then
  1242.       currentMap.code = tfm.get.room.currentMap
  1243.       currentMap.auteur = tfm.get.room.xmlMapInfo.author
  1244.     else
  1245.       currentMap.auteur = "Inconnu"
  1246.     end
  1247.   end
  1248.  
  1249.   local codetmp = string.gsub(currentMap.code, "@", "")
  1250.   codetmp = tonumber(codetmp)
  1251.  
  1252.   if codetmp < 900 then
  1253.     tfm.exec.setUIMapName(currentMap.code.." <font color='#60608F'>|</font>   <font color='#C2C2DA'>"..text.minijeu_label.." :</font> <font color='#E5C66C'>"..keyWord.."</font>")  
  1254.   else
  1255.     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>")
  1256.   end
  1257. end
  1258.  
  1259. function displayQueue()
  1260.   local qvalue = ""
  1261.   local opacity = 0f
  1262.   local height = 8
  1263.  
  1264.   if #queue~=0 then
  1265.     opacity = 0.5f
  1266.     for id,map in pairs(queue) do
  1267.       qvalue = qvalue.."<J> ["..id.."] : <N>"..map.."<br />"
  1268.       height = height + 13
  1269.     end
  1270.   end
  1271.    
  1272.   ui.addTextArea(id["main_queue"], qvalue, nil, 5, 25, 100, height, 0x010101, 0xFFFFFF, opacity)
  1273. end
  1274.  
  1275. function askQuestion(question, player, isNext)
  1276.   if not isNext then
  1277.     ui.addTextArea(id["question_quizz"], "<p align='center'><font size='18'>"..question.."</font></p>", player, 225, 100, 350, 150, 0x010101, 0x010101, 1f)
  1278.   end
  1279. end
  1280.  
  1281. function updateWindow(windowId, player)
  1282.   if windowId==id["gest_window"] then
  1283.     if isGestOpen[player] ~= nil then
  1284.       if isGestOpen[player] == true then
  1285.         displayGestionnaire(true, player)
  1286.         isGestOpen[player] = false
  1287.       else
  1288.         displayGestionnaire(false, player)
  1289.         isGestOpen[player] = true
  1290.       end
  1291.     end
  1292.    
  1293.   elseif windowId==id["help_window"] then
  1294.     if isHelpOpen[player] ~= nil then
  1295.       if isHelpOpen[player] == true then
  1296.         displayHelp(true, player)
  1297.         isHelpOpen[player] = false
  1298.       else
  1299.         displayHelp(false, player)
  1300.         isHelpOpen[player] = true
  1301.       end
  1302.     end
  1303.    
  1304.   elseif windowId==id["settings_window"] then
  1305.     if isSettingsOpen[player] ~= nil then
  1306.       if isSettingsOpen[player] == true then
  1307.         displaySettings(true, player)
  1308.         isSettingsOpen[player] = false
  1309.       else
  1310.         displaySettings(false, player)
  1311.         isSettingsOpen[player] = true
  1312.       end
  1313.     end
  1314.    
  1315.   elseif windowId==id["themes_window"] then
  1316.     if isThemesOpen[player] ~= nil then
  1317.       if isThemesOpen[player] == true then
  1318.         displayThemes(true, player)
  1319.         isThemesOpen[player] = false
  1320.       else
  1321.         displayThemes(false, player)
  1322.         isThemesOpen[player] = true
  1323.       end
  1324.     end
  1325.   end
  1326. end
  1327.  
  1328. function activate(target)
  1329.   if target=="bootcamp" then
  1330.     fly = false
  1331.     chamane = false
  1332.     vampire = false
  1333.     survivor = false
  1334.     quizz = false
  1335.     robber = false
  1336.      
  1337.     bootcamp = true
  1338.     keyWord = "Bootcamp"
  1339.      
  1340.     tfm.exec.disableAutoScore(true)
  1341.     tfm.exec.disableAutoShaman(true)
  1342.     tfm.exec.disableAutoTimeLeft(true)
  1343.     tfm.exec.disableAutoNewGame(true)
  1344.     tfm.exec.disableAfkDeath(true)
  1345.     tfm.exec.disableAllShamanSkills(false)
  1346.     tfm.exec.newGame(bootcampMaps[math.random(#bootcampMaps)])
  1347.     tfm.exec.setGameTime(bootcampDuration)
  1348.  
  1349.   elseif target=="chamane" then
  1350.     fly = false
  1351.         vampire = false
  1352.     bootcamp = false
  1353.     survivor = false
  1354.     quizz = false
  1355.     robber = false
  1356.      
  1357.         chamane = true
  1358.     keyWord = "Shaman"
  1359.  
  1360.         tfm.exec.disableAutoShaman(true)
  1361.     tfm.exec.disableAutoNewGame(true)
  1362.     tfm.exec.disableAllShamanSkills(false)
  1363.     tfm.exec.disableAfkDeath(true)
  1364.     tfm.exec.newGame(tfm.get.room.currentMap)
  1365.    
  1366.   elseif target=="fly" then
  1367.     chamane = false
  1368.         vampire = false
  1369.     bootcamp = false
  1370.     survivor = false
  1371.     quizz = false
  1372.     robber = false
  1373.      
  1374.         fly = true
  1375.     keyWord = "Fly"
  1376.  
  1377.     tfm.exec.disableAutoShaman(true)
  1378.     tfm.exec.disableAllShamanSkills(false)
  1379.     tfm.exec.disableAutoNewGame(true)
  1380.     tfm.exec.disableAfkDeath(true)    
  1381.         tfm.exec.newGame(tfm.get.room.currentMap)
  1382.    
  1383.    
  1384.   elseif target=="vampire" then
  1385.     fly = false
  1386.     chamane = false
  1387.     bootcamp = false
  1388.     survivor = false
  1389.     quizz = false
  1390.     robber = false
  1391.      
  1392.     hasVampired = false
  1393.     hasEndVampired = false
  1394.     vampire = true
  1395.     keyWord = "Vampire"
  1396.  
  1397.     tfm.exec.disableAutoShaman(true)
  1398.     tfm.exec.disableAutoNewGame(true)
  1399.     tfm.exec.disableAfkDeath(true)
  1400.     tfm.exec.disableAllShamanSkills(false)
  1401.  
  1402.     tfm.exec.newGame(vampireMaps[math.random(#vampireMaps)])
  1403.    
  1404.     for p,_ in pairs(tfm.get.room.playerList) do
  1405.       tfm.exec.giveMeep(p)
  1406.     end
  1407.  
  1408.   elseif target=="survivor" then
  1409.     fly = false
  1410.     chamane = false
  1411.     bootcamp = false
  1412.     vampire = false
  1413.     quizz = false
  1414.     robber = false
  1415.      
  1416.     survivor = true
  1417.     keyWord = "Survivor"
  1418.    
  1419.     tfm.exec.disableAutoScore(true)
  1420.     tfm.exec.disableAutoNewGame(true)
  1421.     tfm.exec.disableAutoShaman(false)
  1422.     tfm.exec.disableAllShamanSkills(true)
  1423.     tfm.exec.disableAfkDeath(false)
  1424.     tfm.exec.newGame(survivorMaps[math.random(#survivorMaps)])
  1425.    
  1426.     for p,_ in pairs(tfm.get.room.playerList) do
  1427.       tfm.exec.setPlayerScore(p, 0, false)
  1428.     end
  1429.  
  1430.   elseif target=="quizz" then
  1431.     fly = false
  1432.     chamane = false
  1433.     bootcamp = false
  1434.     vampire = false
  1435.     survivor = false
  1436.     robber = false
  1437.      
  1438.     quizz = true
  1439.     keyWord = "Quizz !"
  1440.    
  1441.     tfm.exec.disableAutoScore(true)
  1442.     tfm.exec.disableAutoNewGame(true)
  1443.     tfm.exec.disableAutoShaman(true)
  1444.     tfm.exec.disableAllShamanSkills(true)
  1445.     tfm.exec.disableAfkDeath(true)
  1446.     tfm.exec.newGame(quizzMaps[math.random(#quizzMaps)])
  1447.  
  1448.   elseif target=="robber" then
  1449.     fly = false
  1450.     chamane = false
  1451.     bootcamp = false
  1452.     vampire = false
  1453.     survivor = false
  1454.     quizz = false
  1455.      
  1456.     robber = true
  1457.     keyWord = "Cheese robber !"
  1458.  
  1459.     tfm.exec.disableAfkDeath(false)
  1460.     tfm.exec.disableAutoShaman(false)
  1461.     tfm.exec.disableAutoNewGame(true)
  1462.     tfm.exec.disableAutoScore(false)
  1463.     tfm.exec.disableAllShamanSkills(true)
  1464.     tfm.exec.disableAutoTimeLeft(false)
  1465.     tfm.exec.newGame(robberMaps[math.random(#robberMaps)])
  1466.   else
  1467.     if quizz==true then
  1468.       ui.removeTextArea(id["question_quizz"], nil)
  1469.       ui.removeTextArea(id["quizz_rebours"], nil)
  1470.       ui.removeTextArea(id["bravo_quizz"], nil)
  1471.       ui.removeTextArea(id["time_quizz"], nil)
  1472.     end
  1473.    
  1474.     if target==nil then
  1475.       queue = {}
  1476.      
  1477.       for p,_ in pairs(tfm.get.room.playerList) do
  1478.         tfm.exec.setPlayerScore(p, 0, false)
  1479.       end
  1480.     end
  1481.    
  1482.     vampire = false
  1483.     chamane = false
  1484.     fly = false
  1485.     bootcamp = false
  1486.     survivor = false
  1487.     quizz = false
  1488.     robber = false
  1489.    
  1490.     keyWord = text.aucun
  1491.    
  1492.     hasVampired = false
  1493.     hasEndVampired = false
  1494.    
  1495.     currentQuestion = nil
  1496.     quizzTimer = 0
  1497.     hasPosedQuestion = false
  1498.     questionTime = 0
  1499.     hasAnswered = false
  1500.     hasWonQuiz = false
  1501.    
  1502.     tfm.exec.disableAfkDeath(false)
  1503.     tfm.exec.disableAutoShaman(false)
  1504.     tfm.exec.disableAutoNewGame(false)
  1505.     tfm.exec.disableAutoScore(false)
  1506.     tfm.exec.disableAllShamanSkills(false)
  1507.     tfm.exec.disableAutoTimeLeft(false)
  1508.     tfm.exec.newGame(target)
  1509.   end
  1510. end
  1511.  
  1512. function isActivated(target)
  1513.   if target=="bootcamp" then if bootcamp then return true end
  1514.   elseif target=="vampire" then if vampire then return true end
  1515.   elseif target=="survivor" then if survivor then return true end
  1516.   elseif target=="chamane" then if chamane then return true end
  1517.   elseif target=="fly" then if fly then return true end
  1518.   elseif target=="quizz" then if quizz then return true end
  1519.   elseif target=="robber" then if robber then return true end
  1520.   else if bootcamp or vampire or survivor or chamane or fly or quizz or robber then return true end end
  1521.  
  1522.   return false
  1523. end
  1524.  
  1525. function changeLanguage(language)
  1526.   if language=="fr" then
  1527.     lang_name = "fr"
  1528.     text = lang.fr
  1529.   else
  1530.     lang_name = "en"
  1531.     text = lang.en
  1532.   end
  1533.  
  1534.   if not isActivated(nil) then keyWord = text.aucun end
  1535.   displayHeader()
  1536.   displayCredits()
  1537.  
  1538.   for p,_ in pairs(tfm.get.room.playerList) do
  1539.     if isGestOpen[p] == true then
  1540.       updateWindow(id["gest_window"], p)
  1541.       updateWindow(id["gest_window"], p)
  1542.     end
  1543.    
  1544.     if isHelpOpen[p] == true then
  1545.       updateWindow(id["help_window"], p)
  1546.       updateWindow(id["help_window"], p)
  1547.     end
  1548.    
  1549.     if isSettingsOpen[p] == true then
  1550.       updateWindow(id["settings_window"], p)
  1551.       updateWindow(id["settings_window"], p)
  1552.     end
  1553.    
  1554.     if isThemesOpen[p] == true then
  1555.       updateWindow(id["themes_window"], p)
  1556.       updateWindow(id["themes_window"], p)
  1557.     end
  1558.   end
  1559. end
  1560.  
  1561. function changeTheme(theme_target)
  1562.   if theme_target=="dark" then
  1563.     theme = themes.dark
  1564.   else
  1565.     theme = themes.classic
  1566.   end
  1567.  
  1568.   for p,_ in pairs(tfm.get.room.playerList) do
  1569.     if isGestOpen[p] == true then
  1570.       updateWindow(id["gest_window"], p)
  1571.       updateWindow(id["gest_window"], p)
  1572.     end
  1573.    
  1574.     if isHelpOpen[p] == true then
  1575.       updateWindow(id["help_window"], p)
  1576.       updateWindow(id["help_window"], p)
  1577.     end
  1578.    
  1579.     if isSettingsOpen[p] == true then
  1580.       updateWindow(id["settings_window"], p)
  1581.       updateWindow(id["settings_window"], p)
  1582.     end
  1583.    
  1584.     if isThemesOpen[p] == true then
  1585.       updateWindow(id["themes_window"], p)
  1586.     end
  1587.   end
  1588. end
  1589.  
  1590. function randomQuestion()
  1591.   local tmpquestions = {}
  1592.  
  1593.   for quast,_ in pairs(bddquiz) do
  1594.     table.insert(tmpquestions, quast)
  1595.   end
  1596.  
  1597.   index = math.random(1, #tmpquestions)
  1598.   question = tmpquestions[index]
  1599.   return question
  1600. end
  1601.  
  1602. function table.random(t, associative)
  1603.     associative = associative or false
  1604.     if associative then
  1605.         local t2 = {}
  1606.         for k in pairs(t) do
  1607.             t2[#t2 + 1] = k
  1608.         end
  1609.         return t[table.random(t2)]
  1610.     else
  1611.         return t[math.random(1,#t)]
  1612.     end
  1613. end
  1614.  
  1615. function randomPlayer()
  1616.   return table.random(tfm.get.room.playerList, true)
  1617. end
  1618.  
  1619. activate(nil)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement