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")
26		-- name = Tux:get_player_name() -- We need to generate the option text of option 0 to use this properly
27		if (c_net_terminals_disabled) then
28			Npc:says(" . ")
29			end_dialog()
30		else
31			Npc:says(_"Welcome to the Community Network.", "NO_WAIT")
32			cli_says(_"Login : ", "NO_WAIT")
33			if (knows_c_net_users) then
34				show("node1", "node2", "node3")
35			end
36			show("node0", "node99")
37		end
38		hide("node10", "node11", "node12", "node13", "node14", "node15", "node16", "node20", "node21", "node23", "node24", "node30", "node31", "node80", "node81", "node82", "node83", "node85", "node86")
39	end,
40
41	------------------------------
42	-- c-net-nethack_sub
43	--
44	{
45		topic = "c-net-nethack_sub",
46		generator = include("c-net-nethack_sub"),
47	},
48	--
49	------------------------------
50
51	{
52		id = "node0",
53		--; TRANSLATORS: use lowercase for translation
54		text = _"guest",
55		echo_text = false,
56		code = function()
57			c_net_username = Tux:get_player_name()
58			c_net_prompt = c_net_username .. "@c-net:~$"
59				--; TRANSLATORS: use lowercase for translation
60			Tux:says(_"guest", "NO_WAIT")
61			if (not c_net_terminal_logged_in) then
62				c_net_terminal_logged_in = true
63				Npc:says(_"First time login detected.")
64				Npc:says(_"Please enter your name", "NO_WAIT")
65				cli_says(_"Name : ", "NO_WAIT")
66				Tux:says(c_net_username)
67				--; TRANSLATORS: %s = c_net_username
68				Npc:says(_"Please set password for your personalized guest login, %s", c_net_username, "NO_WAIT")
69				Npc:says(_"Use at least one lower case letter, one upper case letter, one number, and one symbol.", "NO_WAIT")
70				cli_says(_"Password : ", "NO_WAIT")
71				Tux:says(_"******")
72			else
73				cli_says(_"Name : ", "NO_WAIT")
74				Tux:says(c_net_username, "NO_WAIT")
75				cli_says(_"Password : ", "NO_WAIT")
76				Tux:says(_"******", "NO_WAIT")
77			end
78			Npc:says(_"Last login from /dev/tty3 on unknown", "NO_WAIT")
79			cli_says(c_net_prompt, "NO_WAIT")
80			show("node10", "node20", "node30", "node80", "node99") hide("node0", "node1", "node2", "node3")
81		end,
82	},
83	{
84		id = "node1",
85		text = "root",
86		echo_text = false,
87		code = function()
88			Tux:says("root", "NO_WAIT")
89			cli_says(_"Password : ", "NO_WAIT")
90			Tux:says("******")
91			--if (not knows_root_password) then
92			next("node9")
93			--else
94			-- c_net_username = "root"
95			-- c_net_prompt = c_net_username .. "@c-net:~$"
96			-- Npc:says(_"Last login from /dev/tty3 on unknown" , "NO_WAIT")
97			-- cli_says(c_net_prompt, "NO_WAIT")
98			-- show("node10", "node20", "node30", "node80", "node99") hide("node0", "node1", "node2", "node3")
99			--end
100		end,
101	},
102	{
103		id = "node2",
104		text = "lily",
105		echo_text = false,
106		code = function()
107			Tux:says("lily", "NO_WAIT")
108			cli_says(_"Password : ", "NO_WAIT")
109			Tux:says("******")
110			if (not know_lily_password) then
111				next("node9")
112			else
113				c_net_username = "lily"
114				c_net_prompt = c_net_username .. "@c-net:~$"
115				Npc:says(_"Last login from /dev/tty3 on unknown" , "NO_WAIT")
116				cli_says(c_net_prompt, "NO_WAIT")
117				show("node10", "node20", "node30", "node80", "node99") hide("node0", "node1", "node2", "node3")
118			end
119		end,
120	},
121	{
122		id = "node3",
123		text = "cpain",
124		echo_text = false,
125		code = function()
126			Tux:says("cpain", "NO_WAIT")
127			cli_says(_"Password: ", "NO_WAIT")
128			--if (not knows_sorenson_password) then
129			Tux:says("******")
130			next("node9")
131			--else
132			-- Tux:says("************************************")
133			-- c_net_username = "cpain"
134			-- c_net_prompt = c_net_username .. "@c-net:~$"
135			-- Npc:says(_"Last login from /dev/tty3 on unknown" , "NO_WAIT")
136			-- cli_says(c_net_prompt, "NO_WAIT")
137			-- show("node10", "node20", "node30", "node80", "node99") hide("node0", "node1", "node2", "node3")
138			--end
139		end,
140	},
141	{
142		id = "node9",
143		code = function()
144			Npc:says(_"Login incorrect", "NO_WAIT")
145			Npc:says(_"Connection to c-net terminated.")
146			play_sound("effects/Menu_Item_Selected_Sound_1.ogg")
147			end_dialog()
148		end,
149	},
150	{
151		-- ../ date finger users whoami
152		id = "node10",
153		text = "cd info_commands/",
154		echo_text = false,
155		code = function()
156			c_net_prompt = c_net_username .. "@c-net:~/info_commands$"
157			Npc:says(" ", "NO_WAIT")
158			cli_says(c_net_prompt, "NO_WAIT")
159			show("node11", "node12", "node13", "node14", "node15", "node16") hide("node10", "node20", "node30", "node80", "node99")
160		end,
161	},
162	{
163		id = "node11",
164		text = "cd ../",
165		echo_text = false,
166		code = function()
167			c_net_prompt = c_net_username .. "@c-net:~$"
168			Npc:says(" ", "NO_WAIT")
169			cli_says(c_net_prompt, "NO_WAIT")
170			show("node10", "node20", "node30", "node80", "node99") hide("node11", "node12", "node13", "node14", "node15", "node16")
171		end,
172	},
173	{
174		id = "node12",
175		text = "date",
176		echo_text = false,
177		code = function()
178			Tux:says("date", "NO_WAIT")
179			local day, hour, minute = game_date()
180			--; TRANSLATORS: It shows the ingame date in format: Day day, hour:minute
181			Npc:says(_"Day %d, %02d:%02d", day, hour, minute, "NO_WAIT")
182			cli_says(c_net_prompt, "NO_WAIT")
183		end,
184	},
185	{
186		id = "node13",
187		text = "finger",
188		echo_text = false,
189		code = function()
190			Tux:says("finger", "NO_WAIT")
191			knows_c_net_users = true
192			--; TRANSLATORS: this reperesents the head of a table
193			Npc:says(_"Login Tty Name", "NO_WAIT")
194			Npc:says("bossman tty7 Spencer", "NO_WAIT")
195			Npc:says("cpain tty5 Sorenson", "NO_WAIT")
196			--; TRANSLATORS: %s=Tux:get_player_name()
197			Npc:says("guest tty3 %s ", Tux:get_player_name(), "NO_WAIT")
198			Npc:says("lily tty2 Lily Stone", "NO_WAIT")
199			cli_says(c_net_prompt, "NO_WAIT")
200		end,
201	},
202	{
203		id = "node14",
204		text = "users",
205		echo_text = false,
206		code = function()
207			Tux:says("users", "NO_WAIT")
208			Npc:says("bossman cpain guest lily", "NO_WAIT")
209			knows_c_net_users = true
210			cli_says(c_net_prompt, "NO_WAIT")
211		end,
212	},
213	{
214		id = "node15",
215		text = "whoami",
216		echo_text = false,
217		code = function()
218			Tux:says("whoami", "NO_WAIT")
219			Npc:says(c_net_username, "NO_WAIT")
220			cli_says(c_net_prompt, "NO_WAIT")
221		end,
222	},
223	{
224		id = "node16",
225		text = "uname",
226		echo_text = false,
227		code = function()
228			Tux:says("uname", "NO_WAIT")
229			Npc:says("Nkernel", "NO_WAIT")
230			cli_says(c_net_prompt, "NO_WAIT")
231		end,
232	},
233	{
234		-- ../ ls readdrive ./statistics.pl
235		id = "node20",
236		text = "cd file_commands/",
237		echo_text = false,
238		code = function()
239			c_net_prompt = c_net_username .. "@c-net:~/file_commands$"
240			Npc:says(" ", "NO_WAIT")
241			cli_says(c_net_prompt, "NO_WAIT")
242			show("node21", "node23", "node24", "node70") hide("node10", "node20", "node30", "node80", "node99")
243		end,
244	},
245	{
246		id = "node21",
247		text = "cd ../",
248		echo_text = false,
249		code = function()
250			c_net_prompt = c_net_username .. "@c-net:~$"
251			Npc:says(" ", "NO_WAIT")
252			cli_says(c_net_prompt, "NO_WAIT")
253			show("node10", "node20", "node30", "node80", "node99") hide("node21", "node23", "node24", "node70")
254		end,
255	},
256	{
257		id = "node23",
258		text = _"mountdisk.sh",
259		echo_text = false,
260		code = function()
261			Tux:says(_"./mountdisk.sh", "NO_WAIT")
262			if (Tux:has_item_backpack("Kevin's Data Cube")) then
263				Npc:says(_"Mounting volume \"Kevins_Security_File\"...")
264				Npc:says(_"Private memory and/or virtual address space exhausted.", "NO_WAIT")
265				Npc:says(_"Not enough free memory to load data file.", "NO_WAIT")
266			elseif (Tux:has_quest("Deliverance")) and
267			       (not Tux:done_quest("Deliverance")) and
268			       (Tux:has_item_backpack("Data cube")) then
269				Npc:says(_"List for Spencer:")
270				Npc:says("Alastra, Maria Grazia", "NO_WAIT")
271				Npc:says("Arana, Pedro", "NO_WAIT")
272				Npc:says("Badea, Catalin", "NO_WAIT")
273				Npc:says("Bourdon, Pierre", "NO_WAIT")
274				Npc:says("Castellan, Simon", "NO_WAIT")
275				Npc:says("Cipicchio, Ted", "NO_WAIT")
276				Npc:says("Danakian, Hike", "NO_WAIT")
277				Npc:says("Degrande, Samuel", "NO_WAIT")
278				Npc:says("Gill, Andrew A. ", "NO_WAIT")
279				Npc:says("Griffiths, Ian", "NO_WAIT")
280				Npc:says("Hagman, Nick", "NO_WAIT")
281				Npc:says("Herron, Clint", "NO_WAIT")
282				Npc:says("Huillet, Arthur", "NO_WAIT")
283				Npc:says("Huszics, Stefan", "NO_WAIT")
284				Npc:says("Infrared", "NO_WAIT")
285				Npc:says("James", "NO_WAIT")
286				Npc:says("Kangas, Stefan", "NO_WAIT")
287				Npc:says("Kremer, David", "NO_WAIT")
288				Npc:says("Kruger, Matthias", "NO_WAIT")
289				Npc:says("Kucia, Jozef", "NO_WAIT")
290				Npc:says("Matei, Pavaluca", "NO_WAIT")
291				Npc:says("McCammon, Miles", "NO_WAIT")
292				Npc:says("Mendelson, Michael", "NO_WAIT")
293				Npc:says("Mourujarvi, Esa-Matti", "NO_WAIT")
294				Npc:says("Mustonen, Ari", "NO_WAIT")
295				Npc:says("Newton, Simon", "NO_WAIT")
296				Npc:says("Offermann, Sebastian", "NO_WAIT")
297				Npc:says("Parramore, Kurtis", "NO_WAIT")
298				Npc:says("Pepin-Perreault, Nicolas")
299				Npc:says("Picciani, Arvid", "NO_WAIT")
300				Npc:says("Pitoiset, Samuel", "NO_WAIT")
301				Npc:says("Pradet, Quentin", "NO_WAIT")
302				Npc:says("Prix, Johannes", "NO_WAIT")
303				Npc:says("Prix, Reinhard", "NO_WAIT")
304				Npc:says("rudi_s", "NO_WAIT")
305				Npc:says("Ryushu, Zombie", "NO_WAIT")
306				Npc:says("Salmela, Bastian", "NO_WAIT")
307				Npc:says("Starminn", "NO_WAIT")
308				Npc:says("Solovets, Alexander", "NO_WAIT")
309				Npc:says("Swietlicki, Karol", "NO_WAIT")
310				Npc:says("Tetar, Philippe", "NO_WAIT")
311				Npc:says("Thor", "NO_WAIT")
312				Npc:says("Voots, Ryan", "NO_WAIT")
313				Npc:says("Wood, JK", "NO_WAIT")
314				Npc:says("Winterer, Armin", "NO_WAIT")
315				if (not deliverance_datacube_c_net_list) then
316					Tux:update_quest("Deliverance", _"I found a terminal in the town which could read the data cube Francis gave me. It looks like there was a list of names on it, but I have no clue what's the deal with these names.")
317					deliverance_datacube_c_net_list = true
318				end
319			else
320				Npc:says(_"no disk found", "NO_WAIT")
321			end
322			cli_says(c_net_prompt, "NO_WAIT")
323		end,
324	},
325	{
326		id = "node24",
327		text = _"statistics.pl",
328		echo_text = false,
329		code = function()
330			Tux:says("./statistics.pl", "NO_WAIT")
331			Npc:says(_"Corrupted file.", "NO_WAIT")
332			-- Npc:says(_"Bot #Dead# Tux #Hacked/Failed#Ratio", "NO_WAIT")
333			-- Npc:says(print_stats(),"NO_WAIT")
334			cli_says(c_net_prompt, "NO_WAIT")
335		end,
336	},
337	{
338		id = "node30",
339		text = "cd documents/",
340		echo_text = false,
341		code = function()
342			c_net_prompt = c_net_username .. "@c-net:~/documents$"
343			Tux:says("cd documents/", "NO_WAIT")
344			if (c_net_username =="root") then
345				show("node66")
346			end
347			--if (c_net_username == "guest") then
348			--elseif (c_net_username =="lily") then -- no special files yet
349			--elseif (c_net_username =="cpain") then -- no special files yet
350			--end
351			cli_says(c_net_prompt, "NO_WAIT")
352			show("node31") hide("node10", "node20", "node30", "node80", "node99")
353		end,
354	},
355	{
356		id = "node31",
357		text = "cd ../",
358		echo_text = false,
359		code = function()
360			c_net_prompt = c_net_username .. "@c-net:~$"
361			Npc:says(" ", "NO_WAIT")
362			cli_says(c_net_prompt, "NO_WAIT")
363			show("node10", "node20", "node30", "node80", "node99") hide("node31")
364		end,
365	},
366	{
367		id = "node66",
368		text = _"forkBOMB.sh -arm bomb",
369		code = function()
370			Npc:says(_"bomb armed", "NO_WAIT")
371			cli_says(c_net_prompt, "NO_WAIT")
372			show("node67", "node68")
373		end,
374	},
375	{
376		id = "node67",
377		text = _"forkBOMB.sh -disarm bomb",
378		code = function()
379			Npc:says(_"bomb defused", "NO_WAIT")
380			cli_says("root@c-net:~$", "NO_WAIT")
381			hide("node67", "node68") show("node66")
382		end,
383	},
384	{
385		id = "node68",
386		text = _"forkBOMB.sh -execute",
387		code = function()
388			c_net_terminals_disabled = true
389			display_big_message(_"Terminals Disabled")
390			Npc:says(_"Script run. After logout this terminal will be disabled.", "NO_WAIT")
391			cli_says(_"root@c-net:~$", "NO_WAIT")
392			-- Tux:add_xp(30) -- Eventually make this a quest goal.
393		end,
394	},
395	{
396		id = "node70",
397		text = _"radio.sh",
398		code = function()
399			--; TRANSLATORS: "tracks" refers to music songs/music
400			Npc:says(_"Valid tracks:", "NO_WAIT")
401			Npc:says("Ambience, Bleostrada, HellFortressEntrance, ImperialArmy, NewTutorialStage, TechBattle, TheBeginning, underground, AmbientBattle, hellforce, HellFortressTwo, menu, Suspicion, temple, town")
402
403			local try_again_radio = true
404
405			while (try_again_radio) do
406				local track = user_input_string(_"please enter track")
407				if (track == "Ambience" ) or
408				   (track == "AmbientBattle" ) or
409				   (track == "Bleostrada" ) or
410				   (track == "hellforce" ) or
411				   (track == "HellFortressEntrance" ) or
412				   (track == "HellFortressTwo" ) or
413				   (track == "ImperialArmy" ) or
414				   (track == "menu" ) or
415				   (track == "NewTutorialStage" ) or
416				   (track == "Suspicion" ) or
417				   (track == "TechBattle" ) or
418				   (track == "temple" ) or
419				   (track == "TheBeginning" ) or
420				   (track == "town" ) or
421				   (track == "underground" ) or
422				   (running_benchmark()) then
423					switch_background_music(track .. ".ogg")
424					town_track = track
425					try_again_radio = false
426					next("node20")
427				elseif (track == "exit" ) then
428					try_again_radio = false
429					next("node20")
430				else
431					--; TRANSLATORS: "tracks" refers to music songs/music
432					Npc:says(_"WARNING, '%s' not a valid track.", track)
433					--; TRANSLATORS: "'exit'" must not be translated
434					Npc:says(_"enter 'exit' to exit.")
435					Npc:says(_"Please retry.")
436					Npc:says(_"Valid tracks:", "NO_WAIT")
437					Npc:says("Ambience, Bleostrada, HellFortressEntrance, ImperialArmy, NewTutorialStage, TechBattle, TheBeginning, underground, AmbientBattle, hellforce, HellFortressTwo, menu, Suspicion, temple, town")
438				end
439			end
440
441		end,
442	},
443	{
444		id = "node80",
445		text = "cd games/",
446		echo_text = false,
447		code = function()
448			Npc:says(" ", "NO_WAIT")
449			c_net_prompt = c_net_username .. "@c-net:~/games$"
450			cli_says(c_net_prompt, "NO_WAIT")
451			show("node81", "node82", "node83", "node85", "node86") hide("node10", "node20", "node30", "node80", "node99")
452		end,
453	},
454	{
455		id = "node81",
456		text = "cd ../",
457		echo_text = false,
458		code = function()
459			c_net_prompt = c_net_username .. "@c-net:~$"
460			Npc:says(" ", "NO_WAIT")
461			cli_says(c_net_prompt, "NO_WAIT")
462			show("node10", "node20", "node30", "node80", "node99") hide("node81", "node82", "node83", "node85", "node86")
463		end,
464	},
465	{
466		id = "node82",
467		text = "nethack",
468		echo_text = false,
469		code = function()
470			Tux:says("./nethack", "NO_WAIT")
471			push_topic("c-net-nethack_sub")
472			-- call c-net-nethack_sub subdialog
473			next("c-net-nethack_sub.everytime")
474		end,
475	},
476	{
477		-- called after the end of c-net-nethack_sub subdialog
478		id = "after-c-net-nethack_sub",
479		code = function()
480			pop_topic()
481			cli_says(c_net_prompt, "NO_WAIT")
482		end,
483	},
484	{
485		id = "node83",
486		text = _"global_thermonuclear_war",
487		echo_text = false,
488		code = function()
489			Tux:says(_"./global_thermonuclear_war", "NO_WAIT")
490			Npc:says_random(_"Sorry, only winning move is not to play. New game?",
491							_"Mankind exterminated. You lost!",
492							_"No victory possible. LOSER! Play again?",
493							_"Everyone dies, new game?", "NO_WAIT")
494			cli_says(c_net_prompt, "NO_WAIT")
495		end,
496	},
497	{
498		id = "node85",
499		text = _"tetris",
500		echo_text = false,
501		code = function()
502			Tux:says(_"./tetris", "NO_WAIT")
503			Npc:says("Never gonna give you up,")
504			Npc:says("Never gonna let you down,")
505			Npc:says("Never gonna run around and desert you.")
506			Npc:says("Never gonna make you cry,")
507			Npc:says("Never gonna say goodbye,")
508			Npc:says("Never gonna tell a lie and hurt you.")
509			--left out gettext markers on purpose
510			cli_says(c_net_prompt, "NO_WAIT")
511			hide("node85")
512		end,
513	},
514	{
515		id = "node86",
516		text = "progress_quest",
517		echo_text = false,
518		code = function()
519			Tux:says("./progress_quest", "NO_WAIT")
520			if (not playing_progress_quest) then
521				playing_progress_quest = true
522				Npc:says(_"Roll your Stats.")
523				hide("node81", "node82", "node83", "node85", "node86")
524				next("node87")
525			else
526				Npc:says(_"You are already playing Progress Quest:")
527				Npc:says_random(_"You are selling an item!",
528								_"You are killing a creature!",
529								_"You are gaining a level!",
530								_"You are casting a spell!")
531				cli_says(c_net_prompt, "NO_WAIT")
532			end
533		end,
534	},
535	{
536		id = "node87",
537		code = function()
538			local str = math.random(0,6) + math.random(0,6) + math.random(0,6)
539			local con = math.random(0,6) + math.random(0,6) + math.random(0,6)
540			local dex = math.random(0,6) + math.random(0,6) + math.random(0,6)
541			local int = math.random(0,6) + math.random(0,6) + math.random(0,6)
542			local wis = math.random(0,6) + math.random(0,6) + math.random(0,6)
543			local cha = math.random(0,6) + math.random(0,6) + math.random(0,6)
544			Npc:says(_"You rolled Stats of STR: [b]%d[/b], CON: [b]%d[/b], DEX: [b]%d[/b], INT: [b]%d[/b], WIS: [b]%d[/b], CHA: [b]%d[/b].", str, con, dex, int, wis, cha, "NO_WAIT")
545			show("node88", "node89")
546		end,
547	},
548	{
549		id = "node88",
550		text = _"Accept Character",
551		echo_text = false,
552		code = function()
553			--; TRANSLATORS: "Progress Quest" should not be translated
554			Npc:says(_"Welcome to Progress Quest!")
555			cli_says(c_net_prompt, "NO_WAIT")
556			show("node81", "node82", "node83", "node85", "node86") hide("node88", "node89")
557		end,
558	},
559	{
560		id = "node89",
561		text = _"Reroll Character",
562		echo_text = false,
563		code = function()
564			next("node87")
565		end,
566	},
567	{
568		id = "node99",
569		text = "logout",
570		echo_text = false,
571		code = function()
572			Tux:says("logout", "NO_WAIT")
573			--; TRANSLATORS: "c-net" should probably not be translated
574			Npc:says(_"Connection to c-net closed.")
575			-- set_internet_login_time()
576			play_sound("effects/Menu_Item_Selected_Sound_1.ogg")
577			end_dialog()
578		end,
579	},
580}
581