Functions

Global FactionData API

Global functions to access the FactionData object. More...


Detailed Description

Global functions to access the FactionData object.

Functions

int RegisterFaction (uint id, const string@ name, bool playerDriven)
 Registers new faction, initializes database for it.
bool RebuildList ()
int RegisterFaction (const string@ name, bool playerDriven, uint& out id)
 Registers faction with given name, reads back the id for it.
FactionDataGetDatabase (uint faction_id)
 Gets data object for given faction.
int AddPlayer (uint faction, uint id)
 Adds player without knowing anything about him I'm not sure whether it's useful actually.
int AddPlayer (uint faction, uint id, uint playerFaction)
 Adds player with specified faction.
int AddPlayer (uint faction, uint id, uint playerFaction, uint rank)
 Adds player with specified faction and rank.
int AddPlayer (uint faction, uint id, uint playerFaction, uint rank, uint status)
 Adds player with specified faction, rank and status.
int RemovePlayer (uint faction, uint id)
 Removes player's info from faction's database.
uint GetMembers (uint faction, array< uint >& ids)
 Fill the given array with member's ids.
uint GetRecordsCount (uint faction)
 Gets the total number of records from the database.
uint GetMembersCount (uint faction)
 Gets the total number of members.
int GetNextId (uint faction, uint currId, bool members, uint& out nextId)
 Gets id of the next record, with regard to record containing data for current Id if members is set to true, seeks for next member record.
int GetPrevId (uint faction, uint currId, bool members, uint& out prevId)
 Gets id of the previous record, with regard to record containing data for current Id if members is set to true, seeks for prev member record.
int GetFirstId (uint faction, bool members, uint& out id)
 Gets the id of the player stored at first record if members is set to true seeks for first stored member.
int GetFaction (uint faction, uint id)
 Gets the faction of the given player, stores it in the faction argument.
int GetStatus (uint faction, uint id)
 Gets the status of the given player, stores it in the appropriate argument.
int GetRank (uint faction, uint id)
 Gets the rank of the given player, stores it in the appropriate argument.
bool IsMember (uint faction, Critter& cr)
 Checks if the player with given id is the member of the faction.
bool IsMemberOffline (uint faction, uint id)
bool StoredInDB (uint faction, uint id)
 Checks if the player with given id exists in the database.
uint GetLeaderId (uint faction)
 Gets the id of the leader.
void SetLeaderId (uint faction, uint id)
 Sets the id of the leader.
uint GetClaimId (uint faction)
 Gets the id of the player who claimed leadership.
void SetClaimId (uint faction, uint id)
 Sets the id of the player who claimed leadership.
uint GetLeaderTime (uint faction)
 Gets the time when claimee will be able to confirm leadership without doing anything.
void SetLeaderTime (uint faction, uint time)
 Sets the time when claimee will be able to confirm leadership without doing anything This is time for leader to act.
uint GetClaimTime (uint faction)
 Gets the time when next claim will be allowed (current claimee will loose his claim).
void SetClaimTime (uint faction, uint time)
 Sets the time when next claim will be allowed (current claimee will loose his claim) This is time for claimee to act.
uint16 GetFactionRadioChannel (uint faction)
void SetFactionRadioChannel (uint faction, uint16 channel)
 Sets the radio channel for given faction.
uint GetFactionLocationId (uint faction)
 Retrieves location id for the faction if the returned value is 0 it means faction doesn't use dynamically created location, or there was some error that should have been handled earlier (like not checking returned value of CreateLocation).
void SetFactionLocation (uint faction, uint locId, uint pid, uint x, uint y)
 Sets new location data for faction hq.
bool GetFactionLocation (uint faction, uint& out locId, uint& out pid, uint& out x, uint& out y)
 Gets location data for player-faction hq.
void GetFactionLocationCoords (uint faction, uint& out x, uint& out y)
 Gets location coords.
uint GetFactionScore (uint faction)
 Gets faction score - some global value used to abstract how succesfull faction is in some of their endeavours.
void ModifyFactionScore (uint faction, int amount)
 Modifies faction score by given amount.
int ModifyStatus (uint faction, uint id, uint newStatus)
 Modfy the player's status stored in db.
int ModifyRank (uint faction, uint id, uint newRank)
 Modfy the player's rank stored in db.
int ModifyFaction (uint faction, uint id, uint newFaction)
 Modfy the player's faction stored in db.
int InvitePlayer (uint faction, uint playerId)
 Invites player to be a member of the faction.
int ConfirmInvitation (uint faction, uint playerId)
 Adds member, who has been previously invited, to the given faction.
int AddMember (uint faction, uint playerId, bool applyModifiers)
 Adds member to the given faction.
int AddMember (uint faction, uint playerId)
int ChangeRank (uint faction, uint playerId, uint newRank)
 Change the players rank.
int ExpelMember (uint faction, uint playerId, bool applyModifiers)
 Expel member.
int ExpelMember (uint faction, uint playerId)
void AddFactionNews (uint faction, uint master, uint slave, uint type)
 Adds news.
bool GetFactionNews (uint faction, uint index, uint& out master, uint& out slave, uint& out type, uint16& out year, uint8& out month, uint8& out day, uint8& out hour, uint8& out minute)
 Retrieves news stored at given index.
uint GetFactionNewsCount (uint faction)
 Retrieves number of news stored for a given faction.
uint GetPlayerFaction (uint playerId)
 Helper method to determine faction player belongs too described in appropriate local variable.
uint GetPlayerRank (uint playerId)
 Helper method to determine rank of the player which is stored in appropriate local variable.
int GetFactionNameMsg (uint faction)
 Retrieves number of the msg string representing faction name.
int GetFactionAliasNameMsg (uint faction)
 Retrieves number of the msg string representing faction variation name(aliases).
uint CheckFactionBaseCoords (uint x, uint y)
 Checks whether given coords are within base area of one of the playerfactions returns faction id in case of success, 0 otherwise.
bool IsGang (uint faction)
 Checks if faction is playerdriven gang.
bool IsBigFaction (uint faction)
bool IsTheSameFaction (uint player1Id, uint player2Id)
void _Resign (uint playerId)
void UpdateLastUsed (uint faction)
 Updates 'last used' variable, that tracks time when faction was last time accessed.
uint GetFactionLog (uint faction, bool fullLog, array< string >& strings, uint begin, uint end)
 creates array of strings representing log of the faction data if faction is 0 then all are displayed returns number of strings
bool SaveFactionData (uint faction)
bool FactionExists (uint faction)

Function Documentation

int RegisterFaction ( uint  id,
const string name,
bool  playerDriven 
)

Registers new faction, initializes database for it.

Parameters:
id faction id, has to be proper id (within FACTION_COUNT range) and has to have name assigned in factions_names dictionary
name name of the faction (has to be equal to one of the names stored in fotext.msg)
playerDriven for player gangs
Returns:
error code defined by REGRESULT_* macros
bool RebuildList (  ) 
int RegisterFaction ( const string name,
bool  playerDriven,
uint& out  id 
)

Registers faction with given name, reads back the id for it.

Returns:
error code defined by REGRESULT_* macros
FactionData@ GetDatabase ( uint  faction_id  ) 

Gets data object for given faction.

Returns:
null for wrong faction id
int AddPlayer ( uint  faction,
uint  id 
)

Adds player without knowing anything about him I'm not sure whether it's useful actually.

Parameters:
faction faction whose database we will update
id id of the player we want to add

FD_RESULT_* value (see _factions.fos)

int AddPlayer ( uint  faction,
uint  id,
uint  playerFaction 
)

Adds player with specified faction.

Parameters:
faction faction whose database we will update
id id of the player we want to add
playerFaction faction to which given player belongs to
Returns:
FD_RESULT_* value (see _factions.fos)
int AddPlayer ( uint  faction,
uint  id,
uint  playerFaction,
uint  rank 
)

Adds player with specified faction and rank.

Parameters:
faction faction whose database we will update
id id of the player we want to add
playerFaction faction to which given player belongs to
rank rank of the player
Returns:
FD_RESULT_* value (see _factions.fos)
int AddPlayer ( uint  faction,
uint  id,
uint  playerFaction,
uint  rank,
uint  status 
)

Adds player with specified faction, rank and status.

Parameters:
faction faction whose database we will update
id id of the player we want to add
playerFaction faction to which given player belongs to
rank rank of the player
status status of the player
Returns:
FD_RESULT_* value (see _factions.fos)
int RemovePlayer ( uint  faction,
uint  id 
)

Removes player's info from faction's database.

Parameters:
faction faction whose database we will update
id id of the player the info about we want to remove
Returns:
FD_RESULT_* value (see _factions.fos)
uint GetMembers ( uint  faction,
array< uint >&  ids 
)

Fill the given array with member's ids.

Parameters:
faction id of the faction to take data from
ids array that will be filled with members identifiers
Returns:
length of created array, 0 if error occured
uint GetRecordsCount ( uint  faction  ) 

Gets the total number of records from the database.

uint GetMembersCount ( uint  faction  ) 

Gets the total number of members.

int GetNextId ( uint  faction,
uint  currId,
bool  members,
uint& out  nextId 
)

Gets id of the next record, with regard to record containing data for current Id if members is set to true, seeks for next member record.

Returns:
FD_RESULT_* value (see _factions.fos)
int GetPrevId ( uint  faction,
uint  currId,
bool  members,
uint& out  prevId 
)

Gets id of the previous record, with regard to record containing data for current Id if members is set to true, seeks for prev member record.

Returns:
FD_RESULT_* value (see _factions.fos)
int GetFirstId ( uint  faction,
bool  members,
uint& out  id 
)

Gets the id of the player stored at first record if members is set to true seeks for first stored member.

Returns:
FD_RESULT_* value (see _factions.fos)
int GetFaction ( uint  faction,
uint  id 
)

Gets the faction of the given player, stores it in the faction argument.

Parameters:
faction faction whose database we will check
id id of the player we want to check
int GetStatus ( uint  faction,
uint  id 
)

Gets the status of the given player, stores it in the appropriate argument.

Parameters:
faction faction whose database we will check
id id of the player we want to check
int GetRank ( uint  faction,
uint  id 
)

Gets the rank of the given player, stores it in the appropriate argument.

Parameters:
faction faction whose database we will check
id id of the player we want to check
rank player's rank will be stored there
bool IsMember ( uint  faction,
Critter cr 
)

Checks if the player with given id is the member of the faction.

Parameters:
faction faction whose database we will check
cr critter we want to check
Returns:
true if player belongs to the given faction, false when otherwise or when not found
bool IsMemberOffline ( uint  faction,
uint  id 
)
bool StoredInDB ( uint  faction,
uint  id 
)

Checks if the player with given id exists in the database.

Parameters:
faction faction whose database we will check
id id of the player we want to check
Returns:
true if player is in db, false otherwise
uint GetLeaderId ( uint  faction  ) 

Gets the id of the leader.

void SetLeaderId ( uint  faction,
uint  id 
)

Sets the id of the leader.

uint GetClaimId ( uint  faction  ) 

Gets the id of the player who claimed leadership.

void SetClaimId ( uint  faction,
uint  id 
)

Sets the id of the player who claimed leadership.

uint GetLeaderTime ( uint  faction  ) 

Gets the time when claimee will be able to confirm leadership without doing anything.

void SetLeaderTime ( uint  faction,
uint  time 
)

Sets the time when claimee will be able to confirm leadership without doing anything This is time for leader to act.

uint GetClaimTime ( uint  faction  ) 

Gets the time when next claim will be allowed (current claimee will loose his claim).

void SetClaimTime ( uint  faction,
uint  time 
)

Sets the time when next claim will be allowed (current claimee will loose his claim) This is time for claimee to act.

uint16 GetFactionRadioChannel ( uint  faction  ) 
void SetFactionRadioChannel ( uint  faction,
uint16  channel 
)

Sets the radio channel for given faction.

uint GetFactionLocationId ( uint  faction  ) 

Retrieves location id for the faction if the returned value is 0 it means faction doesn't use dynamically created location, or there was some error that should have been handled earlier (like not checking returned value of CreateLocation).

void SetFactionLocation ( uint  faction,
uint  locId,
uint  pid,
uint  x,
uint  y 
)

Sets new location data for faction hq.

bool GetFactionLocation ( uint  faction,
uint& out  locId,
uint& out  pid,
uint& out  x,
uint& out  y 
)

Gets location data for player-faction hq.

void GetFactionLocationCoords ( uint  faction,
uint& out  x,
uint& out  y 
)

Gets location coords.

uint GetFactionScore ( uint  faction  ) 

Gets faction score - some global value used to abstract how succesfull faction is in some of their endeavours.

void ModifyFactionScore ( uint  faction,
int  amount 
)

Modifies faction score by given amount.

int ModifyStatus ( uint  faction,
uint  id,
uint  newStatus 
)

Modfy the player's status stored in db.

Parameters:
faction faction whose database we will modify
id player, the info about we want to modify
newStatus new value for player's status
Returns:
FD_RESULT_* value (see _factions.fos)
int ModifyRank ( uint  faction,
uint  id,
uint  newRank 
)

Modfy the player's rank stored in db.

Parameters:
faction faction whose database we will modify
id player, the info about we want to modify
newRank new value for player's rank
Returns:
FD_RESULT_* value (see _factions.fos)
int ModifyFaction ( uint  faction,
uint  id,
uint  newFaction 
)

Modfy the player's faction stored in db.

Parameters:
faction faction whose database we will modify
id player, the info about we want to modify
newFaction new value for player's faction
Returns:
FD_RESULT_* value (see _factions.fos)
int InvitePlayer ( uint  faction,
uint  playerId 
)

Invites player to be a member of the faction.

Parameters:
faction faction whose database we will update
playerId id of the player we want to add
Returns:
FD_RESULT_* value (see _factions.fos)
int ConfirmInvitation ( uint  faction,
uint  playerId 
)

Adds member, who has been previously invited, to the given faction.

Parameters:
faction faction whose database we will update
playerId id of the player we want to add
Remarks:
This method also updates local variables: * LVAR_factions_player_faction * LVAR_factions_player_rank
Returns:
FD_RESULT_* value (see _factions.fos)
int AddMember ( uint  faction,
uint  playerId,
bool  applyModifiers 
)

Adds member to the given faction.

Parameters:
faction faction whose database we will update
playerId id of the player we want to add
applyModifiers whether to apply reputation mods or not
Returns:
FD_RESULT_* value (see _factions.fos)
int AddMember ( uint  faction,
uint  playerId 
)
int ChangeRank ( uint  faction,
uint  playerId,
uint  newRank 
)

Change the players rank.

That means: * degradation/promotion

Parameters:
faction faction whose database we will modify
playerId id of the player, whose info about we want to modify
newRank new value for the player's rank
Returns:
FD_RESULT_* value (see _factions.fos)
int ExpelMember ( uint  faction,
uint  playerId,
bool  applyModifiers 
)

Expel member.

Parameters:
faction faction whose database we will modify
playerId id of the player, whose info about we want to modify
applyModifiers whether to apply reputation modifiers on leaving or not
Remarks:
When player's faction is the same as the database owning faction, we also modify appropriate local variable: LVAR_factions_player_faction
Returns:
FD_RESULT_* value (see _factions.fos)
int ExpelMember ( uint  faction,
uint  playerId 
)
void AddFactionNews ( uint  faction,
uint  master,
uint  slave,
uint  type 
)

Adds news.

Parameters:
master id of the player performing operation of given type
slave id of the player on which operation is performed
type type of the opeartion
time time at which operation happened (__FullSecond/ELAPSED_TIME)
bool GetFactionNews ( uint  faction,
uint  index,
uint& out  master,
uint& out  slave,
uint& out  type,
uint16& out  year,
uint8& out  month,
uint8& out  day,
uint8& out  hour,
uint8& out  minute 
)

Retrieves news stored at given index.

uint GetFactionNewsCount ( uint  faction  ) 

Retrieves number of news stored for a given faction.

uint GetPlayerFaction ( uint  playerId  ) 

Helper method to determine faction player belongs too described in appropriate local variable.

uint GetPlayerRank ( uint  playerId  ) 

Helper method to determine rank of the player which is stored in appropriate local variable.

int GetFactionNameMsg ( uint  faction  ) 

Retrieves number of the msg string representing faction name.

int GetFactionAliasNameMsg ( uint  faction  ) 

Retrieves number of the msg string representing faction variation name(aliases).

uint CheckFactionBaseCoords ( uint  x,
uint  y 
)

Checks whether given coords are within base area of one of the playerfactions returns faction id in case of success, 0 otherwise.

bool IsGang ( uint  faction  ) 

Checks if faction is playerdriven gang.

bool IsBigFaction ( uint  faction  ) 
bool IsTheSameFaction ( uint  player1Id,
uint  player2Id 
)
void _Resign ( uint  playerId  ) 
void UpdateLastUsed ( uint  faction  ) 

Updates 'last used' variable, that tracks time when faction was last time accessed.

It sets the time for current full minute.

uint GetFactionLog ( uint  faction,
bool  fullLog,
array< string >&  strings,
uint  begin,
uint  end 
)

creates array of strings representing log of the faction data if faction is 0 then all are displayed returns number of strings

bool SaveFactionData ( uint  faction  ) 
bool FactionExists ( uint  faction  )