| 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 |
if (not HF_FirmwareUpdateServer_uploaded_faulty_firmware_update) then |
| 26 |
play_sound("effects/Menu_Item_Deselected_Sound_0.ogg") |
| 27 |
-- Are we human? CAPTCHA!!! |
| 28 |
number_one=math.random(2,7) |
| 29 |
number_two=math.random(1,number_one-1) |
| 30 |
captcha = number_one - number_two |
| 31 |
|
| 32 |
-- Convert number_one and number_two to text |
| 33 |
-- This could be optimized but that can be done after r17 RC 1 |
| 34 |
if (number_one == 1) then |
| 35 |
number_one = _"one" |
| 36 |
elseif (number_one == 2) then |
| 37 |
number_one = _"two" |
| 38 |
elseif (number_one == 3) then |
| 39 |
number_one = _"three" |
| 40 |
elseif (number_one == 4) then |
| 41 |
number_one = _"four" |
| 42 |
elseif (number_one == 5) then |
| 43 |
number_one = _"five" |
| 44 |
elseif (number_one == 6) then |
| 45 |
number_one = _"six" |
| 46 |
elseif (number_one == 7) then |
| 47 |
number_one = _"seven" |
| 48 |
end |
| 49 |
|
| 50 |
if (number_two == 1) then |
| 51 |
number_two = _"one" |
| 52 |
elseif (number_two == 2) then |
| 53 |
number_two = _"two" |
| 54 |
elseif (number_two == 3) then |
| 55 |
number_two = _"three" |
| 56 |
elseif (number_two == 4) then |
| 57 |
number_two = _"four" |
| 58 |
elseif (number_two == 5) then |
| 59 |
number_two = _"five" |
| 60 |
elseif (number_two == 6) then |
| 61 |
number_two = _"six" |
| 62 |
elseif (number_two == 7) then |
| 63 |
number_two = _"seven" |
| 64 |
end |
| 65 |
|
| 66 |
-- Just to be sure there won't be str/int problems |
| 67 |
if (captcha == 1) then |
| 68 |
captcha = "1" |
| 69 |
elseif (captcha == 2) then |
| 70 |
captcha = "2" |
| 71 |
elseif (captcha == 3) then |
| 72 |
captcha = "3" |
| 73 |
elseif (captcha == 4) then |
| 74 |
captcha = "4" |
| 75 |
elseif (captcha == 5) then |
| 76 |
captcha = "5" |
| 77 |
elseif (captcha == 6) then |
| 78 |
captcha = "6" |
| 79 |
end |
| 80 |
|
| 81 |
local response = user_input_string(string.format(_"CAPTCHA: Please write the number that answers the following: %s - %s = ?", number_one, number_two)) |
| 82 |
if (captcha ~= response) then |
| 83 |
Npc:says(_"Non-human detected. Administering paralyzing shock.") |
| 84 |
Npc:says(_"NOTE: If you are a human, try again, and make sure you enter digits and not a word.") |
| 85 |
freeze_tux_npc(7) |
| 86 |
Tux:hurt(20) |
| 87 |
Tux:heat(20) |
| 88 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 89 |
end_dialog() |
| 90 |
else |
| 91 |
Npc:says(_"Welcome to MS firmware update server for region #54658.") |
| 92 |
Npc:says(_"Please select action") |
| 93 |
show("node1", "node3", "node99") |
| 94 |
end |
| 95 |
end |
| 96 |
end, |
| 97 |
|
| 98 |
{ |
| 99 |
id = "node1", |
| 100 |
text = _"Get current OS version", |
| 101 |
code = function() |
| 102 |
if (not HF_FirmwareUpdateServer_uploaded_faulty_firmware_update) then |
| 103 |
Npc:says(_"Currently deployed firmware is v. 5.0.8+worldto-nogpl.") |
| 104 |
else |
| 105 |
--; TRANSLATORS: %s in %swashere = Tux:get_player_name() |
| 106 |
Npc:says(_"Currently deployed firmware is v. 5.0.8+%swashere+gpl", Tux:get_player_name()) |
| 107 |
if (not HF_FirmwareUpdateServer_Spencer) then |
| 108 |
--; TRANSLATORS: "hello?" |
| 109 |
Npc:says(_"*Bzzt*ello?") |
| 110 |
Tux:says(_"What? What is this?") |
| 111 |
start_chat("Spencer") |
| 112 |
Tux:update_quest("Propagating a faulty firmware update", _"Spencer somehow contacted me through the firmware server terminal. From what he told me, it worked - the hostile bots are all deactivated! I am now supposed to stand by for further instructions...") |
| 113 |
HF_FirmwareUpdateServer_Spencer = true |
| 114 |
end |
| 115 |
end |
| 116 |
end, |
| 117 |
}, |
| 118 |
{ |
| 119 |
id = "node3", |
| 120 |
text = _"Propagate firmware update", |
| 121 |
code = function() |
| 122 |
Npc:says(_"Compressing image....") |
| 123 |
Npc:says(_"Advertising update to clients...") |
| 124 |
Npc:says(_"Waiting for all connections....") |
| 125 |
Npc:says(_"...") |
| 126 |
Npc:says(_"...") |
| 127 |
Npc:says(_"Please resolve merge conflicts:") |
| 128 |
if (takeover(get_program("Hacking")+4)) then |
| 129 |
Npc:says(_"Conflicts resolved,") |
| 130 |
Npc:says(_"Firmware update propagated!") |
| 131 |
Npc:says(_"ALL: SECURITY: could not find 'evil.conf': No such file or directory.", "NO_WAIT") |
| 132 |
Npc:says(_" Exiting with state 1.") |
| 133 |
HF_FirmwareUpdateServer_uploaded_faulty_firmware_update = true |
| 134 |
change_obstacle_state("ServerRoomDoor", "closed") |
| 135 |
Tux:update_quest("Propagating a faulty firmware update", _"I managed to upload the faulty firmware update to all bots within transmission range. Either the siege on the town ends now... Or everything else does.") |
| 136 |
kill_faction("ms", "no_respawn") |
| 137 |
-- Disable HF Office traps |
| 138 |
local i=0 |
| 139 |
while (i <= 363) do -- This is a little hardcoded/hack-ish but will do |
| 140 |
disable_event_trigger("59_trap_" .. i) |
| 141 |
i=i+1 |
| 142 |
end |
| 143 |
|
| 144 |
hide("node3") |
| 145 |
else |
| 146 |
Npc:says(_"Merge failed.") |
| 147 |
Npc:says(_"Exiting...") |
| 148 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 149 |
end_dialog() |
| 150 |
end |
| 151 |
end, |
| 152 |
}, |
| 153 |
{ |
| 154 |
id = "node99", |
| 155 |
text = _"Logout", |
| 156 |
code = function() |
| 157 |
play_sound("effects/Menu_Item_Selected_Sound_1.ogg") |
| 158 |
end_dialog() |
| 159 |
if (HF_FirmwareUpdateServer_Spencer) and (not HF_Spencer_teleported) then |
| 160 |
change_obstacle_type("59-Teleporter", 19) --Prime the teleporter! |
| 161 |
add_obstacle(59, 57.6, 29.5, 16) |
| 162 |
play_sound("effects/new_teleporter_sound.ogg") |
| 163 |
-- We would like the teleportation to be a little delayed for effect. |
| 164 |
Spencer:teleport("59-Teleporter-1") |
| 165 |
Spencer:set_destination("59-Teleporter-1") |
| 166 |
dispatch_event("59 Bender Teleport", 2) |
| 167 |
dispatch_event("59 Guard Teleport", 4) |
| 168 |
HF_Spencer_teleported = true |
| 169 |
end |
| 170 |
end, |
| 171 |
}, |
| 172 |
} |