Save mission success for A Space Adventure missions
authorWuzzy <almikes@aol.com>
Sun, 20 Nov 2016 00:12:07 +0100
changeset 11957 63988f36debf
parent 11956 b05db9ca6e1c
child 11958 c8457c7f10f4
Save mission success for A Space Adventure missions
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua
share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua	Wed May 04 02:10:59 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/death02.lua	Sun Nov 20 00:12:07 2016 +0100
@@ -200,6 +200,7 @@
 	end
 	SendStat(siCustomAchievement, loc("The next 4 times you play the \"The last encounter\" mission you'll get 20 more hit points and a laser sight."))
 	SendStat(siPlayerKills,'1',teamA.name)
+	SaveCampaignVar("Mission11Won", "true")
 	EndGame()
 end
 
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua	Wed May 04 02:10:59 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert02.lua	Sun Nov 20 00:12:07 2016 +0100
@@ -166,6 +166,7 @@
 		end
 	end
 	SendStat(siPlayerKills,'0',teamA.name)
+	SaveCampaignVar("Mission7Won", "true")
 	EndGame()
 end
 
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua	Wed May 04 02:10:59 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/desert03.lua	Sun Nov 20 00:12:07 2016 +0100
@@ -213,6 +213,7 @@
 	SendStat(siCustomAchievement, loc("You are indeed the best PAotH pilot."))
 	SendStat(siCustomAchievement, loc("Next time you play \"Searching in the dust\" you'll have an RC plane available."))
 	SendStat(siPlayerKills,'1',teamA.name)
+	SaveCampaignVar("Mission12Won", "true")
 	EndGame()
 end
 
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua	Wed May 04 02:10:59 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/final.lua	Sun Nov 20 00:12:07 2016 +0100
@@ -151,6 +151,7 @@
 
 function heroWin(gear)
 	saveCompletedStatus(7)
+	SaveCampaignVar("Mission1Won", "true")
 	SaveCampaignVar("Won", "true")
 	SendStat(siGameResult, loc("Congratulations, you have saved Hogera!"))
 	SendStat(siCustomAchievement, loc("Hogera is safe!"))
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua	Wed May 04 02:10:59 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/fruit03.lua	Sun Nov 20 00:12:07 2016 +0100
@@ -226,6 +226,7 @@
 	end
 	SendStat(siCustomAchievement, loc("You will gain some extra ammo from the crates the next time you play the \"Getting to the device\" mission."))
 	SendStat(siPlayerKills,'1',teamA.name)
+	SaveCampaignVar("Mission10Won", "true")
 	EndGame()
 end
 
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua	Wed May 04 02:10:59 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/global_functions.lua	Sun Nov 20 00:12:07 2016 +0100
@@ -6,6 +6,21 @@
 		status = GetCampaignVar("MainMissionsStatus")
 	end
 
+	local planetToLevelMapping = {
+		[1] = 2,
+		[2] = 3,
+		[3] = 8,
+		[4] = 5,
+		[5] = 4,
+		[6] = 9,
+		[7] = 14
+	}
+
+	local level = planetToLevelMapping[planetNum]
+	if level ~= nil then
+		SaveCampaignVar("Mission"..level.."Won", "true")
+	end
+
 	if planetNum == 1 then
 		status = "1"..status:sub(2)
 	elseif planetNum == status:len() then
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua	Wed May 04 02:10:59 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/ice02.lua	Sun Nov 20 00:12:07 2016 +0100
@@ -159,6 +159,7 @@
 			end
 
 			SendStat(siPlayerKills,'0',teamA.name)
+			SaveCampaignVar("Mission6Won", "true")
 			EndGame()
 		end
 	end
--- a/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua	Wed May 04 02:10:59 2016 +0200
+++ b/share/hedgewars/Data/Missions/Campaign/A_Space_Adventure/moon02.lua	Sun Nov 20 00:12:07 2016 +0100
@@ -254,5 +254,6 @@
 	SendStat(siGameResult, loc("Congratulations, you are the fastest!"))
 	-- siCustomAchievements were added earlier
 	SendStat(siPlayerKills,'0',teamA.name)
+	SaveCampaignVar("Mission13Won", "true")
 	EndGame()
 end