Public Types | |
typedef std::map< DWORD, Member > | MemberList |
Public Member Functions | |
void | LoadAllegiance (DWORD ID, DWORD leaderGUID, char name[40], char MOTD[255]) |
void | CreateAllegiance (DWORD leaderGUID) |
void | Disband () |
Member * | FindMember (DWORD memberGUID) |
DWORD | GetID () |
DWORD | GetLeader () |
DWORD | GetSize () |
std::string | GetName () |
std::string | GetMOTD () |
void | InsertMember (Member member, DWORD dwPatronGUID) |
void | EraseMember (Member *member) |
void | EraseMember (DWORD dwMemberGUID) |
bool | AddDirectVassal (Member *memPatron, Member *memVassal) |
bool | AddDirectVassal (DWORD dwPatronGUID, DWORD dwVassalGUID) |
bool | RemDirectVassal (Member *memVassal) |
bool | RemDirectVassal (DWORD dwVassalGUID) |
void | SetMOTD (std::string motd) |
std::string | GetMemberName (Member *member) |
std::string | GetMemberName (DWORD dwMemberGUID) |
int | GetVassalCount (Member *member) |
int | GetVassalCount (DWORD dwMemberGUID) |
int | GetFollowerCount (Member *member) |
int | GetFollowerCount (DWORD dwMemberGUID) |
void | UpdateFollowers (Member *member, int numFollowers) |
void | UpdateFollowers (DWORD dwMemberGUID, int numFollowers) |
void | UpdateRank (Member *member) |
void | UpdateRank (DWORD dwMemberGUID) |
void | VassalPassupXP (Member *memVassal, UINT64 experience, bool isGrandVassal=false) |
void | UpdateGeneratedXP (Member *member, UINT64 experience) |
void | UpdateEarnedXP (Member *member, UINT64 experience) |
UINT64 | CalcVassalGeneratedXP (Member *memVassal, UINT64 experience, bool isGrandPatron=false) |
UINT64 | CalcPatronReceivedXP (Member *memPatron, UINT64 experience, bool isGrandPatron=false) |
void | UpdateAverageSwornTimeOfVassals (Member *memPatron) |
float | CalcVassalFactor (int numVassals) |
cMessage | GetAllegianceInfo (DWORD avatarGUID) |
Static Public Member Functions | |
static cAllegiance * | GetAllegianceByID (DWORD AllegianceID) |
static void | SetLeader (DWORD allegianceID, DWORD leaderGUID) |
static bool | AddNewMember (DWORD dwAvatarGUID, DWORD dwPatronGUID, DWORD oldAllegianceID, DWORD newAllegianceID) |
static bool | AddRemMember (Member *member, DWORD oldAllegianceID, DWORD newAllegianceID) |
static bool | RemMember (DWORD dwRemMemberGUID, DWORD oldAllegianceID, bool isDisbanding=false) |
static bool | SwitchMonarchAndVassals (Member *member, DWORD oldAllegianceID, DWORD newAllegianceID) |
static bool | SwitchNonMonarchVassals (Member *member, DWORD oldAllegianceID, DWORD newAllegianceID) |
static void | UpdatePlayerAllegID (Member *member, DWORD newAllegianceID) |
static void | UpdatePlayerAllegID (DWORD dwPlayerGUID, DWORD newAllegianceID) |
static void | LoadMembersFromDB (cAllegiance *aAllegiance) |
static void | UpdateAvatarAllegIDDB (DWORD dwGUID, DWORD allegianceID) |
static void | UpdateMemberAllegIDDB (DWORD dwGUID, DWORD allegianceID) |
static void | UpdateAvatarRecordDB (DWORD dwAvatarGUID) |
static void | AddMemberRecordDB (DWORD allegianceID, DWORD dwAvatarGUID, DWORD dwPatronGUID) |
static void | DeleteMemberRecordDB (DWORD allegianceID, DWORD dwMemberGUID) |
static void | UpdateMemberRecordDB (Member *member) |
static void | UpdateMemberXPPassupDB (DWORD memberGUID, UINT64 passedXP) |
static void | UpdateMemberXPPendingDB (DWORD memberGUID, UINT64 pendingXP) |
static void | UpdateMemberFollowersDB (DWORD memberGUID, int numFollowers) |
static void | UpdateMemberRankDB (DWORD memberGUID, int rank) |
static void | UpdateMemberPatronDB (DWORD memberGUID, DWORD patronGUID) |
Public Attributes | |
MemberList | members |
Protected Attributes | |
DWORD | m_ID |
std::string | m_Name |
DWORD | m_LeaderGUID |
std::string | m_MOTD |
int | m_Size |
ULONG | m_CreationTime |
Friends | |
class | cMasterServer |
bool cAllegiance::AddDirectVassal | ( | DWORD | dwPatronGUID, | |
DWORD | dwVassalGUID | |||
) |
Adds a vassal to the patron's vassal list.
The patron's follower count and rank are both recaluated.
memPatron | - The GUID of the patron. | |
memVassal | - The GUID of the vassal to add to his/her patron's vassal list. |
Adds a vassal to the patron's vassal list.
The patron's follower count and rank are both recaluated.
memPatron | - A pointer to the member record of the patron. | |
memVassal | - A pointer to the member record of the vassal to add to his/her patron's vassal list. |
bool cAllegiance::AddNewMember | ( | DWORD | dwAvatarGUID, | |
DWORD | dwPatronGUID, | |||
DWORD | oldAllegianceID, | |||
DWORD | newAllegianceID | |||
) | [static] |
Adds a player (and any vassals under him/her) to an allegiance.
The function is used when a player pledges allegiance to a member of an allegiance. Each follower of that member should also be added to the allegiance. The "old" allegiance to which these members belonged should be deleted if the pledged member was the monarch.
dwAvatarGUID | - The GUID of the player to add. | |
dwPatronGUID | - The GUID of the new patron of the player to add. | |
oldAllegianceID | - The ID of player's former allegiance, if any. | |
newAllegianceID | - The ID of player's new allegiance. |
bool cAllegiance::AddRemMember | ( | Member * | member, | |
DWORD | oldAllegianceID, | |||
DWORD | newAllegianceID | |||
) | [static] |
Adds a removed player (and all of his/her followers) to a new allegiance.
The player and the vassals under the player switching are switched.
member | - The member whose allegiance should be switched. | |
oldAllegianceID | - The ID of the member's former allegiance. | |
newAllegianceID | - The ID of the member's new allegiance. |
UINT64 cAllegiance::CalcPatronReceivedXP | ( | Member * | memPatron, | |
UINT64 | receivedXP, | |||
bool | isGrandPatron = false | |||
) |
Calculates the percentage of experience received by a grand patron.
Received % - % XP that patron will receive from his vassal's Generated XP.
Old Patron Received % = 68 + (.35 * ALdr) (max 1.25) New Patron Received % = 50.0 + 22.5 * (BLdr / 291) * (1.0 + V * (RT2/730) * (IG2/720)) Old Grand Patron Received % = 68 + (.35 * ALdr) (max 1.25) New Grand Patron Received % = 16.0 + 8.0 * (BLdr / 291) * (1.0 + V * (RT2/730) * (IG2/720))
Variables: ALdr = Adjusted Leadership (163 max) = BLrd + (((7.5 * V) / 100) * BLrd) + ((IG2 / 1200) * BLrd) BLdr = Buffed Leadership (291 max) RT2 = average real-time sworn to patron for all vassals in days (730 max) IG2 = average in-game time sworn to patron for all vassals in hours (720 max) V = vassal factor Old: number of vassals New: (1 = 0.25, 2 = 0.50, 3 = 0.75, 4+ = 1.00) (1.0 max)
memPatron | - A pointer to the member record of the patron to use for the calculations. |
float cAllegiance::CalcVassalFactor | ( | int | numVassals | ) |
Calculates the vassal factor based upon a patron's number of vassals.
Used in the calculation of patron-received experience.
numVassals | - The number of vassals sworn to a given patron. |
UINT64 cAllegiance::CalcVassalGeneratedXP | ( | Member * | memVassal, | |
UINT64 | passedXP, | |||
bool | isGrandVassal = false | |||
) |
Calculates the percentage of experience passed up from a vassal.
Generated % - % XP to patron of vassal's Earned (hunting) XP
Old Vassal Generated % = 8.9 + (2 * 3.5 * (ALoy / 100)) New Vassal Generated % = 50.0 + 22.5 * (BLoy / 291) * (1.0 + (RT/730) * (IG/720)) Old Grand Vassal Generated % = 45 + (.15 * ALoy) New Grand Vassal Generated % = 16.0 + 8.0 * (BLoy / 291) * (1.0 + (RT/730) * (IG/720))
Variables: ALoy = Adjusted Loyalty = BLoy + ((IG / 240) * BLoy) BLoy = Buffed Loyalty (291 max) RT = actual real-time sworn to patron in days (730 max) IG = actual in-game time sworn to patron in hours (720 max)
memVassal | - A pointer to the member record of the vassal to use for the calculations. |
void cAllegiance::EraseMember | ( | DWORD | dwMemberGUID | ) |
Erases a member from the allegiance.
The function is used when a player should be deleted from an allegiance.
dwMemberGUID | - The GUID of the player whose member record should be deleted. |
void cAllegiance::EraseMember | ( | Member * | member | ) |
Erases a member from the allegiance.
The function is used when a player should be deleted from an allegiance.
member | - A pointer to the member record that should be deleted. |
int cAllegiance::GetFollowerCount | ( | DWORD | dwMemberGUID | ) |
Calculates the number of followers under a given character.
dwPatronGUID | - The GUID of the member whose followers should be calculated. |
int cAllegiance::GetFollowerCount | ( | Member * | member | ) |
Calculates the number of followers under a given character.
memPatron | - A pointer to the member record of the member whose followers should be calculated. |
int cAllegiance::GetVassalCount | ( | DWORD | dwPatronGUID | ) |
Calculates the number of direct vassals sworn to a given character.
dwPatronGUID | - The GUID of the member whose direct vassals should be calculated. |
int cAllegiance::GetVassalCount | ( | Member * | memPatron | ) |
Caclulates the number of direct vassals sworn to a given character.
memPatron | - A pointer to the member record of the member whose direct vassals should be calculated. |
void cAllegiance::InsertMember | ( | Member | member, | |
DWORD | dwPatronGUID | |||
) |
Inserts a member into the allegiance.
The function is used when a player should be inserted into an allegiance.
member | - The member record object for the member that should be inserted. | |
dwPatronGUID | - The GUID of the new member's patron. |
void cAllegiance::LoadMembersFromDB | ( | cAllegiance * | aAllegiance | ) | [static] |
Loads the allegiance's members into memory.
This function is called when the server is started. Loading this information at server boot reduces the impact of experience passing.
Allegiance members are loaded into a map with their GUID as key. Each member is a struct containing pertinent allegiance information.
bool cAllegiance::RemDirectVassal | ( | DWORD | dwVassalGUID | ) |
Removes a vassal from the patron's vassal list.
The patron's follower count and rank are both recaluated.
memVassal | - The GUID of the vassal to remove from his/her patron's vassal list. |
bool cAllegiance::RemDirectVassal | ( | Member * | memVassal | ) |
Removes a vassal from the patron's vassal list.
The patron's follower count and rank are both recaluated.
memVassal | - A pointer to the member record of the vassal to remove from his/her patron's vassal list. |
bool cAllegiance::RemMember | ( | DWORD | dwRemMemberGUID, | |
DWORD | oldAllegianceID, | |||
bool | isDisbanding = false | |||
) | [static] |
Removes a player (and any vassals under him/her) from an allegiance.
The function is used when a player breaks or is kicked/booted/banned from the allegiance. Each follower of that member should also be removed from the allegiance.
dwRemMemberGUID | - The GUID of the player to remove. | |
isDisbanding | - A boolean value representing whether to disband the allegiance. |
bool cAllegiance::SwitchMonarchAndVassals | ( | Member * | member, | |
DWORD | oldAllegianceID, | |||
DWORD | newAllegianceID | |||
) | [static] |
Switches a player's (and all of his/her followers') allegiance.
It is prefered over the non-monarch implementation, as it iterates rather than searches through the member map.
member | - The monach whose allegiance should be switched. | |
oldAllegianceID | - The ID of the monarch's former allegiance. | |
newAllegianceID | - The ID of the allegiance to which the monarch and his/her followers should be switched. |
bool cAllegiance::SwitchNonMonarchVassals | ( | Member * | member, | |
DWORD | oldAllegianceID, | |||
DWORD | newAllegianceID | |||
) | [static] |
Switches a player's followers' allegiance.
Only the vassals under the player switching are switched.
member | - The member whose allegiance should be switched. | |
oldAllegianceID | - The ID of the member's former allegiance. | |
newAllegianceID | - The ID of the member's new allegiance. |
void cAllegiance::UpdateAverageSwornTimeOfVassals | ( | Member * | memPatron | ) |
Calculates the average sworn time for a patron's vassals and updates the patron's member record.
This function calculates both the average in-game and average real-time sworn time for a patron's vassals. These values are used in the calculation of vassal experience pass-up to a patron.
memPatron | - A pointer to the member record of the patron to use for the calculations. |
void cAllegiance::UpdateEarnedXP | ( | Member * | member, | |
UINT64 | experience | |||
) |
Updates the member's earned experience.
The member may be logged-on or logged-off: If the member is logged-on, the experience is added directly to the avatar's unassigned experience. If the member is logged-off, the experience is added to the avatar's pending experience.
member | - A pointer to the member record of the member whose experience should be updated. | |
experience | - The amount of experience earned. |
void cAllegiance::UpdateFollowers | ( | DWORD | dwMemberGUID, | |
int | numFollowers | |||
) |
Updates the follower count for a branch of the allegiance tree.
The function is used to update the tree when a member is added or removed. Each follower of that member must be added/removed to/from the follower count for each allegiance member higher in the tree.
memberGUID | - The GUID of the base member from whom to start. | |
numFollowers | - The number of followers added or removed. |
void cAllegiance::UpdateFollowers | ( | Member * | member, | |
int | numFollowers | |||
) |
Updates the follower count for a branch of the allegiance tree.
The function is used to update the tree when a member is added or removed. Each follower of that member must be added/removed to/from the follower count for each allegiance member higher in the tree.
member | - A pointer to the member record of the base member from whom to start. | |
numFollowers | - The number of followers added or removed. |
void cAllegiance::UpdateGeneratedXP | ( | Member * | member, | |
UINT64 | experience | |||
) |
Updates the member's generated experience.
member | - A pointer to the member record of the member whose generated experience should be updated. | |
experience | - The amount of experience generated. |
void cAllegiance::UpdatePlayerAllegID | ( | DWORD | dwPlayerGUID, | |
DWORD | newAllegianceID | |||
) | [static] |
Updates the allegiance ID for a player.
The function is used to update a player's allegiance ID when he/she joins an allegiance or his/her allegiance is switched.
dwPlayerGUID | - The GUID of the player whose allegiance ID should be changed. | |
newAllegianceID | - The player's new allegiance ID. |
void cAllegiance::UpdatePlayerAllegID | ( | Member * | member, | |
DWORD | newAllegianceID | |||
) | [static] |
Updates the allegiance ID for a player.
The function is used to update a player's allegiance ID when he/she joins an allegiance or his/her allegiance is switched.
member | - A pointer to the member record of the player whose allegiance ID should be changed. | |
newAllegianceID | - The player's new allegiance ID. |
void cAllegiance::UpdateRank | ( | DWORD | dwMemberGUID | ) |
Updates the rank of a member.
A patron's rank is equal to the rank of the highest vassal or one higher than the two highest vassals of equal rank, whichever is greater. A patron's rank may change if he/she gains/loses a vassal, or if a vassal's rank changes. If a member's rank has changed, his/her patron's rank is also recalculated. The minimum rank is 1.
memberGUID | - The GUID of the base member/patron from whom to start. |
void cAllegiance::UpdateRank | ( | Member * | member | ) |
Updates the rank of a member.
A patron's rank is equal to the rank of the highest vassal or one higher than the two highest vassals of equal rank, whichever is greater. A patron's rank may change if he/she gains/loses a vassal, or if a vassal's rank changes. If a member's rank has changed, his/her patron's rank is also recalculated. The minimum rank is 1.
member | - A pointer to the member record of the base member/patron from whom to start. |
void cAllegiance::VassalPassupXP | ( | Member * | memVassal, | |
UINT64 | experience, | |||
bool | isGrandVassal = false | |||
) |
Calculates the percentage of experience passed up from a vassal.
memVassal | - A pointer to the member record of the vassal to use for the calculations. | |
experience | - The amount of experience from which to calculate pass-up. | |
isGrandVassal | - Is a grand vassal (a non-originator of the experience). |