Barotrauma Client Doc
Barotrauma.MultiPlayerCampaign Class Reference
Inheritance diagram for Barotrauma.MultiPlayerCampaign:
Barotrauma.CampaignMode Barotrauma.CampaignMode Barotrauma.GameMode Barotrauma.GameMode Barotrauma.GameMode Barotrauma.GameMode

Public Types

enum class  NetFlags : UInt16 {
  Misc = 0x1 , MapAndMissions = 0x2 , UpgradeManager = 0x4 , SubList = 0x8 ,
  ItemsInBuyCrate = 0x10 , ItemsInSellFromSubCrate = 0x20 , PurchasedItems = 0x80 , SoldItems = 0x100 ,
  Reputation = 0x200 , CharacterInfo = 0x800
}
 
- Public Types inherited from Barotrauma.CampaignMode
enum class  InteractionType {
  None , Talk , Examine , Map ,
  Crew , Store , Upgrade , PurchaseSub ,
  MedicalClinic , Cargo
}
 
enum class  TransitionType {
  None , LeaveLocation , ProgressToNextLocation , ReturnToPreviousLocation ,
  ReturnToPreviousEmptyLocation , ProgressToNextEmptyLocation , End
}
 

Public Member Functions

UInt16 GetLastUpdateIdForFlag (NetFlags flag)
 
void SetLastUpdateIdForFlag (NetFlags flag, UInt16 id)
 
void IncrementLastUpdateIdForFlag (NetFlags flag)
 
void IncrementAllLastUpdateIds ()
 
override int GetBalance (Client client=null)
 
override Wallet GetWallet (Client client=null)
 
override void HUDScaleChanged ()
 
override void Start ()
 
override void Update (float deltaTime)
 
override void UpdateWhilePaused (float deltaTime)
 
override void End (TransitionType transitionType=TransitionType.None)
 
void ClientWrite (IWriteMessage msg)
 
void ClientReadCrew (IReadMessage msg)
 
void ClientReadMoney (IReadMessage inc)
 
override bool TryPurchase (Client client, int price)
 
override void Save (XElement element)
 
void LoadState (string filePath)
 
- Public Member Functions inherited from Barotrauma.CampaignMode
bool CanAfford (int cost, Client client=null)
 
Location GetCurrentDisplayLocation ()
 The location that's displayed as the "current one" in the map screen. Normally the current outpost or the location at the start of the level, but when selecting the next destination at the end of the level at an uninhabited location we use the location at the end More...
 
void InitFactions ()
 
override void AddExtraMissions (LevelData levelData)
 
void LoadNewLevel ()
 
TransitionType GetAvailableTransition (out LevelData nextLevel, out Submarine leavingSub)
 Which type of transition between levels is currently possible (if any) More...
 
TransitionType GetAvailableTransition ()
 
override void End (CampaignMode.TransitionType transitionType=CampaignMode.TransitionType.None)
 
void UpdateStoreStock ()
 Updates store stock before saving the game More...
 
void EndCampaign ()
 
Faction GetRandomFaction (Rand.RandSync randSync, bool allowEmpty=true)
 Returns a random faction based on their ControlledOutpostPercentage More...
 
Faction GetRandomSecondaryFaction (Rand.RandSync randSync, bool allowEmpty=true)
 Returns a random faction based on their SecondaryControlledOutpostPercentage More...
 
bool TryHireCharacter (Location location, CharacterInfo characterInfo, Character hirer, Client client=null)
 
void AssignNPCMenuInteraction (Character character, InteractionType interactionType)
 
void OutpostNPCAttacked (Character npc, Character attacker, AttackResult attackResult)
 
Faction GetFaction (Identifier identifier)
 
float GetReputation (Identifier factionIdentifier)
 
FactionAffiliation GetFactionAffiliation (Identifier factionIdentifier)
 
void LogState ()
 
override void Remove ()
 
int NumberOfMissionsAtLocation (Location location)
 
void CheckTooManyMissions (Location currentLocation, Client sender)
 
void SwitchSubs ()
 
void SavePets (XElement parentElement=null)
 
void LoadPets ()
 
void SaveActiveOrders (XElement parentElement=null)
 
void LoadActiveOrders ()
 
override void ShowStartMessage ()
 
override void Draw (SpriteBatch spriteBatch)
 
Task SelectSummaryScreen (RoundSummary roundSummary, LevelData newLevel, bool mirror, Action action)
 
void CancelStartRound ()
 
void ThrowIfStartRoundCancellationRequested ()
 
override void AddToGUIUpdateList ()
 
- Public Member Functions inherited from Barotrauma.GameMode
 GameMode (GameModePreset preset)
 

Static Public Member Functions

static MultiPlayerCampaign StartNew (string mapSeed, CampaignSettings settings)
 
static MultiPlayerCampaign LoadNew (XElement element)
 
static string GetCharacterDataSavePath (string savePath)
 
static string GetCharacterDataSavePath ()
 
static List< SubmarineInfoGetCampaignSubs ()
 
static void StartCampaignSetup (List< SaveInfo > saveFiles)
 
static void ClientRead (IReadMessage msg)
 
- Static Public Member Functions inherited from Barotrauma.CampaignMode
static bool BlocksInteraction (InteractionType interactionType)
 
static List< SubmarineGetSubsToLeaveBehind (Submarine leavingSub)
 
static int GetHullRepairCost ()
 
static int GetItemRepairCost ()
 
static Faction GetRandomFaction (IEnumerable< Faction > factions, Rand.RandSync randSync, bool secondary=false, bool allowEmpty=true)
 
static Faction GetRandomFaction (IEnumerable< Faction > factions, Random random, bool secondary=false, bool allowEmpty=true)
 
static bool AllowedToManageCampaign (ClientPermissions permissions)
 There is a server-side implementation of the method in MultiPlayerCampaign More...
 
static bool AllowedToManageWallets ()
 
static bool AllowImmediateItemDelivery ()
 

Public Attributes

bool SuppressStateSending = false
 
- Public Attributes inherited from Barotrauma.CampaignMode
double TotalPlayTime
 
int TotalPassedLevels
 
readonly CargoManager CargoManager
 
UpgradeManager UpgradeManager
 
MedicalClinic MedicalClinic
 
readonly CampaignMetadata CampaignMetadata
 
CampaignSettings Settings
 
readonly NamedEvent< WalletChangedEvent > OnMoneyChanged = new NamedEvent<WalletChangedEvent>()
 
bool CheatsEnabled
 
SubmarineInfo PendingSubmarineSwitch
 
Wallet Bank
 
bool PurchasedLostShuttlesInLatestSave
 
bool DivingSuitWarningShown
 
GUIButton ReadyCheckButton
 
CampaignUI CampaignUI
 

Protected Member Functions

override void LoadInitialLevel ()
 Load the first level and start the round after loading a save file More...
 
override IEnumerable< CoroutineStatusDoLevelTransition (TransitionType transitionType, LevelData newLevel, Submarine leavingSub, bool mirror)
 
override void EndCampaignProjSpecific ()
 
- Protected Member Functions inherited from Barotrauma.CampaignMode
 CampaignMode (GameModePreset preset, CampaignSettings settings)
 
void KeepCharactersCloseToOutpost (float deltaTime)
 
void LoadStats (XElement element)
 
XElement SaveStats ()
 
void TransferItemsBetweenSubs ()
 Also serializes the current sub. More...
 
void RefreshOwnedSubmarines ()
 
GUIButton CreateEndRoundButton ()
 
SubmarineInfo GetPredefinedStartOutpost ()
 
void TryEndRoundWithFuelCheck (Action onConfirm, Action onReturnToMapScreen)
 

Properties

UInt16 LastSaveID [get, set]
 
byte CampaignID [get, set]
 
override bool Paused [get]
 
UInt16 PendingSaveID [get, set]
 
Wallet PersonalWallet [get]
 
override Wallet Wallet [get]
 
- Properties inherited from Barotrauma.CampaignMode
IReadOnlyList< FactionFactions [get]
 
XElement ActiveOrdersElement [get, set]
 
bool IsFirstRound = true [get, protected set]
 
bool DisableEvents [get]
 
bool TransferItemsOnSubSwitch [get, set]
 
bool SwitchedSubsThisRound [get]
 
Map Map [get]
 
override IEnumerable< MissionMissions [get]
 
Location CurrentLocation [get]
 
LevelData NextLevel [get, protected set]
 
virtual bool PurchasedHullRepairs [get, set]
 
virtual bool PurchasedLostShuttles [get, set]
 
virtual bool PurchasedItemRepairs [get, set]
 
GUIButton EndRoundButton [get]
 
SlideshowPlayer SlideshowPlayer [get, protected set]
 
bool ForceMapUI [get, protected set]
 
bool??????? ShowCampaignUI [get, set]
 
virtual Wallet Wallet [get]
 Gets the current personal wallet In singleplayer this is the campaign bank and in multiplayer this is the personal wallet More...
 
- Properties inherited from Barotrauma.GameMode
CrewManagerCrewManager [get]
 
virtual IEnumerable< MissionMissions [get]
 
bool IsSinglePlayer [get]
 
LocalizedString Name [get]
 
virtual bool Paused [get]
 
GameModePreset Preset [get]
 

Additional Inherited Members

- Static Public Attributes inherited from Barotrauma.CampaignMode
readonly record struct SaveInfo(string FilePath, Option< SerializableDateTime > SaveTime, string SubmarineName, ImmutableArray< string > EnabledContentPackageNames) const int MaxMoney = int.MaxValue / 2
 
const int InitialMoney = 8500
 
const float HullRepairCostPerDamage = 0.1f
 
const int ShuttleReplaceCost = 1000
 
const int MaxHullRepairCost = 600
 
- Static Public Attributes inherited from Barotrauma.GameMode
static List< GameModePresetPresetList = new List<GameModePreset>()
 
- Static Protected Member Functions inherited from Barotrauma.CampaignMode
static void LeaveUnconnectedSubs (Submarine leavingSub)
 
- Protected Attributes inherited from Barotrauma.CampaignMode
XElement petsElement
 
bool wasDocked
 
Map map
 
bool crewDead
 
Color overlayColor
 
Sprite overlaySprite
 
GUIButton endRoundButton
 
GUIFrame campaignUIContainer
 
- Protected Attributes inherited from Barotrauma.GameMode
DateTime startTime
 
GameModePreset preset
 
- Static Protected Attributes inherited from Barotrauma.CampaignMode
const float EndTransitionDuration = 5.0f
 
- Events inherited from Barotrauma.CampaignMode
Action BeforeLevelLoading
 Automatically cleared after triggering -> no need to unregister More...
 

Detailed Description

Member Enumeration Documentation

◆ NetFlags

Enumerator
Misc 
MapAndMissions 
UpgradeManager 
SubList 
ItemsInBuyCrate 
ItemsInSellFromSubCrate 
PurchasedItems 
SoldItems 
Reputation 
CharacterInfo 

Definition at line 15 of file BarotraumaShared/SharedSource/GameSession/GameModes/MultiPlayerCampaign.cs.

Member Function Documentation

◆ ClientRead()

static void Barotrauma.MultiPlayerCampaign.ClientRead ( IReadMessage  msg)
static

◆ ClientReadCrew()

void Barotrauma.MultiPlayerCampaign.ClientReadCrew ( IReadMessage  msg)

◆ ClientReadMoney()

void Barotrauma.MultiPlayerCampaign.ClientReadMoney ( IReadMessage  inc)

◆ ClientWrite()

void Barotrauma.MultiPlayerCampaign.ClientWrite ( IWriteMessage  msg)

◆ DoLevelTransition()

override IEnumerable<CoroutineStatus> Barotrauma.MultiPlayerCampaign.DoLevelTransition ( TransitionType  transitionType,
LevelData  newLevel,
Submarine  leavingSub,
bool  mirror 
)
protectedvirtual

◆ End()

override void Barotrauma.MultiPlayerCampaign.End ( TransitionType  transitionType = TransitionType.None)
virtual

◆ EndCampaignProjSpecific()

override void Barotrauma.MultiPlayerCampaign.EndCampaignProjSpecific ( )
protectedvirtual

◆ GetBalance()

override int Barotrauma.MultiPlayerCampaign.GetBalance ( Client  client = null)
virtual

◆ GetCampaignSubs()

static List<SubmarineInfo> Barotrauma.MultiPlayerCampaign.GetCampaignSubs ( )
static

◆ GetCharacterDataSavePath() [1/2]

static string Barotrauma.MultiPlayerCampaign.GetCharacterDataSavePath ( )
static

◆ GetCharacterDataSavePath() [2/2]

static string Barotrauma.MultiPlayerCampaign.GetCharacterDataSavePath ( string  savePath)
static

◆ GetLastUpdateIdForFlag()

UInt16 Barotrauma.MultiPlayerCampaign.GetLastUpdateIdForFlag ( NetFlags  flag)

◆ GetWallet()

override Wallet Barotrauma.MultiPlayerCampaign.GetWallet ( Client  client = null)
virtual

◆ HUDScaleChanged()

override void Barotrauma.MultiPlayerCampaign.HUDScaleChanged ( )
virtual

◆ IncrementAllLastUpdateIds()

void Barotrauma.MultiPlayerCampaign.IncrementAllLastUpdateIds ( )

◆ IncrementLastUpdateIdForFlag()

void Barotrauma.MultiPlayerCampaign.IncrementLastUpdateIdForFlag ( NetFlags  flag)

◆ LoadInitialLevel()

override void Barotrauma.MultiPlayerCampaign.LoadInitialLevel ( )
protectedvirtual

Load the first level and start the round after loading a save file

Implements Barotrauma.CampaignMode.

Definition at line 180 of file BarotraumaClient/ClientSource/GameSession/GameModes/MultiPlayerCampaign.cs.

◆ LoadNew()

static MultiPlayerCampaign Barotrauma.MultiPlayerCampaign.LoadNew ( XElement  element)
static

◆ LoadState()

void Barotrauma.MultiPlayerCampaign.LoadState ( string  filePath)

◆ Save()

override void Barotrauma.MultiPlayerCampaign.Save ( XElement  element)
virtual

◆ SetLastUpdateIdForFlag()

void Barotrauma.MultiPlayerCampaign.SetLastUpdateIdForFlag ( NetFlags  flag,
UInt16  id 
)

◆ Start()

override void Barotrauma.MultiPlayerCampaign.Start ( )
virtual

◆ StartCampaignSetup()

static void Barotrauma.MultiPlayerCampaign.StartCampaignSetup ( List< SaveInfo >  saveFiles)
static

◆ StartNew()

static MultiPlayerCampaign Barotrauma.MultiPlayerCampaign.StartNew ( string  mapSeed,
CampaignSettings  settings 
)
static

◆ TryPurchase()

override bool Barotrauma.MultiPlayerCampaign.TryPurchase ( Client  client,
int  price 
)
virtual

◆ Update()

override void Barotrauma.MultiPlayerCampaign.Update ( float  deltaTime)
virtual

◆ UpdateWhilePaused()

override void Barotrauma.MultiPlayerCampaign.UpdateWhilePaused ( float  deltaTime)
virtual

Member Data Documentation

◆ SuppressStateSending

bool Barotrauma.MultiPlayerCampaign.SuppressStateSending = false

Property Documentation

◆ CampaignID

byte Barotrauma.MultiPlayerCampaign.CampaignID
getset

◆ LastSaveID

UInt16 Barotrauma.MultiPlayerCampaign.LastSaveID
getset

◆ Paused

override bool Barotrauma.MultiPlayerCampaign.Paused
get

◆ PendingSaveID

UInt16 Barotrauma.MultiPlayerCampaign.PendingSaveID
getset

◆ PersonalWallet

Wallet Barotrauma.MultiPlayerCampaign.PersonalWallet
get

◆ Wallet

override Wallet Barotrauma.MultiPlayerCampaign.Wallet
get