Interface IMyFactionCollection
Namespace: VRage.Game.ModAPI
Assembly: VRage.Game.dll
Syntax
public interface IMyFactionCollection
Properties
Factions
Gets new dictionary with all factions. As keys used factionId
Declaration
Dictionary<long, IMyFaction> Factions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.Int64, IMyFaction> |
Methods
AcceptJoin(Int64, Int64)
Accepts faction join request
Declaration
void AcceptJoin(long factionId, long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction that accepts join |
System.Int64 | playerId | Player id |
AcceptPeace(Int64, Int64)
Accepts peace
Declaration
void AcceptPeace(long fromFactionId, long toFactionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | fromFactionId | Faction that sent peace request |
System.Int64 | toFactionId | Faction that received peace request |
AddNewNPCToFaction(Int64)
Adds new NPC to faction. Name example: "SPRT NPC3340"
Declaration
void AddNewNPCToFaction(long factionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction Id |
AddNewNPCToFaction(Int64, String)
Adds new NPC to faction
Declaration
void AddNewNPCToFaction(long factionId, string npcName)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction Id |
System.String | npcName | Name of NPC |
AddPlayerToFaction(Int64, Int64)
Declaration
void AddPlayerToFaction(long playerId, long factionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | playerId | |
System.Int64 | factionId |
AreFactionsEnemies(Int64, Int64)
Gets if factions are enemies to each other
Declaration
bool AreFactionsEnemies(long factionId1, long factionId2)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId1 | Faction id 1 |
System.Int64 | factionId2 | Faction id 2 |
Returns
Type | Description |
---|---|
System.Boolean |
CancelJoinRequest(Int64, Int64)
Cancels player faction join request
Declaration
void CancelJoinRequest(long factionId, long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction to join |
System.Int64 | playerId | Player that sent join request |
CancelPeaceRequest(Int64, Int64)
Cancel peace request from one faction to another
Declaration
void CancelPeaceRequest(long fromFactionId, long toFactionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | fromFactionId | From faction |
System.Int64 | toFactionId | To faction |
ChangeAutoAccept(Int64, Int64, Boolean, Boolean)
Changes AutoAccept for faction
Declaration
void ChangeAutoAccept(long factionId, long playerId, bool autoAcceptMember, bool autoAcceptPeace)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction Id |
System.Int64 | playerId | Player IdentityId |
System.Boolean | autoAcceptMember | New value of faction AutoAcceptMember |
System.Boolean | autoAcceptPeace | New value of faction AutoAcceptPeace |
CreateFaction(Int64, String, String, String, String)
Creates new faction with faction type
Declaration
void CreateFaction(long founderId, string tag, string name, string desc, string privateInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | founderId | IdentityId of faction founder |
System.String | tag | Faction tag |
System.String | name | Faction name |
System.String | desc | Faction description |
System.String | privateInfo | Faction private info |
Remarks
You should use CreateFaction(Int64, String, String, String, String, MyFactionTypes) if you want to create a faction with different type (
CreateFaction(Int64, String, String, String, String, MyFactionTypes)
Creates new faction Obsolete. Use CreateFactionNew(Int64, String, String, String, String, String)
Declaration
void CreateFaction(long founderId, string tag, string name, string desc, string privateInfo, MyFactionTypes type)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | founderId | IdentityId of faction founder |
System.String | tag | Faction tag |
System.String | name | Faction name |
System.String | desc | Faction description |
System.String | privateInfo | Faction private info |
MyFactionTypes | type | Faction type |
CreateFactionNew(Int64, String, String, String, String, String)
Creates new faction
Declaration
void CreateFactionNew(long founderId, string tag, string name, string desc, string privateInfo, string type)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | founderId | IdentityId of faction founder |
System.String | tag | Faction tag |
System.String | name | Faction name |
System.String | desc | Faction description |
System.String | privateInfo | Faction private info |
System.String | type | Faction type (FactionTypes_Economy.sbc Id/Subtype), not null. You can use MyFactionTypes.?.ToString() |
CreateNPCFaction(String, String, String, String)
Creates new faction with faction type None
Declaration
void CreateNPCFaction(string tag, string name, string desc, string privateInfo)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | Faction tag |
System.String | name | Faction name |
System.String | desc | Faction description |
System.String | privateInfo | Faction private info |
DeclareWar(Int64, Int64)
Declare war
Declaration
void DeclareWar(long fromFactionId, long toFactionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | fromFactionId | Faction that declares war |
System.Int64 | toFactionId | Faction that receive war declaration |
DemoteMember(Int64, Int64)
Demote faction member
Declaration
void DemoteMember(long factionId, long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction that has player |
System.Int64 | playerId | Player IdentityId to demote |
EditFaction(Int64, String, String, String, String)
Edits faction
Declaration
void EditFaction(long factionId, string tag, string name, string desc, string privateInfo)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | FactionId that should be changed |
System.String | tag | New faction tag |
System.String | name | New faction name |
System.String | desc | New faction description |
System.String | privateInfo | New faction private info |
EditFaction(Int64, String, String, String, String, String, Vector3, Vector3)
Edits faction
Declaration
void EditFaction(long factionId, string tag, string name, string desc, string privateInfo, string icon, Vector3 factionColor, Vector3 factionIconColor)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | FactionId that should be changed |
System.String | tag | New faction tag |
System.String | name | New faction name |
System.String | desc | New faction description |
System.String | privateInfo | New faction private info |
System.String | icon | Faction icon image |
Vector3 | factionColor | Faction color (background of icon) |
Vector3 | factionIconColor | Faction icon color |
FactionNameExists(String, IMyFaction)
Gets if faction with provided tag exists
Declaration
bool FactionNameExists(string name, IMyFaction doNotCheck = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name to check |
IMyFaction | doNotCheck | Faction to ignore |
Returns
Type | Description |
---|---|
System.Boolean | True if faction with that tag exists, and it is not ignored |
FactionTagExists(String, IMyFaction)
Gets if faction with provided tag exists
Declaration
bool FactionTagExists(string tag, IMyFaction doNotCheck = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | Tag to check |
IMyFaction | doNotCheck | Faction to ignore |
Returns
Type | Description |
---|---|
System.Boolean | True if faction with that tag exists, and it is not ignored |
GetObjectBuilder()
Gets object builder
Declaration
MyObjectBuilder_FactionCollection GetObjectBuilder()
Returns
Type | Description |
---|---|
MyObjectBuilder_FactionCollection | Object builder |
GetRelationBetweenFactions(Int64, Int64)
Gets relation between 2 factions
Declaration
MyRelationsBetweenFactions GetRelationBetweenFactions(long factionId1, long factionId2)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId1 | Faction id |
System.Int64 | factionId2 | Faction id |
Returns
Type | Description |
---|---|
MyRelationsBetweenFactions | Relation enum |
GetReputationBetweenFactions(Int64, Int64)
Gets reputation between 2 factions
Declaration
int GetReputationBetweenFactions(long factionId1, long factionId2)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId1 | Faction id |
System.Int64 | factionId2 | Faction id |
Returns
Type | Description |
---|---|
System.Int32 | Reputation |
GetReputationBetweenPlayerAndFaction(Int64, Int64)
Gets reputation between identity and faction
Declaration
int GetReputationBetweenPlayerAndFaction(long identityId, long factionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | identityId | Player IdentityId |
System.Int64 | factionId | Faction id |
Returns
Type | Description |
---|---|
System.Int32 | Reputation |
IsPeaceRequestStatePending(Int64, Int64)
Declaration
bool IsPeaceRequestStatePending(long myFactionId, long foreignFactionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | myFactionId | |
System.Int64 | foreignFactionId |
Returns
Type | Description |
---|---|
System.Boolean |
IsPeaceRequestStateSent(Int64, Int64)
Gets if there is peace request sent
Declaration
bool IsPeaceRequestStateSent(long myFactionId, long foreignFactionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | myFactionId | |
System.Int64 | foreignFactionId |
Returns
Type | Description |
---|---|
System.Boolean |
KickMember(Int64, Int64)
Kicks member from faction
Declaration
void KickMember(long factionId, long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction that has player |
System.Int64 | playerId | Player IdentityId to kick |
KickPlayerFromFaction(Int64)
Declaration
void KickPlayerFromFaction(long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | playerId |
MemberLeaves(Int64, Int64)
Forces member to leave
Declaration
void MemberLeaves(long factionId, long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction that has player |
System.Int64 | playerId | Player IdentityId to force leave |
PromoteMember(Int64, Int64)
Promotes faction member
Declaration
void PromoteMember(long factionId, long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction that has player |
System.Int64 | playerId | Player IdentityId to promote |
RemoveFaction(Int64)
Remove faction by id
Declaration
void RemoveFaction(long factionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction id |
SendJoinRequest(Int64, Int64)
Send faction join request
Declaration
void SendJoinRequest(long factionId, long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Faction to join |
System.Int64 | playerId | Player Identity Id |
SendPeaceRequest(Int64, Int64)
Send peace request from one faction to another
Declaration
void SendPeaceRequest(long fromFactionId, long toFactionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | fromFactionId | From faction |
System.Int64 | toFactionId | To faction |
SetReputation(Int64, Int64, Int32)
Sets reputation between 2 factions Note: Faction 1 always has same reputation to Faction 2, as Faction 2 to Faction 1
Declaration
void SetReputation(long fromFactionId, long toFactionId, int reputation)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | fromFactionId | Faction 1 |
System.Int64 | toFactionId | Faction 2 |
System.Int32 | reputation | Desired reputation |
SetReputationBetweenPlayerAndFaction(Int64, Int64, Int32)
Sets reputation between player and faction.
Declaration
void SetReputationBetweenPlayerAndFaction(long identityId, long factionId, int reputation)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | identityId | IdentityId |
System.Int64 | factionId | Faction Id |
System.Int32 | reputation | Desired reputation |
TryGetFactionById(Int64)
Tries get faction by faction id
Declaration
IMyFaction TryGetFactionById(long factionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | factionId | Id of faction |
Returns
Type | Description |
---|---|
IMyFaction | Faction or null |
TryGetFactionByName(String)
Tries get faction with provided name
Declaration
IMyFaction TryGetFactionByName(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of faction |
Returns
Type | Description |
---|---|
IMyFaction | Faction or null |
TryGetFactionByTag(String)
Tries get faction with provided tag
Declaration
IMyFaction TryGetFactionByTag(string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | Tag of faction |
Returns
Type | Description |
---|---|
IMyFaction | Faction or null |
TryGetPlayerFaction(Int64)
Tries get faction that has member with provided id
Declaration
IMyFaction TryGetPlayerFaction(long playerId)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | playerId | IdentityId of player |
Returns
Type | Description |
---|---|
IMyFaction | Faction or null |
Events
FactionAutoAcceptChanged
Called when faction AutoAcceptMember and AutoAcceptPeace changed
Declaration
event Action<long, bool, bool> FactionAutoAcceptChanged
Event Type
Type | Description |
---|---|
System.Action<System.Int64, System.Boolean, System.Boolean> |
FactionCreated
Called when new faction created. FactionId is used as argument
Declaration
event Action<long> FactionCreated
Event Type
Type | Description |
---|---|
System.Action<System.Int64> |
FactionEdited
Called when faction somehow changes.
Declaration
event Action<long> FactionEdited
Event Type
Type | Description |
---|---|
System.Action<System.Int64> |
FactionStateChanged
Called when on of factions changed Arguments: action, fromFactionId, faction Id toFactionId, faction Id, or 0 playerId - IdentityId on whom action was applied, or 0 senderId - IdentityId who triggered state change, or 0
Declaration
event Action<MyFactionStateChange, long, long, long, long> FactionStateChanged
Event Type
Type | Description |
---|---|
System.Action<MyFactionStateChange, System.Int64, System.Int64, System.Int64, System.Int64> |
ReputationChanged
Called when a reputation change is applied between an identity and a faction
Declaration
event Action<long, long, int, ReputationChangeReason> ReputationChanged
Event Type
Type | Description |
---|---|
System.Action<System.Int64, System.Int64, System.Int32, ReputationChangeReason> |