| 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 |
local hacking_level = get_program("Hacking") |
| 23 |
|
| 24 |
return { |
| 25 |
EveryTime = function() |
| 26 |
play_sound("effects/Menu_Item_Deselected_Sound_0.ogg") |
| 27 |
Act2BotFactory_prompt = "[email protected]: ~ #" |
| 28 |
|
| 29 |
if (not Tux:has_item("Arcane Lore")) then |
| 30 |
cli_says(_"Connection refused. ", "NO_WAIT") |
| 31 |
Npc:says(_"Terminal #1979 is immune to hack attempts. Or so says the lore.") -- RR 1979 is ACT2 Review Request on Review Board... |
| 32 |
end_dialog() |
| 33 |
else |
| 34 |
Npc:says(_"[b]Arcane Lore[/b] - I've bought an anti-hack software, so I could try to hack it!", "NO_WAIT") |
| 35 |
Npc:says(_"[b]User tux created.[/b] Enjoy!", "NO_WAIT") |
| 36 |
Npc:says("") |
| 37 |
cli_says(_"Login : ", "NO_WAIT") |
| 38 |
--; TRANSLATORS: username, maybe this should stay in lowercase letters? |
| 39 |
Tux:says(_"tux", "NO_WAIT") |
| 40 |
cli_says(_"Entering as tux", "NO_WAIT") |
| 41 |
Npc:says("", "NO_WAIT") |
| 42 |
|
| 43 |
if (cmp_obstacle_state("Act2BotFactory", "closed")) then |
| 44 |
Npc:says(_"R&R Factory gate status: CLOSED", "NO_WAIT") |
| 45 |
show("node0") |
| 46 |
elseif (cmp_obstacle_state("Act2BotFactory", "opened")) then |
| 47 |
Npc:says(_"R&R Factory gate status: OPEN", "NO_WAIT") |
| 48 |
show("node10") |
| 49 |
else |
| 50 |
Npc:says("GAME BUG. PLEASE REPORT, RRGATE_TERMINAL EveryTime LuaCode") |
| 51 |
end |
| 52 |
cli_says(Act2BotFactory_prompt, "NO_WAIT") |
| 53 |
if (hacking_level < 9) then |
| 54 |
show("node20") hide("node21") |
| 55 |
end |
| 56 |
show("node99") |
| 57 |
end |
| 58 |
end, |
| 59 |
|
| 60 |
{ |
| 61 |
id = "node0", |
| 62 |
--; TRANSLATORS: command, use lowercase here |
| 63 |
text = _"open gate", |
| 64 |
echo_text = false, |
| 65 |
code = function() |
| 66 |
--; TRANSLATORS: command, use lowercase here |
| 67 |
Tux:says(_"open gate", "NO_WAIT") |
| 68 |
|
| 69 |
-- Note: This captcha is different from the previous ones |
| 70 |
number_one=math.random(2,5) |
| 71 |
number_two=math.random(1,number_one-1) |
| 72 |
captcha = number_one + number_two |
| 73 |
|
| 74 |
-- Convert number_one and number_two to text |
| 75 |
-- This could be optimized but that can be done after r17 RC 1 |
| 76 |
if (number_one == 1) then |
| 77 |
number_one = _"one" |
| 78 |
elseif (number_one == 2) then |
| 79 |
number_one = _"two" |
| 80 |
elseif (number_one == 3) then |
| 81 |
number_one = _"three" |
| 82 |
elseif (number_one == 4) then |
| 83 |
number_one = _"four" |
| 84 |
elseif (number_one == 5) then |
| 85 |
number_one = _"five" |
| 86 |
end |
| 87 |
|
| 88 |
if (number_two == 1) then |
| 89 |
number_two = _"one" |
| 90 |
elseif (number_two == 2) then |
| 91 |
number_two = _"two" |
| 92 |
elseif (number_two == 3) then |
| 93 |
number_two = _"three" |
| 94 |
elseif (number_two == 4) then |
| 95 |
number_two = _"four" |
| 96 |
elseif (number_two == 5) then |
| 97 |
number_two = _"five" |
| 98 |
end |
| 99 |
|
| 100 |
-- Just to be sure there won't be str/int problems |
| 101 |
if (captcha == 3) then |
| 102 |
captcha = "3" |
| 103 |
elseif (captcha == 4) then |
| 104 |
captcha = "4" |
| 105 |
elseif (captcha == 5) then |
| 106 |
captcha = "5" |
| 107 |
elseif (captcha == 6) then |
| 108 |
captcha = "6" |
| 109 |
elseif (captcha == 7) then |
| 110 |
captcha = "7" |
| 111 |
elseif (captcha == 8) then |
| 112 |
captcha = "8" |
| 113 |
elseif (captcha == 9) then |
| 114 |
captcha = "9" |
| 115 |
end |
| 116 |
|
| 117 |
local response = user_input_string(string.format(_"CAPTCHA: Please write the number that answers the following: %s + %s = ?", number_one, number_two)) |
| 118 |
if (captcha ~= response) then |
| 119 |
Npc:says(_"Access Denied. Electrical discharge in progress.") |
| 120 |
Npc:says(_"NOTE: If you are a human, try again, and make sure you enter digits and not a word.") |
| 121 |
freeze_tux_npc(2) |
| 122 |
Tux:hurt(30) |
| 123 |
Tux:heat(60) |
| 124 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 125 |
end_dialog() |
| 126 |
else |
| 127 |
Npc:says(_"Access granted. Opening gate ...") |
| 128 |
Npc:says(_"Gate status: OPEN") |
| 129 |
change_obstacle_state("Act2BotFactory", "opened") |
| 130 |
cli_says(Act2BotFactory_prompt, "NO_WAIT") |
| 131 |
hide("node0") show("node10") |
| 132 |
end |
| 133 |
end, |
| 134 |
}, |
| 135 |
{ |
| 136 |
id = "node10", |
| 137 |
--; TRANSLATORS: command, use lowercase here |
| 138 |
text = _"close gate", |
| 139 |
echo_text = false, |
| 140 |
code = function() |
| 141 |
--; TRANSLATORS: command, use lowercase here |
| 142 |
Tux:says(_"close gate", "NO_WAIT") |
| 143 |
Npc:says(_"Access granted. Closing gate ...") |
| 144 |
Npc:says(_"Gate status: CLOSED") |
| 145 |
change_obstacle_state("Act2BotFactory", "closed") |
| 146 |
cli_says(Act2BotFactory_prompt, "NO_WAIT") |
| 147 |
hide("node10") show("node0") |
| 148 |
end, |
| 149 |
}, |
| 150 |
{ |
| 151 |
id = "node20", |
| 152 |
--; TRANSLATORS: command, use lowercase here |
| 153 |
text = _"download hacking tools", |
| 154 |
echo_text = false, |
| 155 |
code = function() |
| 156 |
Tux:says(_"download hacking tools", "NO_WAIT") |
| 157 |
local hacking_level = get_program("Hacking") |
| 158 |
if (hacking_level > 8) then |
| 159 |
Npc:says(_"The max available software revision is 9.") |
| 160 |
Npc:says(_"Your hacking skill already has or exceeds this level.") |
| 161 |
else |
| 162 |
Npc:says(_"This is commercial software, payment required (3000 circuits).") |
| 163 |
Npc:says(_"You will also need %d training points.", get_program("Hacking") * 2) |
| 164 |
Npc:says(_"Proceed?") |
| 165 |
show("node21") |
| 166 |
end |
| 167 |
hide("node20") |
| 168 |
end, |
| 169 |
}, |
| 170 |
{ |
| 171 |
id = "node21", |
| 172 |
text = _"sudo apt-get install hacking-tools", |
| 173 |
code = function() |
| 174 |
-- this is output of apt-get on debian/ubuntu |
| 175 |
Npc:says(_"Reading package lists... Done", "NO_WAIT") |
| 176 |
Npc:says(_"Building dependency tree", "NO_WAIT") |
| 177 |
Npc:says(_"Reading state information... Done", "NO_WAIT") |
| 178 |
-- orig "The following NEW packages will be installed:" |
| 179 |
Npc:says(_"The following skill will be installed:") |
| 180 |
Npc:says(_"'Hacking' program revision %d.", get_program("Hacking") + 1) |
| 181 |
Npc:says("", "NO_WAIT") |
| 182 |
|
| 183 |
if (Tux:train_program(3000, get_program("Hacking") * 2, "Hacking")) then |
| 184 |
Npc:says(_"Feature set of the hacking program has been improved successfully.") |
| 185 |
else |
| 186 |
if (Tux:get_gold() < 3000) then |
| 187 |
next("node25") |
| 188 |
else |
| 189 |
next("node26") |
| 190 |
end |
| 191 |
end |
| 192 |
hide("node21") show("node20") |
| 193 |
end, |
| 194 |
}, |
| 195 |
{ |
| 196 |
id = "node25", |
| 197 |
code = function() |
| 198 |
Npc:says_random(_"Payment bounced. Insufficient credits.") |
| 199 |
end, |
| 200 |
}, |
| 201 |
{ |
| 202 |
id = "node26", |
| 203 |
code = function() |
| 204 |
Npc:says_random(_"Out of Memory. More Experience is needed to run this program.") |
| 205 |
end, |
| 206 |
}, |
| 207 |
{ |
| 208 |
id = "node99", |
| 209 |
--; TRANSLATORS: command, use lowercase here |
| 210 |
text = _"logout", |
| 211 |
echo_text = false, |
| 212 |
code = function() |
| 213 |
--; TRANSLATORS: command, use lowercase here |
| 214 |
Tux:says(_"logout", "NO_WAIT") |
| 215 |
Npc:says(_"Exiting...") |
| 216 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 217 |
end_dialog() |
| 218 |
end, |
| 219 |
}, |
| 220 |
} |