2 using System.Globalization;
6 partial class CargoMission : Mission
15 if (rewardPerCrate.HasValue)
17 LocalizedString rewardPerCrateText = TextManager.GetWithVariable(
"currencyformat",
"[credits]",
string.Format(CultureInfo.InvariantCulture,
"{0:N0}", rewardPerCrate.Value));
18 retVal = TextManager.GetWithVariables(
"missionrewardcargopercrate",
19 (
"[rewardpercrate]", rewardPerCrateText),
20 (
"[itemcount]", itemsToSpawn.Count.ToString()),
21 (
"[maxitemcount]", maxItemCount.ToString()),
22 (
"[totalreward]", $
"‖color:gui.orange‖{rewardText}‖end‖"));
26 retVal = TextManager.GetWithVariables(
"missionrewardcargo",
27 (
"[totalreward]", $
"‖color:gui.orange‖{rewardText}‖end‖"),
28 (
"[itemcount]", itemsToSpawn.Count.ToString()),
29 (
"[maxitemcount]", maxItemCount.ToString()));
36 base.ClientReadInitial(msg);
39 for (
int i = 0; i < itemCount; i++)
43 if (items.Contains(
null))
45 throw new System.Exception(
"Error in CargoMission.ClientReadInitial: item list contains null (mission: " +
Prefab.
Identifier +
")");
47 if (items.Count != itemCount)
49 throw new System.Exception(
"Error in CargoMission.ClientReadInitial: item count does not match the server count (" + itemCount +
" != " + items.Count +
", mission: " +
Prefab.
Identifier +
")");
51 if (requiredDeliveryAmount == 0) { requiredDeliveryAmount = items.Count; }
52 if (requiredDeliveryAmount > items.Count)
54 DebugConsole.AddWarning($
"Error in mission \"{Prefab.Identifier}\". Required delivery amount is {requiredDeliveryAmount} but there's only {items.Count} items to deliver.",
56 requiredDeliveryAmount = items.Count;
override bool DisplayAsFailed
override void ClientReadInitial(IReadMessage msg)
override bool DisplayAsCompleted
override RichString GetMissionRewardText(Submarine sub)
Returns the full reward text of the mission (e.g. "Reward: 2,000 mk" or "Reward: 500 mk x 2 (out of m...
static Item ReadSpawnData(IReadMessage msg, bool spawn=true)
LocalizedString GetRewardAmountText(Submarine sub)
Returns the amount of marks you get from the reward (e.g. "3,000 mk")
ContentPackage? ContentPackage
readonly Identifier Identifier
static RichString Rich(LocalizedString str, Func< string, string >? postProcess=null)