Difference between revisions of "Server:Faction"
Line 1: | Line 1: | ||
This article will attempt to explain how faction works server-side to assist with understanding the various modifiers applied to characters between the base values and the ones you experience in-game. | This article will attempt to explain how faction works server-side to assist with understanding the various modifiers applied to characters between the base values and the ones you experience in-game. | ||
In the source code, faction is found in [https://github.com/EQMacEmu/Server/blob/main/common/faction.h /common/faction.h] and [https://github.com/EQMacEmu/Server/blob/main/common/faction.cpp /common/faction.cpp]. Faction is calculated in the '''CalculateFaction''' function, where | In the source code, faction is found in [https://github.com/EQMacEmu/Server/blob/main/common/faction.h /common/faction.h] and [https://github.com/EQMacEmu/Server/blob/main/common/faction.cpp /common/faction.cpp]. Faction is calculated in the '''CalculateFaction''' function which gets called from [https://github.com/EQMacEmu/Server/blob/bbd8993065a96e6db96dd9d5099d445d5bdc7e27/zone/client.cpp#L4387 /zone/client.cpp]in the '''GetFactionLevel''' function, where | ||
<code>character_value += base value + class modifier + race modifier + deity modifier</code> | <code>character_value += base value + class modifier + race modifier + deity modifier</code> |
Revision as of 11:04, 21 November 2024
This article will attempt to explain how faction works server-side to assist with understanding the various modifiers applied to characters between the base values and the ones you experience in-game.
In the source code, faction is found in /common/faction.h and /common/faction.cpp. Faction is calculated in the CalculateFaction function which gets called from /zone/client.cppin the GetFactionLevel function, where
character_value += base value + class modifier + race modifier + deity modifier
The result of this formula is then returned as a Faction Value Ranges.
Faction Properties
The Faction struct defined in /common/faction.h defines the following members:
Property | Data Type | Description |
---|---|---|
id | int32 | database identifier |
mods | std::map<std::string, int16> | |
base | int16 | The base, unmodified value that players start with for this faction before race, class, and deity modifiers are applied |
name | char array 50 | The name of the faction |
see_illusion | bool | Determines whether the faction will see through racial illusion spells |
min_cap | int16 | Minimum value players can reach with this faction |
max_cap | int16 | Maximum value players can reach with this faction |
Faction Modifiers
The FactionMod struct defined in /common/faction.h defines the following members:
- int32 base
- int32 class_mod
- int32 race_mod
- int32 deity_mod
Faction Value Ranges
Min Cap | Max Cap | FACTION_VALUE (Enum) |
---|---|---|
>= 2000 | - | FACTION_MAX_ALLY = 0 |
>= 1100 | - | FACTION_ALLY = 1 |
>= 750 | <= 1099 | FACTION_WARMLY = 2 |
>= 500 | <= 749 | FACTION_KINDLY = 3 |
>= 100 | <= 499 | FACTION_AMIABLY = 4 |
>= 0 | <= 99 | FACTION_INDIFFERENTLY = 5 |
>= -100 | <= -1 | FACTION_APPREHENSIVELY = 6 |
>= -500 | <= -101 | FACTION_DUBIOUSLY = 7 |
>= -750 | <= -501 | FACTION_THREATENINGLY = 8 |
- | <= -751 | FACTION_SCOWLS = 9 |
- | <= -2000 | FACTION_MAX_SCOWLS = 10 |
The range of faction values above which are returned as the enums described in the final column are filtered through the const char *FactionValueToString(FACTION_VALUE faction_value); function to convert them to the corresponding string equivalent before being sent to the client and used for in-game consider or similar messages.
NPC Faction
The NPCFaction struct defined in /common/faction.h defines the following members:
Property | Data Type | Description |
---|---|---|
factionID | uint32 | |
value_mod | int32 | |
npc_value | int8 | |
temp | uint8 |