| 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 |
|
| 20 |
local Npc = FDrpg.get_npc() |
| 21 |
local Tux = FDrpg.get_tux() |
| 22 |
|
| 23 |
return { |
| 24 |
EveryTime = function() |
| 25 |
local response = nil |
| 26 |
play_sound("effects/Menu_Item_Deselected_Sound_0.ogg") --@TODO check that the captcha works |
| 27 |
-- < 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. |
| 28 |
if (not MO_HFGateAccessServer_skip_captcha) then |
| 29 |
-- Are we human? CAPTCHA!!! |
| 30 |
number_one=math.random(2,7) |
| 31 |
number_two=math.random(1,number_one-1) |
| 32 |
captcha = number_one - number_two |
| 33 |
-- Convert number_one and number_two to text |
| 34 |
-- This could be optimized but that can be done after r17 RC 1 |
| 35 |
if (number_one == 1) then |
| 36 |
number_one = _"one" |
| 37 |
elseif (number_one == 2) then |
| 38 |
number_one = _"two" |
| 39 |
elseif (number_one == 3) then |
| 40 |
number_one = _"three" |
| 41 |
elseif (number_one == 4) then |
| 42 |
number_one = _"four" |
| 43 |
elseif (number_one == 5) then |
| 44 |
number_one = _"five" |
| 45 |
elseif (number_one == 6) then |
| 46 |
number_one = _"six" |
| 47 |
elseif (number_one == 7) then |
| 48 |
number_one = _"seven" |
| 49 |
end |
| 50 |
|
| 51 |
if (number_two == 1) then |
| 52 |
number_two = _"one" |
| 53 |
elseif (number_two == 2) then |
| 54 |
number_two = _"two" |
| 55 |
elseif (number_two == 3) then |
| 56 |
number_two = _"three" |
| 57 |
elseif (number_two == 4) then |
| 58 |
number_two = _"four" |
| 59 |
elseif (number_two == 5) then |
| 60 |
number_two = _"five" |
| 61 |
elseif (number_two == 6) then |
| 62 |
number_two = _"six" |
| 63 |
elseif (number_two == 7) then |
| 64 |
number_two = _"seven" |
| 65 |
end |
| 66 |
|
| 67 |
-- Just to be sure there won't be str/int problems |
| 68 |
if (captcha == 1) then |
| 69 |
captcha = "1" |
| 70 |
elseif (captcha == 2) then |
| 71 |
captcha = "2" |
| 72 |
elseif (captcha == 3) then |
| 73 |
captcha = "3" |
| 74 |
elseif (captcha == 4) then |
| 75 |
captcha = "4" |
| 76 |
elseif (captcha == 5) then |
| 77 |
captcha = "5" |
| 78 |
elseif (captcha == 6) then |
| 79 |
captcha = "6" |
| 80 |
end |
| 81 |
response = user_input_string(string.format(_"CAPTCHA: Please write the number that answers the following: %s - %s = ?", number_one, number_two)) |
| 82 |
else |
| 83 |
MO_HFGateAccessServer_skip_captcha = false |
| 84 |
end |
| 85 |
if (captcha ~= response) then |
| 86 |
Npc:says(_"Non-human detected. Administering paralyzing shock.") |
| 87 |
Npc:says(_"NOTE: If you are a human, try again, and make sure you enter digits and not a word.") |
| 88 |
freeze_tux_npc(7) |
| 89 |
Tux:hurt(20) |
| 90 |
Tux:heat(20) |
| 91 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 92 |
end_dialog() |
| 93 |
else |
| 94 |
Npc:says(_"Welcome to MS gate access server for region #54648.") |
| 95 |
if (not MO_HFGateAccessServer_Spencer_chat) then |
| 96 |
Tux:says(_"WHAT?!") |
| 97 |
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?") |
| 98 |
MO_HFGateAccessServer_Spencer = true |
| 99 |
MO_HFGateAccessServer_Spencer_chat = true |
| 100 |
MO_HFGateAccessServer_skip_captcha = true |
| 101 |
start_chat("Spencer") |
| 102 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 103 |
end_dialog() |
| 104 |
end |
| 105 |
if (MO_HFGateAccessServer_Spencer) then |
| 106 |
MO_HFGateAccessServer_Spencer = false |
| 107 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 108 |
end_dialog() |
| 109 |
else |
| 110 |
Npc:says(_"Please select action") |
| 111 |
end |
| 112 |
show("node1", "node99") |
| 113 |
end |
| 114 |
end, |
| 115 |
|
| 116 |
{ |
| 117 |
id = "node1", |
| 118 |
text = _"status", |
| 119 |
echo_text = false, |
| 120 |
code = function() |
| 121 |
Tux:says(_"status", "NO_WAIT") |
| 122 |
if (cmp_obstacle_state("HF-Gate-outer", "opened")) then |
| 123 |
Npc:says(_"Gate 1 status: OPENED", "NO_WAIT") |
| 124 |
else |
| 125 |
Npc:says(_"Gate 1 status: CLOSED", "NO_WAIT") |
| 126 |
if (not MO_HFGateAccessServer_hacked) then |
| 127 |
show("node2") |
| 128 |
end |
| 129 |
end |
| 130 |
|
| 131 |
if (cmp_obstacle_state("HF-Gate-inner", "opened")) then |
| 132 |
Npc:says(_"Gate 2 status: OPENED", "NO_WAIT") |
| 133 |
else |
| 134 |
Npc:says(_"Gate 2 status: CLOSED", "NO_WAIT") |
| 135 |
if (not MO_HFGateAccessServer_hacked) then |
| 136 |
show("node2") |
| 137 |
end |
| 138 |
end |
| 139 |
|
| 140 |
if (cmp_obstacle_state("HF-Gate-inner", "opened")) and |
| 141 |
(cmp_obstacle_state("HF-Gate-outer", "opened")) then |
| 142 |
end |
| 143 |
end, |
| 144 |
}, |
| 145 |
{ |
| 146 |
id = "node2", |
| 147 |
text = _"open gate", |
| 148 |
echo_text = false, |
| 149 |
code = function() |
| 150 |
Tux:says(_"open gate", "NO_WAIT") |
| 151 |
Npc:says(_"Permission denied") |
| 152 |
Tux:hurt(5) |
| 153 |
Tux:heat(10) |
| 154 |
display_console_message("The server is secured, looks like I have to hack it.") |
| 155 |
hide("node2") show("node3") |
| 156 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 157 |
end_dialog() |
| 158 |
end, |
| 159 |
}, |
| 160 |
{ |
| 161 |
id = "node3", |
| 162 |
text = _"(Try hacking the server)", |
| 163 |
code = function() |
| 164 |
if (takeover(get_program("Hacking")+3)) then |
| 165 |
Tux:says("sudo open_gates") |
| 166 |
--; TRANSLATORS: this is parody of Microsoft Windows' error message; |
| 167 |
--; "sudo" verbatim |
| 168 |
Npc:says(_"'sudo' is not recognized as an internal or external command, operable program or batch file.") |
| 169 |
Tux:says(_"Oh, of course.", "NO_WAIT") |
| 170 |
Tux:says(_"Now, let me see if I can remember this correctly ...") |
| 171 |
--; TRANSLATORS: parody of Microsoft Windows' runas command; |
| 172 |
--; "RUNAS" and "OPENGATE.EXE" verbatim |
| 173 |
Tux:says(_"RUNAS /user:Administrator OPENGATE.EXE", "NO_WAIT") |
| 174 |
Npc:says(_"Which gates do you want to open?") |
| 175 |
Tux:update_quest("Open Sesame", "Whew, I finally managed to hack the gate access server. I can open the gates now.") |
| 176 |
MO_HFGateAccessServer_hacked = true |
| 177 |
hide("node3") show("node4") |
| 178 |
else |
| 179 |
Npc:says(_"Permission denied.") |
| 180 |
Tux:heat(15) |
| 181 |
Tux:hurt(10) |
| 182 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 183 |
end_dialog() |
| 184 |
end |
| 185 |
end, |
| 186 |
}, |
| 187 |
{ |
| 188 |
id = "node4", |
| 189 |
text = "OPENGATE.EXE /?", |
| 190 |
echo_text = false, |
| 191 |
code = function() |
| 192 |
--; TRANSLATORS: this block is parody of Microsoft Windows' format for documentation internal to a command |
| 193 |
Tux:says("OPENGATE.EXE /?", "NO_WAIT") |
| 194 |
Npc:says(_"Opens gates via command prompt on a console.", "NO_WAIT") |
| 195 |
Npc:says(" ") |
| 196 |
--; TRANSLATORS: "OPENGATE" verbatim |
| 197 |
Npc:says(_"OPENGATE [inner] [outer]", "NO_WAIT") |
| 198 |
Npc:says(" ") |
| 199 |
Npc:says(_" inner Opens the inner gate.", "NO_WAIT") |
| 200 |
Npc:says(_" outer Opens the outer gate.", "NO_WAIT") |
| 201 |
Npc:says(" ") |
| 202 |
Npc:says(_"Without parameters, OPENGATE will prompt you with a helpful query.", "NO_WAIT") |
| 203 |
Npc:says(_"To secure the gates, use SHUTGATE.", "NO_WAIT") |
| 204 |
Npc:says(_"Press any key to continue . . .") |
| 205 |
Npc:says(" ") |
| 206 |
Npc:says(_"Take note: These are not the gates you are looking for.", "NO_WAIT") |
| 207 |
Npc:says(_"Version: 9.13.1665.0 Aug 11, 1998") |
| 208 |
-- NOTE the text "FreedroidRPG" encoded in US-ASCII and then those decimal values summed is equal to 1665 |
| 209 |
hide("node4") show("node5", "node6", "node7") |
| 210 |
end, |
| 211 |
}, |
| 212 |
{ |
| 213 |
id = "node5", |
| 214 |
--; TRANSLATORS: "OPENGATE" verbatim |
| 215 |
text = _"OPENGATE inner", |
| 216 |
echo_text = false, |
| 217 |
code = function() |
| 218 |
--; TRANSLATORS: "OPENGATE" verbatim |
| 219 |
Tux:says(_"OPENGATE inner", "NO_WAIT") |
| 220 |
Npc:says(_"inner gate opened", "NO_WAIT") |
| 221 |
Npc:says(_"[b]WARNING[/b]:", "NO_WAIT") |
| 222 |
Npc:says(_"Anomalies detected!") |
| 223 |
change_obstacle_state("HF-Gate-inner", "opened") |
| 224 |
if (cmp_obstacle_state("HF-Gate-outer", "opened")) then |
| 225 |
Tux:update_quest("Open Sesame", "I think I managed to open the gates to the Hell Fortress. But where can I find them?") |
| 226 |
hide("node7") |
| 227 |
end |
| 228 |
hide("node5") |
| 229 |
end, |
| 230 |
}, |
| 231 |
{ |
| 232 |
id = "node6", |
| 233 |
--; TRANSLATORS: "OPENGATE" verbatim |
| 234 |
text = _"OPENGATE outer", |
| 235 |
echo_text = false, |
| 236 |
code = function() |
| 237 |
--; TRANSLATORS: "OPENGATE" verbatim |
| 238 |
Tux:says(_"OPENGATE outer", "NO_WAIT") |
| 239 |
Npc:says(_"outer gate opened", "NO_WAIT") |
| 240 |
Npc:says(_"[b]WARNING[/b]:", "NO_WAIT") |
| 241 |
Npc:says(_"Anomalies detected!") |
| 242 |
change_obstacle_state("HF-Gate-outer", "opened") |
| 243 |
if (cmp_obstacle_state("HF-Gate-inner", "opened")) then |
| 244 |
Tux:update_quest("Open Sesame", "I think I managed to open the gates to Hell Fortress. But where can I find them?") |
| 245 |
hide("node7") |
| 246 |
end |
| 247 |
hide("node6") |
| 248 |
end, |
| 249 |
}, |
| 250 |
{ |
| 251 |
id = "node7", |
| 252 |
--; TRANSLATORS: "OPENGATE" verbatim |
| 253 |
text = _"OPENGATE inner outer", |
| 254 |
echo_text = false, |
| 255 |
code = function() |
| 256 |
--; TRANSLATORS: "OPENGATE" verbatim |
| 257 |
Tux:says(_"OPENGATE inner outer", "NO_WAIT") |
| 258 |
Npc:says(_"inner gate opened", "NO_WAIT") |
| 259 |
Npc:says(_"outer gate opened", "NO_WAIT") |
| 260 |
Npc:says(_"[b]WARNING[/b]:", "NO_WAIT") |
| 261 |
Npc:says(_"Anomalies detected!") |
| 262 |
change_obstacle_state("HF-Gate-inner", "opened") |
| 263 |
change_obstacle_state("HF-Gate-outer", "opened") |
| 264 |
Tux:update_quest("Open Sesame", "I think I managed to open the gates to Hell Fortress. But where can I find them?") |
| 265 |
hide("node5", "node6", "node7") |
| 266 |
end, |
| 267 |
}, |
| 268 |
{ |
| 269 |
id = "node99", |
| 270 |
text = _"logout", |
| 271 |
echo_text = false, |
| 272 |
code = function() |
| 273 |
Tux:says(_"logout") |
| 274 |
Npc:says(_"exiting...") |
| 275 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 276 |
end_dialog() |
| 277 |
end, |
| 278 |
}, |
| 279 |
} |