1--------------------------------------------------------------------- 2-- This file is part of Freedroid 3-- 4-- Freedroid is free software; you can redistribute it and/or modify 5-- it under the terms of the GNU General Public License as published by 6-- the Free Software Foundation; either version 2 of the License, or 7-- (at your option) any later version. 8-- 9-- Freedroid is distributed in the hope that it will be useful, 10-- but WITHOUT ANY WARRANTY; without even the implied warranty of 11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12-- GNU General Public License for more details. 13-- 14-- You should have received a copy of the GNU General Public License 15-- along with Freedroid; see the file COPYING. If not, write to the 16-- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 17-- MA 02111-1307 USA 18---------------------------------------------------------------------- 19 20local Npc = FDrpg.get_npc() 21local Tux = FDrpg.get_tux() 22 23return { 24 EveryTime = function() 25 play_sound("effects/Menu_Item_Deselected_Sound_0.ogg") --@TODO check that the captcha works 26 -- < infrared_> The captcha code could probably be condensed into an array, at the cost of readability for non-coders; translating it shouldn't be a problem. 27 if (not MO_HFGateAccessServer_skip_captcha) then 28 -- Are we human? CAPTCHA!!! 29 number_one=math.random(2,7) 30 number_two=math.random(1,number_one-1) 31 captcha = number_one - number_two 32 if (captcha == 1) then 33 captcha = _"one" 34 elseif (captcha == 2) then 35 captcha = _"two" 36 elseif (captcha == 3) then 37 captcha = _"three" 38 elseif (captcha == 4) then 39 captcha = _"four" 40 elseif (captcha == 5) then 41 captcha = _"five" 42 elseif (captcha == 6) then 43 captcha = _"six" 44 end 45 response = user_input_string(string.format(_"CAPTCHA: Please write the lowercase word that answers the following: %d - %d = ?", number_one, number_two)) 46 else 47 MO_HFGateAccessServer_skip_captcha = false 48 end 49 if (captcha ~= response) then 50 Npc:says(_"Non-human detected. Administering paralyzing shock.") 51 Npc:says(_"NOTE: If you are a human, try again, and make sure you enter a word and not digits.") 52 freeze_tux_npc(7) 53 Tux:hurt(20) 54 Tux:heat(20) 55 play_sound("effects/Menu_Item_Selected_Sound_1.ogg") 56 end_dialog() 57 else 58 Npc:says(_"Welcome to MS gate access server for region #54648.") 59 if (not MO_HFGateAccessServer_Spencer_chat) then 60 Tux:says(_"WHAT?!") 61 Tux:update_quest("Propagating a faulty firmware update", _"The firmware server seems to actually be an access server to a gate. What am I supposed to do now?") 62 MO_HFGateAccessServer_Spencer = true 63 MO_HFGateAccessServer_Spencer_chat = true 64 MO_HFGateAccessServer_skip_captcha = true 65 start_chat("Spencer") 66 play_sound("effects/Menu_Item_Selected_Sound_1.ogg") 67 end_dialog() 68 end 69 if (MO_HFGateAccessServer_Spencer) then 70 MO_HFGateAccessServer_Spencer = false 71 play_sound("effects/Menu_Item_Selected_Sound_1.ogg") 72 end_dialog() 73 else 74 Npc:says(_"Please select action") 75 end 76 show("node1", "node99") 77 end 78 end, 79 80 { 81 id = "node1", 82 text = _"status", 83 echo_text = false, 84 code = function() 85 Tux:says(_"status", "NO_WAIT") 86 if (cmp_obstacle_state("HF-Gate-outer", "opened")) then 87 Npc:says(_"Gate 1 status: OPENED", "NO_WAIT") 88 else 89 Npc:says(_"Gate 1 status: CLOSED", "NO_WAIT") 90 if (not MO_HFGateAccessServer_hacked) then 91 show("node2") 92 end 93 end 94 95 if (cmp_obstacle_state("HF-Gate-inner", "opened")) then 96 Npc:says(_"Gate 2 status: OPENED", "NO_WAIT") 97 else 98 Npc:says(_"Gate 2 status: CLOSED", "NO_WAIT") 99 if (not MO_HFGateAccessServer_hacked) then 100 show("node2") 101 end 102 end 103 104 if (cmp_obstacle_state("HF-Gate-inner", "opened")) and 105 (cmp_obstacle_state("HF-Gate-outer", "opened")) then 106 end 107 end, 108 }, 109 { 110 id = "node2", 111 text = _"open gate", 112 echo_text = false, 113 code = function() 114 Tux:says(_"open gate", "NO_WAIT") 115 Npc:says(_"Permission denied") 116 Tux:hurt(5) 117 Tux:heat(10) 118 Tux:update_quest("Open Sesame", "The server is secured, looks like I have to hack it.") 119 hide("node2") show("node3") 120 play_sound("effects/Menu_Item_Selected_Sound_1.ogg") 121 end_dialog() 122 end, 123 }, 124 { 125 id = "node3", 126 text = _"(Try hacking the server)", 127 code = function() 128 if (takeover(get_program("Hacking")+3)) then 129 Tux:says("sudo !!") 130 Npc:says("sudo open gates", "NO_WAIT") 131 Npc:says(_"Which gates do you want to open?") 132 Tux:update_quest("Open Sesame", "Whew, I finally managed to hack the gate access server. I can open the gates now.") 133 MO_HFGateAccessServer_hacked = true 134 hide("node3") show("node4") 135 else 136 Npc:says(_"Permission denied.") 137 Tux:heat(15) 138 Tux:hurt(10) 139 play_sound("effects/Menu_Item_Selected_Sound_1.ogg") 140 end_dialog() 141 end 142 end, 143 }, 144 { 145 id = "node4", 146 text = _"man open gates", 147 echo_text = false, 148 code = function() 149 Tux:says(_"man open gates", "NO_WAIT") 150 Npc:says(_"NAME", "NO_WAIT") 151 Npc:says(_" open gates -- opens gates via console", "NO_WAIT") 152 Npc:says(" ") 153 Npc:says(_"SYNOPSIS", "NO_WAIT") 154 Npc:says(_" open gates --inner --outer", "NO_WAIT") 155 Npc:says(_" ") 156 Npc:says(_"DESCRIPTION", "NO_WAIT") 157 Npc:says(_" Opens gates via console. Awesome, isn't it?", "NO_WAIT") 158 Npc:says(" ") 159 Npc:says(_"OPTIONS", "NO_WAIT") 160 Npc:says(_" --inner", "NO_WAIT") 161 Npc:says(_" Opens the inner gate.", "NO_WAIT") 162 Npc:says(" ", "NO_WAIT") 163 Npc:says(_" --outer", "NO_WAIT") 164 Npc:says(_" Opens the outer gate.", "NO_WAIT") 165 Npc:says(" ") 166 Npc:says(_"SEE ALSO", "NO_WAIT") 167 Npc:says(_" These are not the gates you are looking for.", "NO_WAIT") 168 Npc:says(" ") 169 Npc:says(_"AUTHOR", "NO_WAIT") 170 Npc:says(_" The Hell Fortress GateAccessServer Manual Writer", "NO_WAIT") 171 Npc:says(" ") 172 Npc:says(_" February 22, 1992") 173 hide("node4") show("node5", "node6", "node7") 174 end, 175 }, 176 { 177 id = "node5", 178 text = _"open gates --inner", 179 echo_text = false, 180 code = function() 181 Tux:says(_"open gates --inner", "NO_WAIT") 182 Npc:says(_"inner gate opened", "NO_WAIT") 183 Npc:says(_"[b]WARNING[/b]:", "NO_WAIT") 184 Npc:says(_"Anomalies detected!") 185 change_obstacle_state("HF-Gate-inner", "opened") 186 if (cmp_obstacle_state("HF-Gate-outer", "opened")) then 187 Tux:update_quest("Open Sesame", "I think I managed to open the gates to the Hell Fortress. But where can I find them?") 188 hide("node7") 189 end 190 hide("node5") 191 end, 192 }, 193 { 194 id = "node6", 195 text = _"open gates --outer", 196 echo_text = false, 197 code = function() 198 Tux:says(_"open gates --outer", "NO_WAIT") 199 Npc:says(_"outer gate opened", "NO_WAIT") 200 Npc:says(_"[b]WARNING[/b]:", "NO_WAIT") 201 Npc:says(_"Anomalies detected!") 202 change_obstacle_state("HF-Gate-outer", "opened") 203 if (cmp_obstacle_state("HF-Gate-inner", "opened")) then 204 Tux:update_quest("Open Sesame", "I think I managed to open the gates to Hell Fortress. But where can I find them?") 205 hide("node7") 206 end 207 hide("node6") 208 end, 209 }, 210 { 211 id = "node7", 212 text = _"open gates --inner --outer", 213 echo_text = false, 214 code = function() 215 Tux:says(_"open gates --inner --outer", "NO_WAIT") 216 Npc:says(_"inner gate opened", "NO_WAIT") 217 Npc:says(_"outer gate opened", "NO_WAIT") 218 Npc:says(_"[b]WARNING[/b]:", "NO_WAIT") 219 Npc:says(_"Anomalies detected!") 220 change_obstacle_state("HF-Gate-inner", "opened") 221 change_obstacle_state("HF-Gate-outer", "opened") 222 Tux:update_quest("Open Sesame", "I think I managed to open the gates to Hell Fortress. But where can I find them?") 223 hide("node5", "node6", "node7") 224 end, 225 }, 226 { 227 id = "node99", 228 text = _"logout", 229 echo_text = false, 230 code = function() 231 Tux:says(_"logout") 232 Npc:says(_"exiting...") 233 play_sound("effects/Menu_Item_Selected_Sound_1.ogg") 234 end_dialog() 235 end, 236 }, 237} 238