Class PersistentFactionData
Persistent runtime faction data is instanstiated from FACTION.TXT at startup. This data represents player's ongoing relationship with factions as game evolves. Actions which influence faction standing will modify items in this tree. This data will be reset with new character or saved/loaded with existing character. Save/Load is handled by SerializablePlayer and SaveLoadManager.
Namespace: DaggerfallWorkshop.Game.Player
Assembly: Assembly-CSharp.dll
Syntax
public class PersistentFactionData
Properties
| Improve this Doc View SourceFactionDict
Declaration
public Dictionary<int, FactionFile.FactionData> FactionDict { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<Int32, FactionFile.FactionData> |
FactionNameToIDDict
Declaration
public Dictionary<string, int> FactionNameToIDDict { get; set; }
Property Value
Type | Description |
---|---|
Dictionary<String, Int32> |
Methods
| Improve this Doc View SourceAddCustomFactions()
Adds any registered custom factions into existing save data or new games
Declaration
public void AddCustomFactions()
ChangePower(Int32, Int32)
Change power value by amount.
Declaration
public bool ChangePower(int factionID, int amount)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID | |
Int32 | amount |
Returns
Type | Description |
---|---|
Boolean |
ChangeReputation(Int32, Int32, Boolean)
Change reputation value by amount. Propagation is matched to classic.
Declaration
public bool ChangeReputation(int factionID, int amount, bool propagate = false)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID | Faction ID of faction initiate reputation change. |
Int32 | amount | Amount to change reputation, positive or negative. |
Boolean | propagate | True if reputation change should propagate to affiliated factions and allies/enemies. |
Returns
Type | Description |
---|---|
Boolean |
EndFactionAllies(Int32, Int32)
End ally state between two factions.
Declaration
public bool EndFactionAllies(int factionID1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Boolean |
EndFactionEnemies(Int32, Int32)
End enemy state between two factions.
Declaration
public bool EndFactionEnemies(int factionID1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Boolean |
FindFactionByTypeAndRegion(Int32, Int32, out FactionFile.FactionData)
Finds faction of the given type and for the given region. If a match for both is not found, the last faction that matched type and had -1 for region is returned. A function like this exists in classic and is used in a number of places. One known use case is for finding the region factions. If no specific faction exists for the region, Random Ruler (region -1) is returned.
Declaration
public bool FindFactionByTypeAndRegion(int type, int regionIndex, out FactionFile.FactionData factionDataOut)
Parameters
Type | Name | Description |
---|---|---|
Int32 | type | Type to match. |
Int32 | regionIndex | Zero-based region index to find in persistent faction data. |
FactionFile.FactionData | factionDataOut | Receives faction data out. |
Returns
Type | Description |
---|---|
Boolean | True if successful. |
FindFactions(Int32, Int32, Int32, Int32)
Finds all faction data matching the search parameters. Specify -1 to ignore a parameter. If all params are -1 then all regions are returned.
Declaration
public FactionFile.FactionData[] FindFactions(int type = -1, int socialGroup = -1, int guildGroup = -1, int oneBasedRegionIndex = -1)
Parameters
Type | Name | Description |
---|---|---|
Int32 | type | Type to match. |
Int32 | socialGroup | Social Group to match. |
Int32 | guildGroup | Guild group to match. |
Int32 | oneBasedRegionIndex | Region index to match. Must be ONE-BASED region index used by FACTION.TXT. |
Returns
Type | Description |
---|---|
FactionFile.FactionData[] | FactionData[] array. |
GetFaction2RelationToFaction1(Int32, Int32)
Get faction2 relation to faction1. Returns: -1 if factions are unrelated 0 if factions are the same 1 if faction2 is the parent of faction1 2 if faction1 and faction2 share the same parent 3 if faction2 is a child of faction1
Declaration
public int GetFaction2RelationToFaction1(int factionID1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Int32 |
GetFactionData(Int32, out FactionFile.FactionData)
Gets faction data from faction ID.
Declaration
public bool GetFactionData(int factionID, out FactionFile.FactionData factionDataOut)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID | Faction ID. |
FactionFile.FactionData | factionDataOut | Receives faction data. |
Returns
Type | Description |
---|---|
Boolean | True if successful. |
GetFactionID(String)
Gets faction ID from name. Experimental.
Declaration
public int GetFactionID(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | Name of faction to get ID of. |
Returns
Type | Description |
---|---|
Int32 | Faction ID if name found, otherwise -1. |
GetFactionName(Int32)
Gets faction name from id.
Declaration
public string GetFactionName(int id)
Parameters
Type | Name | Description |
---|---|---|
Int32 | id | ID of faction to get name of. |
Returns
Type | Description |
---|---|
String | Faction name if name found, otherwise an empty string. |
GetFlag(Int32, FactionFile.Flags)
Declaration
public bool GetFlag(int factionID, FactionFile.Flags flag)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID | |
FactionFile.Flags | flag |
Returns
Type | Description |
---|---|
Boolean |
GetNumberOfCommonAlliesAndEnemies(Int32, Int32)
Get the number of common allies and enemies between these two functions.
Declaration
public int GetNumberOfCommonAlliesAndEnemies(int factionID1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Int32 |
GetParentGroupFaction(FactionFile.FactionData, out FactionFile.FactionData)
Find the top-level parent group of a given faction. This parent can be a Group, a Province or a Temple.
Declaration
public void GetParentGroupFaction(FactionFile.FactionData faction, out FactionFile.FactionData parentFaction)
Parameters
Type | Name | Description |
---|---|---|
FactionFile.FactionData | faction | The faction to get the parent of. |
FactionFile.FactionData | parentFaction | The parent group faction. |
GetRegionFaction(Int32, out FactionFile.FactionData, Boolean)
Gets the faction data corresponding to the given region index.
Declaration
public void GetRegionFaction(int regionIndex, out FactionFile.FactionData factionData, bool duplicateException = true)
Parameters
Type | Name | Description |
---|---|---|
Int32 | regionIndex | The index of the region to get faction data of. |
FactionFile.FactionData | factionData | Receives faction data. |
Boolean | duplicateException | Throw exception if duplicate region faction found, otherwise just log warning. |
GetReputation(Int32)
Gets reputation value.
Declaration
public int GetReputation(int factionID)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID |
Returns
Type | Description |
---|---|
Int32 |
ImportClassicReputation(SaveVars)
Declaration
public void ImportClassicReputation(SaveVars saveVars)
Parameters
Type | Name | Description |
---|---|---|
SaveVars | saveVars |
IsEnemyStatePermanentUntilWarOver(FactionFile.FactionData, FactionFile.FactionData)
Declaration
public bool IsEnemyStatePermanentUntilWarOver(FactionFile.FactionData faction1, FactionFile.FactionData faction2)
Parameters
Type | Name | Description |
---|---|---|
FactionFile.FactionData | faction1 | |
FactionFile.FactionData | faction2 |
Returns
Type | Description |
---|---|
Boolean |
IsFaction2AnAllyOfFaction1(Int32, Int32)
Check whether faction 2 is in faction 1's ally list.
Declaration
public bool IsFaction2AnAllyOfFaction1(int factionID1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Boolean |
IsFaction2AnEnemyOfFaction1(Int32, Int32)
Check whether faction 2 is in faction 1's enemy list.
Declaration
public bool IsFaction2AnEnemyOfFaction1(int factionID1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Boolean |
IsFaction2APotentialWarEnemyOfFaction1(Int32, Int32)
Declaration
public bool IsFaction2APotentialWarEnemyOfFaction1(int factionID1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Boolean |
IsFaction2RelatedToFaction1(Int32, Int32)
Recursively checks if faction2 is related to faction1 or to its parents.
Declaration
public bool IsFaction2RelatedToFaction1(int factionID1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Boolean |
PropagateReputationChange(FactionFile.FactionData, Int32, Int32)
Recursively propagate reputation changes to affiliated factions using parent/child faction relationships.
Declaration
public void PropagateReputationChange(FactionFile.FactionData factionData, int factionID, int amount)
Parameters
Type | Name | Description |
---|---|---|
FactionFile.FactionData | factionData | Faction data of parent faction node to change rep for it and children. |
Int32 | factionID | Faction ID of faction where rep change was initiated. |
Int32 | amount | Amount to change reputation. (half applied to all but init and questor factions) |
Reset()
Resets faction state back to starting point from FACTION.TXT.
Declaration
public void Reset()
SetFlag(Int32, FactionFile.Flags)
Declaration
public bool SetFlag(int factionID, FactionFile.Flags flag)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID | |
FactionFile.Flags | flag |
Returns
Type | Description |
---|---|
Boolean |
SetNewRulerData(Int32)
Declaration
public bool SetNewRulerData(int factionID)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID |
Returns
Type | Description |
---|---|
Boolean |
SetReputation(Int32, Int32)
Set reputation to a specific value.
Declaration
public bool SetReputation(int factionID, int value)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID | |
Int32 | value |
Returns
Type | Description |
---|---|
Boolean |
StartFactionAllies(Int32, Int32, Int32)
Start ally state between two factions. Faction 2 only adds Faction 1 as an ally if it has room.
Declaration
public bool StartFactionAllies(int factionID1, int allyNumberForFaction1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | allyNumberForFaction1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Boolean |
StartFactionEnemies(Int32, Int32, Int32)
Start enemy state between two factions. Faction 2 only adds faction 1 as an enemy if it has room.
Declaration
public bool StartFactionEnemies(int factionID1, int enemyNumberForFaction1, int factionID2)
Parameters
Type | Name | Description |
---|---|---|
Int32 | factionID1 | |
Int32 | enemyNumberForFaction1 | |
Int32 | factionID2 |
Returns
Type | Description |
---|---|
Boolean |
ZeroAllReputations()
Reset all reputations and legal reputations back to 0 (and resets from FACTION.TXT).
Declaration
public void ZeroAllReputations()