Debian Codegraph @

dat/missions/neutral/foodbiz/deliverlove.lua

raw
1 --[[
2 <?xml version='1.0' encoding='utf8'?>
3 <mission name="Deliver Love">
4 <flags>
5 <unique />
6 </flags>
7 <avail>
8 <priority>4</priority>
9 <chance>50</chance>
10 <location>Bar</location>
11 <planet>Zeo</planet>
12 </avail>
13 <notes>
14 <tier>1</tier>
15 </notes>
16 </mission>
17 --]]
18
19 --[[
20 Mission Name: Deliver Love
21 Author: iwaschosen
22 Plot: Talk to man on Zeo, bargain, load some cargo, deliver it to Zhiru in Goddard, get $
23 --]]
24
25 require "numstring.lua"
26 require "missions/neutral/common.lua"
27
28
29 misn_title = _([[Deliver Love]])
30 npc_name = _("Old-Fashioned Man")
31 bar_desc = _("A man sits in the corner of the bar, writing a letter.")
32
33 title = _("Absence Makes The Heart Grow Fonder")
34
35 firstcontact = _([[You can't help but wonder why the man in the corner is writing on paper instead of a datapad. As you approach the table he motions you to sit. "You must be wondering why I am using such an old fashioned way of recording information," he remarks with a grin. You take a sip of your drink as he continues. "I am writing a poem to my beloved. She lives on %s." You glance at the flowing hand writing, back at the man, and back at the paper. "You wouldn't happen to be heading to %s would you?" he asks.]])
36
37 acceptornot = _([["It is a nice place I hear!" he exclaims visibly excited. "Say, I have written a ton of these letters at this point. You wouldn't be able to drop them off, would you?" You raise your eyebrow. "There would be a few credits in it for you... say, %s?" The man adds quickly with a hopeful expression. It seems like a low reward for a long journey...]])
38
39 bargain = _([[The man grabs your arm as you begin to get up. "Alright, how about %s? Look, I wouldn't want The Empire reading these. The Emperor himself would blush." You sigh and give the man a long pause before answering.]])
40
41 not_enough_cargospace = _([[You run a check of your cargo hold and notice it is packed to the brim. "Did I not mention I wrote a tonne of these letters? You don't have enough space for all of these," the man says. "I will be in the bar if you free some space up." You didn't expect him to have a LITERAL tonne of letters...]])
42
43 ask_again = _([["Ah, are you able to deliver my ton of letters for me now?"]])
44
45 misn_desc = _([[Deliver the love letters to %s in the %s system.]])
46
47 misn_accomplished = _([[You deliver the letters to a young woman who excitedly takes them and thanks you profusely. It seems you really made her day. When you check your balance, you see that %s have been transferred into your account. It also seems like you forgot a letter in the ship, but there were enough that you don't think it will be missed.]])
48
49 osd_desc = {}
50 osd_desc[1] = _("Fly to %s in the %s system.")
51 osd_desc["__save"] = true
52
53 log_text = _([[You delivered a literal tonne of letters for a love-struck, old-fashioned man.]])
54
55 cargoname = "Love Letters"
56
57
58 function create () --No system shall be claimed by mission
59 startworld, startworld_sys = planet.cur()
60 targetworld, targetworld_sys = planet.get( "Zhiru" )
61
62 reward = 20000
63 started = false
64
65 misn.setNPC( npc_name, "neutral/unique/michal" )
66 misn.setDesc( bar_desc )
67 end
68
69
70 function accept ()
71 -- Introductions and a bit of bargaining
72 if not started then
73 if not tk.yesno( title, firstcontact:format( targetworld:name(), targetworld:name() ) ) then
74 misn.finish()
75 end
76 started = true
77 if not tk.yesno( title, acceptornot:format( creditstring( reward ) ) ) then
78 reward = reward * 2 --look at you go, double the reward
79 if not tk.yesno(title, bargain:format( creditstring( reward ) ) ) then
80 misn.finish()
81 end
82 end
83 if player.pilot():cargoFree() < 1 then
84 tk.msg( title, not_enough_cargospace )
85 misn.finish()
86 end
87 else
88 if not tk.yesno( title, ask_again ) then
89 misn.finish()
90 end
91 end
92
93 -- Add Mission Cargo and set up the computer
94
95 misn.accept()
96 misn.cargoAdd( cargoname, 1 )
97
98 misn.setTitle( misn_title )
99 misn.setReward( creditstring( reward ) )
100 misn.setDesc( misn_desc:format( targetworld:name(), targetworld_sys:name() ) )
101
102 osd_desc[1] = osd_desc[1]:format( targetworld:name(), targetworld_sys:name() )
103 misn.osdCreate( misn_title, osd_desc )
104 misn.markerAdd( targetworld_sys, "low" )
105
106 -- set up hooks
107
108 hook.land( "land" )
109 end
110
111 function land()
112 if planet.cur() == targetworld then
113 player.pay( reward )
114 tk.msg( "", misn_accomplished:format( creditstring( reward ) ) )
115 player.addOutfit("Love Letter")
116 addMiscLog( log_text )
117 misn.finish( true )
118 end
119 end