====== Guild subsystem ====== This file has functions used by the guild subsystem. This includes functions to check whether user is member of the guild, and what rank he has, and also routines to advance in guild etc. Guilds are identified in the cerea2 by the guild tag, which is short string following normal tag rules. It should be descriptive enough to identify the guild, but short enough it can be used as part of the tags in various places. Each guild has a guild object placed somewhere and will have the "guild_" as a tag (lowercased guild tag). The guild object should be some placeable with empty description (the description is replaced with the member list of guild). It should also be plot, and usable, but not static. It can also have examine as default action. The guild object will have variables describing the guild. Variables required in the object are: ^ Variable name ^ Type ^ Description ^ | Name | String | Describes the full guild name | | MemberType | Int | Type of Members: | | | | 0 = Normal (initiate, apprentice, journeyman, master, senior master). | | | | 1 = Church (initiate, evangelist, priest, bishop, archbishop). | | | | 2 = Paladin (initiate, squire, paladin, commander, senior commander). | | | | 3 = Military (recruit, trooper, sergeant, leutenant, captain). | | | | 4 = Citizen (resident, citizen, prominent citizen, council member, leader). | | | | 5 = Druids (initiate, apprentice, druid, masterdruid, archdruid). | | PriClasses | String | Comma separated list of primary classes (or empty == any) | | SecClasses | String | Comma separated list of secondary classes (or empty == none) | | Alignments | String | Comma separated list of alignments (CG, CN, CE, NG, TN, NE, LG, LN, LE). Entry is allowed if any of them match. (or empty == any) | | ConflictingGuilds | String | Comma separated list of conflicting guild tags. Note, that if this is church with multiple orders, then this probably should list other orders as conflicting guilds, so PC can only join one of the guilds. Entry is forbidden if any of the guilds match. (or empty == none) | | RequiredGuilds | String | Comma separated list of required guilds tags with levels (guild_tag:min_level). Min level is number 1 = initiate, 2 = journeyman etc.. and PC must have that rank or higher. Entry is allowed if any of the guilds match. If min_level is missing then 1 is assumed. (or empty == none) | | MinLevel | Int | Minimum level required to join (1..20) | | RequiredVariable1 | String | PC must have variable specified here set on persistent storage to be able to join. This is in form of ",,,", where is the Int variable name in category , and it must have value to fulfill this requirement. If requirement is not fulfilled then is printed to PC. It should be in form that can be printed always, i.e. not "You do not have shop in Vesper", but instead "You need to have shop in Vesper", which can be printed when listing requirements and when complaining why PC does not fulfill requirements. Before the variable is retrieved the '*' characters in the name are replaced with the actual guild tag. | | RequiredVariable2 | String | PC must have variable specified here set on persistent storage to be able to advance to apprentice level. | | RequiredVariable3 | String | PC must have variable specified here set on persistent storage to be able to advance to journeyman level. | | RequiredVariable4 | String | PC must have variable specified here set on persistent storage to be able to advance to master level. | | RequiredVariable5 | String | PC must have variable specified here set on persistent storage to be able to advance to senior master level. This defaults to "*_SM" | | RequiredVariable6 | String | PC must have variable specified here set on persistent storage to be able to advance to high master level. This defaults to "*_HighMaster" | | RequiredDomains | String | Comma separated list of domains. Entry is allowed if any of the domains match. | | RequiredDeity | String | Comma separated list of deities. Entry is allowed if any of the deities match. | Note that each guild is made as separate object, including each order of the church, i.e. inside the game each order is considered as separate guild. Guild clerk must have cd_g_guild_clerk as a dialog, and must have following variables set: ^ Variable name ^ Type ^ Description ^ | Guild | String | Tag of the guild (without "guild_" prefix) | then either: ^ Variable name ^ Type ^ Description ^ | guild_who | String | String describing who the guild clerk is | | guild_what | String | String describing what this guild is | | guild_talk | String | String describing who else to talk to in guild | or ^ Variable name ^ Type ^ Description ^ | guild_dialog | String | Resref of the dialog to spawn when PC asks questions about the guild. When the dialog is spawned then the GuildQ variable of the guild clerk is set to 1 if asking for who, 2 if asking about what, and 3 if asking who else to talk to. This dialog should always offer way to get back to the main dialog, by using action ca_g_d_returndialog. | ====== Enumerating through guilds ====== ===== C_GetGuildNext ===== (**Guild**) If sGuildTag is empty then return first guild the oPC is member of. If not empty, return next guild. When all guilds processed return empty string string C_GetGuildNext(object oPC, string sGuildTag); ===== C_GetGuildName ===== (**Guild**) Return guild name string C_GetGuildName(object oPC, string sGuildTag); ====== Guild Ranks ====== ===== C_GetGuildRank ===== (**Guild**) Return rank number for the PC for the guild sGuildTag. If member is retired or expelled, then this will aways return CI_GUILD_NOT_MEMBER. int C_GetGuildRank(object oPC, string sGuildTag); ===== C_GetGuildRankString ===== (**Guild**) Return rank text for the PC for the guild sGuildTag. If the member is retired or expelled, then this will return the text "Retired " or "Expelled ". string C_GetGuildRankString(object oPC, string sGuildTag); ====== Advancing and Demoting Inside the Guild ====== ===== C_CheckGuildRequirements ===== (**Guild**) Check if the oPC fulfills the requirements needed to advance in the guild sGuildTag to level nLevel. If all requirements are fulfilled then return empty string otherwise return error text that can be shown to user to indicate what requirements they are missing. if CI_GUILD_LEVEL_NEXT is used as nLevel, then check requirements for the next level in guild. If member has expelled status in guild, then this will always return error. string C_CheckGuildRequirements(object oPC, string sGuildTag, int nLevel = CI_GUILD_LEVEL_NEXT); ===== C_GetGuildRequirements ===== (**Guild**) Return guild requirements as string string C_GetGuildRequirements(object oPC, string sGuildTag, int nLevel = CI_GUILD_LEVEL_NEXT); ===== C_AdvanceLevelInGuild ===== (**Guild**) Advance member oPC in the guild sGuildTag to level nLevel. This will NOT check requirements, those check are done by the [[#C_CheckGuildRequirements]] above, and that function should always be called before calling this. This will check that rank must be advancing, and will fail and error in case this is not true. This will also check that member is not expelled. It will always set status to active. void C_AdvanceLevelInGuild(object oPC, string sGuildTag, int nLevel = CI_GUILD_LEVEL_NEXT); ===== C_DemoteLevelInGuild ===== (**Guild**) Demote member oPC in the guild sGuildTag to level nLevel. This will check that rank must be demoting, and will fail and error in case this is not true. void C_DemoteLevelInGuild(object oPC, string sGuildTag, int nLevel = CI_GUILD_LEVEL_PREV); ===== C_SetLevelInGuild ===== (**Guild**) Set member oPC in the guild sGuildTag to have level nLevel instead of old level nOldLevel. This will not check anything, but will update the global membership registry. void C_SetLevelInGuild(object oPC, string sGuildTag, int nLevel, int nOldLevel); ===== C_GetMemberList ===== (**Guild**) Return membership string for guild. Include those levels which have bit on in the nLevelBitmask (CB_GUILD_*). Only nMaxLimit members from the top are returned. If nMaxLimit is -1 then there is no limit. string C_GetMemberList(object oPC, string sGuildTag, int nLevelBitmask = CB_GUILD_DEFAULT, int nMaxLimit = -1); ===== C_CheckGuildReputation ===== (**Guild**) Check if player has enough reputation points to advance string C_CheckGuildReputation(object oPC, string sGuildTag, int nLevel = CI_GUILD_LEVEL_NEXT); ===== C_ConsumeGuildReputation ===== (**Guild**) Consume required reputation points when advancing rank in guild void C_ConsumeGuildReputation(object oPC, string sGuildTag, int nLevel = CI_GUILD_LEVEL_NEXT); ====== Giving Out Recommendations ====== ===== C_GetGuildRecommendationCost ===== (**Guild**) Return number of reputation points needed for oPC to give recommendation to oTarget for the guild sGuildTag. If returns -1, then no recommendation can be given int C_GetGuildRecommendationCost(object oPC, string sGuildTag, object oTarget); ===== C_GetGuildRecommendationPoints ===== (**Guild**) Return number of effective reputation points to be passed to oTarget when giving recommendation the guild sGuildTag. If returns -1, then no recommendation can be given. int C_GetGuildRecommendationPoints(object oPC, string sGuildTag, object oTarget); ===== C_GiveGuildRecommendation ===== (**Guild**) Gives recommendation from oPC to oTarget for advancing in sGuildTag. Consumes reputation points from the oPC. void C_GiveGuildRecommendation(object oPC, string sGuildTag, object oTarget); ===== C_GetGuildRecommendationList ===== (**Guild**) Returns a comma separated list of guild tags where the oPC can give recommendations for the oTarget string C_GetGuildRecommendationList(object oPC, object oTarget); ====== Setting guild status ====== ===== C_GetGuildStatus ===== (**Guild**) Return the status of the oPC in the guild sGuildTag. int C_GetGuildStatus(object oPC, string sGuildTag); ===== C_GetGuildStatusString ===== (**Guild**) Return the status of the oPC in the guild sGuildTag as string. string C_GetGuildStatusString(object oPC, string sGuildTag); ===== C_SetGuildStatus ===== (**Guild**) Set the status of the oPC in the guild sGuildTag to nStatus. void C_SetGuildStatus(object oPC, string sGuildTag, int nStatus); ====== Guild lists etc ====== ===== C_GetGuildsString ===== (**Guild**) Return string describing the list of guilds oPC is member of and the ranks in them if bPrintRanks is TRUE. string C_GetGuildsString(object oPC, int bPrintRanks = TRUE);