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--[[WIKI
20PERSONALITY = { "Militaristic", "Vigilant", "Condescending" },
21MARKERS = { NPCID1 = "Kevin", QUESTID1 = "A strange guy stealing from town" },
22PURPOSE = "$$NAME$$ is the first town resident and Red Guard member Tux encounters.",
23BACKSTORY = "$$NAME$$ aggressively guards the main entrance to town. $$NAME$$ lost his sister in The Great Assault.",
24RELATIONSHIP = {
25	{
26		actor = "$$NPCID1$$",
27		text = "$$NAME$$ is angry at the theft undertaken by $$NPCID1$$. $$NAME$$ does not know who $$NPCID1$$ is but
28		 wants him found. This initiates $$QUESTID1$$."
29	},
30}
31WIKI]]--
32
33local Npc = FDrpg.get_npc()
34local Tux = FDrpg.get_tux()
35
36return {
37	EveryTime = function()
38		Town_NorthGateGuard_doors1 = {"Main Gate Outer W", "Main Gate Outer E", "Main Gate Guardhouse"}
39		Town_NorthGateGuard_doors = {Town_NorthGateGuard_doors1[1], Town_NorthGateGuard_doors1[2], Town_NorthGateGuard_doors1[3], "Main Gate Inner W", "Main Gate Inner E"}
40		if (not Tux:has_met("Town-NorthGateGuard")) then
41			Npc:says(_"Hey you! Linarian! What do you want here?")
42			show("node1", "node2", "node3")
43			Npc:set_rush_tux(false)
44			guard_follow_tux = true
45		elseif (Npc:get_rush_tux()) then
46			Npc:set_rush_tux(false)
47			if (Town_NorthGateGuard_tux_nickname_loon) then
48				Npc:says_random(_"Oh, the loon has returned.",
49								_"Oh, it's just the loon. No need to worry.")
50			else
51				Npc:says_random(_"Oh, it's you.",
52								_"I see you have returned.",
53								_"You just can't get enough, can you?")
54			end
55			end_dialog()
56		else
57			Tux:says(_"Can I ask you something?")
58			if (Town_NorthGateGuard_tux_nickname_loon) then
59				Npc:says(_"Yes, Loon.", "NO_WAIT")
60			end
61			Npc:says(_"You can ask, but don't expect a reply.", "NO_WAIT")
62			Npc:says(_"I'm guarding this gate, and if I get distracted the bots might overrun this town and kill everybody in it.")
63		end
64		show_if(knows_spencer_office, "node41")
65		if (KevinMurder) and
66		   (not Tux:done_quest("A strange guy stealing from town")) and
67		   (Tux:has_quest("A strange guy stealing from town")) then
68			show("node50")
69		end
70	end,
71
72	{
73		id = "node1",
74		text = _"Just taking a look around.",
75		code = function()
76			Npc:says(_"Oh, great. Another curious one.")
77			Npc:says(_"About a week ago I let in a stranger who also said he was just taking a look around. I never saw him again. And I'm making sure he won't be getting back in either.")
78			hide("node1", "node2", "node3") show("node5")
79		end,
80	},
81	{
82		id = "node2",
83		text = _"I'd like to get into town.",
84		code = function()
85			Npc:says(_"Funny, exactly the same could be said about all of the crazy bots out there.")
86			Npc:says(_"Not to mention that weird guy that came by last week. The only place in town he is going next time is straight into a holding cell.")
87			hide("node1", "node2", "node3") show("node5")
88		end,
89	},
90	{
91		id = "node3",
92		text = _"I'm here to assassinate your leader and you won't stop me!",
93		code = function()
94			Npc:says(_"Ok, Linarian! You asked for it!")
95			Npc:says(_"Open fire!")
96			for var in ipairs(Town_NorthGateGuard_doors1) do
97				change_obstacle_state(Town_NorthGateGuard_doors1[var], "closed")
98			end
99			set_faction_state("redguard", "hostile")
100			end_dialog()
101			hide("node1", "node2", "node3") show("node99")
102		end,
103	},
104	{
105		id = "node5",
106		text = _"Oh? Who was he? And why?",
107		code = function()
108			Npc:says(_"Heh, you sure are a curious little bird, in more than one way I might say.")
109			Npc:says(_"On the day he visited all our computers went insane, 20 bags of food rations vanished from our storage and one of our bots was stolen.")
110			Npc:says(_"I think that freak lives somewhere to the east. I would love to get my hands on him and beat the life out of him. Slowly.")
111			if (not Tux:has_met("Kevin")) then
112				Tux:add_quest("A strange guy stealing from town", _"The guard in charge at the entrance of the town mentioned that somebody sneaked into town recently, and stole food and hardware. Apparently he lives somewhere to the east.")
113			elseif (Kevin:is_dead()) then
114				Tux:add_quest("A strange guy stealing from town", _"The guard told me about a guy who stole some food and hardware from the town. He lives somewhere in the east.")
115				Tux:end_quest("A strange guy stealing from town", _"Apparently it was this Kevin person I recently hit a bit too hard... Oops... Well, at least he won't steal again...")
116				Tux:add_xp(70)
117			else
118				Tux:add_quest("A strange guy stealing from town", _"Ooops, the guard must be talking about Kevin. I'd better not mention I know him and where he lives, or I might find myself in a holding cell or being forced to show the guards straight to his home. But I guess that explains where Kevin got that 614 bot from.")
119				Tux:add_xp(100)
120				-- We should perhaps not end quest here but later when talking again to Kevin and asking about the comps
121				Tux:end_quest("A strange guy stealing from town", _"Though, I probably should ask Kevin some day what he was doing with the town computers.")
122			end
123			if (not Tux:has_met("Kevin")) and
124			   (not Kevin:is_dead()) then
125				show("node10") -- We should add other nodes in the other cases.
126			end
127			hide("node5") show("node11")
128		end,
129	},
130	{
131		id = "node10",
132		text = _"Somewhere to the east? I should look for him.",
133		code = function()
134			Npc:says(_"Oh, definitely, and I'm sure all the bots out there will be glad to give you directions, too.")
135			Npc:says(_"But if you're insanely lucky and you do find him, you come back straight to me, understand?")
136			Npc:says(_"I'd like to wring his head off... Though, it's not my call. But who knows, if the Boss feels generous we might both get rewarded.")
137			Npc:says(_"Be careful anyway, this creep is a sneaky one if he got past us.")
138			Tux:update_quest("A strange guy stealing from town", _"I offered to find out who the strange guy is. The guard I talked to was pretty sceptical, though; I should get some experience and better equipment before travelling far outside of town.")
139			next("node15")
140		end,
141	},
142	{
143		id = "node11",
144		text = _"Surely he'll never come back here.",
145		code = function()
146			Npc:says(_"I'm not counting on that. The criminal always comes back to the scene of the crime.")
147			Npc:says(_"And that's the last stupid thing they do. You can't steal from the Red Guard twice.")
148			next("node15")
149		end,
150	},
151	{
152		id = "node15",
153		code = function()
154			Npc:says(_"In any case...")
155			Npc:says(_"We've changed our security policy. Our leader, Spencer, wants to interrogate any strangers we let in.")
156			Npc:says(_"You have to talk to him before you head out into the town to do stupid things.")
157			Npc:says_random(_"And up until you do, a guard will be following you. We'll be watching you.",
158							_"And until you do, one of us will be following you. I'll let the others know you've arrived.")
159			Npc:says_random(_"I'll let you in now, but be warned: one false move and we all have flightless waterfowl for dinner. Am I making myself clear?",
160							_"Linarian, I will let you in. Do something stupid, and you aren't coming out. Got it?")
161			hide("node10", "node11") show("node16", "node17")
162		end,
163	},
164	{
165		id = "node16",
166		text = _"Yes. I understand.",
167		code = function()
168			Npc:says(_"State your name Linarian.")
169			--; TRANSLATORS: %s = Tux:get_player_name()
170			Tux:says(_"My name is %s.", Tux:get_player_name())
171			Npc:says(_"You don't look too stupid. Try not to mess up.")
172			--; TRANSLATORS: %s = Tux:get_player_name()
173			Npc:says(_"You may now enter %s.", Tux:get_player_name())
174			hide("node16", "node17") next("node40")
175		end,
176	},
177	{
178		id = "node17",
179		text = _"No. Not at all. Your mother dresses you funny.",
180		code = function()
181			Npc:says(_"What did you say, you oversized duck?")
182			for var in ipairs(Town_NorthGateGuard_doors1) do
183				change_obstacle_state(Town_NorthGateGuard_doors1[var], "closed")
184			end
185			hide("node16", "node17") show("node20", "node21", "node22", "node23", "node30")
186		end,
187	},
188	{
189		id = "node20",
190		text = _"Let me get back to you on that one.",
191		code = function()
192			Npc:says(_"Well, you aren't going anywhere. I'm watching you.")
193			end_dialog()
194		end,
195	},
196	{
197		id = "node21",
198		text = _"... I was only wondering who you were, and why you were wearing such a bright scarlet outfit.",
199		code = function()
200			Npc:says(_"My apologies, Linarian. You are new here, and do not know.")
201			Npc:says(_"The red outfit indicates that I am of the Red Guard. We are the defenders of the town and impose the law.")
202			Npc:says(_"With the continued bot attacks, and the grumbling townsfolk, all of us are a little on edge.")
203			Npc:says(_"Tell me your name, and then you may pass.")
204			--; TRANSLATORS: %s = Tux:get_player_name()
205			Tux:says(_"My name is %s.", Tux:get_player_name())
206			Npc:says(_"You may enter.")
207			next("node40")
208		end,
209	},
210	{
211		id = "node22",
212		text = _"I said: YOUR MOTHER DRESSES YOU FUNNY.",
213		code = function()
214			Npc:says(_"Nobody says things about my mother. Forget you, Linarian!")
215			Npc:says(_"Open fire!")
216			set_faction_state("redguard", "hostile")
217			hide("node20", "node21", "node22", "node23", "node30")
218			end_dialog()
219		end,
220	},
221	{
222		id = "node23",
223		text = _"I said: THIS PLACE LOOKS CLASSY.",
224		code = function()
225			Npc:says(_"Sure you said that.")
226			hide("node21", "node22", "node23", "node30") show("node30", "node31", "node32")
227		end,
228	},
229	{
230		id = "node30",
231		text = _"Please don't hurt me.",
232		code = function()
233			Npc:says(_"How about I punch you until you spit out your name and get out of here, and we call it even?")
234			Tux:says(_"OW")
235			Npc:says(_"Your name?")
236			Tux:says("%s.", Tux:get_player_name())
237			Tux:says(_"OW. That HURT!")
238			--; TRANSLATORS Doc = Doctor
239			Npc:says(_"Get out of here. The Doc is the third door on the right along the main path.")
240			if (not Tux:del_health(40)) then
241				Tux:del_health(1)
242			end
243			next("node40")
244		end,
245	},
246	{
247		id = "node31",
248		text = _"I want to talk to your manager, moron.",
249		code = function()
250			Npc:says(_"I'll be happy to send you his way, I already told you, you have to talk to him anyway. But I need your name before I let you in.")
251			Tux:says("%s.", Tux:get_player_name())
252			Npc:says(_"Talk to Spencer. His office is in the citadel, straight ahead, the first one on your left. You can't miss it.")
253			Npc:says(_"Now stop bothering me! You crazy loon.")
254			Town_NorthGateGuard_tux_nickname_loon = true
255			knows_spencer_office = true
256			if (Tux:has_quest("Deliverance")) then
257				Tux:update_quest("Deliverance", _"I've managed to get into town, and the guard at the gate told me where I can find Spencer: his office is the first one on the left inside the Citadel, directly south of the gate. The guard also calls me a loon.")
258			end
259			next("node40")
260		end,
261	},
262	{
263		id = "node32",
264		text = _"That is exactly what I said.",
265		code = function()
266			Npc:says(_"You are as out of your mind as that Sorenson lady.")
267			Npc:says(_"But I guess she's already here, so it doesn't matter if we have another loon.")
268			--; TRANSLATORS: %s = Tux:get_player_name()
269			Tux:says(_"I'm a Linarian, not a loon. %s the Linarian.", Tux:get_player_name())
270			--; TRANSLATORS: %s = Tux:get_player_name()
271			Npc:says(_"Get out of here %s, the loon, and stop bothering me.", Tux:get_player_name())
272			Town_NorthGateGuard_tux_nickname_loon = true
273			next("node40")
274		end,
275	},
276	{
277		id = "node40",
278		code = function()
279			for var in ipairs(Town_NorthGateGuard_doors) do
280				change_obstacle_state(Town_NorthGateGuard_doors[var], "opened")
281			end
282			if not knows_spencer_office then
283				show("node41")
284			end
285			hide("node20", "node21", "node22", "node23", "node30", "node31", "node32") show("node99")
286		end,
287	},
288	{
289		id = "node41",
290		text = _"Can you tell me where I can find Spencer?",
291		code = function()
292			if (not knows_spencer_office) then -- player wasn't told where to find spencer
293				Npc:says(_"Spencer's office is in the citadel, straight ahead. First one on your left.")
294				knows_spencer_office = true
295				if (Tux:has_quest("Deliverance")) and
296				   (not Tux:done_quest("Deliverance")) then
297					Tux:update_quest("Deliverance", _"I've managed to get into the town, and the guard at the gate told me where I can find Spencer: his office is the first one on the left inside the Citadel, directly south of the gate.")
298				end
299			else -- player was told where spencer's office is, or has met spencer
300				if (not Tux:has_met("Spencer")) then
301					Npc:says_random(_"No, you were already told that.",
302									_"I don't believe anyone's memory is that short, even yours.")
303					Npc:says(_"Stop wasting my time!")
304				else
305					Npc:says_random(_"Are you joking? You already talked to him.",
306									_"Go ask him yourself. I know you already talked to him.")
307					Npc:says(_"Stop wasting my time!")
308				end
309			end
310			hide("node41")
311		end,
312	},
313	{
314		id = "node50",
315		text = _"I have found the thief you talked about and took care of him.",
316		code = function()
317			Npc:says(_"Really? Wow... I must say, you are efficient. Well, at least we won't lose anything else to that freak.")
318			if (Town_NorthGateGuard_tux_nickname_loon) then
319				Npc:says(_"I will never again call you a loon. You are a most deadly penguin.")
320				Town_NorthGateGuard_tux_nickname_loon = false
321			end
322			Npc:says(_"Here's a little reward we scraped together in case anyone solved our thief problem. I'll let Spencer know what you did.")
323			Tux:add_gold(250)
324			KevinMurder = false
325			KevinMurderCongratulation = true
326			Tux:end_quest("A strange guy stealing from town", _"I killed the thief who stole from town. The Red Guard rewarded me for it, but did I do the right thing? Hmm...")
327			hide("node50")
328			end_dialog()
329		end,
330	},
331	{
332		id = "node99",
333		text = _"I'll be going then.",
334		code = function()
335			Npc:says_random(_"Mhmmm.",
336							_"Finally...",
337							_"It was about time...")
338			if (Town_NorthGateGuard_tux_nickname_loon) then
339				--; TRANSLATORS: %s = Tux:get_player_name()
340				Npc:says(_"%s... the Loon", Tux:get_player_name())
341			end
342			end_dialog()
343		end,
344	},
345}
346