From a1aa45f7ff582dbe31966b57194834f542b6f0e5 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Fri, 2 Aug 2013 15:08:31 +0100
Subject: [PATCH] [Add] Another mission in the collective compaign.

---
 dat/mission.xml                   | 26 +++++++++---
 dat/missions/emp_collective02.lua | 68 +++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 6 deletions(-)
 create mode 100644 dat/missions/emp_collective02.lua

diff --git a/dat/mission.xml b/dat/mission.xml
index 61b79e5..b416d88 100644
--- a/dat/mission.xml
+++ b/dat/mission.xml
@@ -15,7 +15,7 @@
 <location>Computer</location>
 <faction>Independent</faction>
 <faction>Empire</faction>
-<faction>Unknown6</faction>
+<faction>Soromid</faction>
 </avail>
 </mission>
 <mission name="Empire Recruitment">
@@ -36,7 +36,7 @@
 <chance>350</chance>
 <location>Computer</location>
 <faction>Empire</faction>
-<faction>Unknown6</faction>
+<faction>Soromid</faction>
 </avail>
 </mission>
 <mission name="Collective Scouting">
@@ -45,20 +45,34 @@
 <unique>1</unique>
 </flags>
 <avail>
-<req>es_cargo</req>
-<chance>70</chance>
+<cond>var.peek("es_cargo") == true and space.jumpDist("NCG-1732") &lt; 5 and player.getFaction("Empire") &gt; 30 and player.getRating() &gt; 50</cond>
+<chance>30</chance>
 <location>Bar</location>
 <faction>Empire</faction>
 </avail>
 </mission>
-<mission name="Collective Espionage">
+<mission name="Collective Espionage 1">
 <lua>emp_collective01</lua>
 <flags>
 <unique>1</unique>
 </flags>
 <avail>
+<cond>player.getFaction("Empire") &gt; 30</cond>
 <done>Collective Scouting</done>
-<chance>50</chance>
+<chance>70</chance>
+<location>Bar</location>
+<planet>Omega Station</planet>
+</avail>
+</mission>
+<mission name="Collective Espionage 2">
+<lua>emp_collective02</lua>
+<flags>
+<unique>1</unique>
+</flags>
+<avail>
+<cond>player.getFaction("Empire") &gt; 30</cond>
+<done>Collective Espionage 1</done>
+<chance>70</chance>
 <location>Bar</location>
 <planet>Omega Station</planet>
 </avail>
diff --git a/dat/missions/emp_collective02.lua b/dat/missions/emp_collective02.lua
new file mode 100644
index 0000000..ece2dff
--- /dev/null
+++ b/dat/missions/emp_collective02.lua
@@ -0,0 +1,68 @@
+lang = lephisto.lang()
+if lang == "es" then
+  -- Not translated yet.
+else -- Default English.
+  misn_title = "Collective Espionage"
+  misn_reward = "None"
+  misn_desc = {}
+  misn_desc[1] = "Land on %s in the %s system to monitor Collective communications."
+  misn_desc[2] = "Travel back to %s in %s."
+  title = {}
+  title[1] = "Collective Espionage"
+  title[2] = "Mission Accomplished"
+  text = {}
+  text[1] = [[You notice Sargent Dimitry at one of the booths. You head over to see what the results are.
+  "Hello again there %s. Bad news on your latest run, you got nothing other than the usual robotic chatter. We'll have to send you out again, this time we'll follow a different approach. Interested in giving it another shot?]]
+  text[2] = [["On your last run you where monitoring while out in the open, while you do get better signals, upon noticing your presence. This mission will consist of hiding and moitoring from a safer spot, Hopefully catching them more relaxed."
+  "When the Collective struck, they quickly took many systems, one of the bigger hits was %s, an important gas gient rich in methane. They destroyed the gas refineries and slaughtered the humans, there was nothing we could do. the turbulance and dense atmosphere should be able to hide your ship."]]
+  text[3] = [["The plan is to have you infiltrate Collective space alone, to no arouse too much suspicion. Once inside you should head to %s system. Stay low and monitor all frequencies in the system. If anything is suspicious, we'll surely catch it then."
+  "Good luck, I'll be waiting for you on your return."]]
+  text[4] = [[You quickly land on %s and hide in the deep dense methane atmosphere it has. Your monitoring gear flickers into action, hopefully catching something of use. With some luck there won't be too many collective ships when you take off.]]
+  text[5] = [[As your ship touches ground you see Sargent Dimitry come out to greet you.
+  "How was the weather", he mentions jokingly. "Glad to see you're in one peice. We'll get right on analyzing the data acquired. These robots have to be up to something. Meet me in the bar later, meanwhile give yourself a treat, you earned it. We've made a 100k scred deposit in your bank account, enjoyu it"]]
+end
+
+function create()
+  -- Intro text.
+  if tk.yesno(title[1], string.format(text[1], player.name())) then
+    misn.accept()
+
+    misn_stage = 0
+    systems_visited = 0 -- Number of Collective systems visited.
+    misn_base = "Omega Station"
+    misn_target = "Eiroik"
+    misn.setMarker(space.getSystem(misn_target))
+
+    -- Mission details.
+    misn.setTitle(misn_title)
+    misn.setReward(misn_reward)
+    misn.setDesc(string.format(misn_desc[1], misn_target, space.getSystem(misn_target)))
+
+    tk.msg(title[1], string.format(text[2], misn_target))
+    tk.msg(title[1], text[3])
+
+    hook.enter("enter")
+  end
+end
+
+function land()
+  planet = space.landName()
+
+  -- First mission part is landing on the planet.
+  if misn_stage == 0 and planet == misn_target then
+    tk.msg(title[1], text[4])
+    misn_stage = 1
+    misn.setMarker(space.getSystem(misn_base))
+
+    -- Return bit.
+  elseif misn_stage == 1 and planet == misn_base then
+    tk.msg(title[2], text[5])
+
+    -- Rewards.
+    player.modFaction("Empire", 5)
+    player.pay(10000)
+
+    misn.finish(true)
+  end
+end
+