private void RefreshContextForFactionMembers(ICharacter character) { if (!this.IsSharedWithPartyAndFactionMembers) { return; } var factionMembers = FactionSystem.ServerGetFactionMembersReadOnly(character); if (factionMembers.Count <= 1) { // no party or single-player party return; } var currentCharacterName = character.Name; foreach (var factionMemberEntry in factionMembers) { var factionMemberName = factionMemberEntry.Name; if (factionMemberName == currentCharacterName) { continue; } var factionMember = Api.Server.Characters .GetPlayerCharacter(factionMemberName); if (factionMember is not null) { var context = this.GetActiveContext(factionMember, out _); context?.Refresh(); } } }
public string Execute(ICharacter player) { var faction = FactionSystem.ServerGetFaction(player); if (faction is null) { return($"Player \"{player.Name}\" has no faction"); } var memberEntries = FactionSystem.ServerGetFactionMembersReadOnly(faction); var sb = new StringBuilder("Player \"") .Append(player.Name) .AppendLine("\" - faction info:") .Append("Clan tag: ") .Append("[") .Append(FactionSystem.SharedGetClanTag(faction)) .AppendLine("]") .AppendLine("Members list (with roles): "); foreach (var entry in memberEntries) { sb.Append(" * ").AppendLine(entry.Name + " - " + entry.Role); } return(sb.ToString()); }
private static void ServerNotifyFactionMembers( ILogicObject faction, ICharacter founderCharacter, ILogicObject area, ILogicObject areasGroup) { var charactersToNotify = FactionSystem.ServerGetFactionMembersReadOnly(faction); var playerCharactersToNotify = new List <ICharacter>(); foreach (var memberEntry in charactersToNotify) { var character = Server.Characters.GetPlayerCharacter(memberEntry.Name); if (character is not null && !LandClaimSystem.ServerIsOwnedArea(area, character, requireFactionPermission: false)) { playerCharactersToNotify.Add(character); } } if (playerCharactersToNotify.Count == 0) { return; } var founderCharacterName = founderCharacter.Name; var mark = new ServerAllyBaseUnderRaidMark(areasGroup, founderCharacterName, clanTag: null); ServerNotifiedCharactersForAreasGroups[mark] = playerCharactersToNotify; var mapPosition = LandClaimSystem.SharedGetLandClaimGroupCenterPosition(areasGroup); Instance.CallClient(playerCharactersToNotify, _ => _.ClientRemote_AllyBaseUnderRaid( areasGroup.Id, mark.FactionMemberName, mark.ClanTag, mapPosition)); }
protected override bool ServerIsCompleted(ICharacter character, PlayerTaskStateWithCount state) { if (base.ServerIsCompleted(character, state)) { return(true); } if (!this.IsSharedWithPartyAndFactionMembers || this.TaskTarget is not IProtoQuest) { return(false); } // check whether any of the other party members has this requirement satisfied var currentCharacterName = character.Name; var partyMembers = PartySystem.ServerGetPartyMembersReadOnly(character); if (partyMembers.Count > 1) { foreach (var partyMemberName in partyMembers) { if (partyMemberName == currentCharacterName) { continue; } var partyMember = Api.Server.Characters .GetPlayerCharacter(partyMemberName); if (partyMember is null) { continue; } if (partyMember.SharedGetQuests() .SharedHasCompletedTask(this)) { // party member has satisfied this requirement return(true); } } } // check whether any of the other faction members has this requirement satisfied if (FactionSystem.ServerGetFaction(character) is { } faction && FactionSystem.SharedGetFactionKind(faction) != FactionKind.Public) { var factionMembers = FactionSystem.ServerGetFactionMembersReadOnly(faction); if (factionMembers.Count > 1) { foreach (var factionMemberEntry in factionMembers) { var factionMemberName = factionMemberEntry.Name; if (factionMemberName == currentCharacterName) { continue; } var factionMember = Api.Server.Characters .GetPlayerCharacter(factionMemberName); if (factionMember is null) { continue; } if (factionMember.SharedGetQuests() .SharedHasCompletedTask(this)) { // faction member has satisfied this requirement return(true); } } } } return(false); }