Example #1
0
        private bool ServerRemote_OfficerSetEmblem(FactionEmblem emblem)
        {
            throw new Exception("This feature is disabled");
#pragma warning disable 162
            var officer = ServerRemoteContext.Character;
            ServerValidateHasAccessRights(officer,
                                          FactionMemberAccessRights.EditDescription,
                                          out var faction);

            if (!SharedFactionEmblemProvider.SharedIsValidEmblem(emblem))
            {
                throw new Exception("The faction emblem is invalid");
            }

            var factionPublicState = Faction.GetPublicState(faction);
            if (factionPublicState.Emblem.Equals(emblem))
            {
                // this faction already has the same emblem
                return(true);
            }

            if (ServerIsEmblemUsed(emblem))
            {
                return(false);
            }

            factionPublicState.Emblem = emblem;
            Logger.Important("Faction emblem changed: " + faction, officer);
            return(true);

#pragma warning restore 162
        }
Example #2
0
        public static bool SharedIsValidEmblem(FactionEmblem emblem)
        {
            EnsureInitialized();

            return(allForegroundFiles.Contains(emblem.ForegroundId) &&
                   allBackgroundFiles.Contains(emblem.BackgroundId) &&
                   allShapeMaskFiles.Contains(emblem.ShapeMaskId) &&
                   SupportedColorsForeground.Contains(emblem.ColorForeground) &&
                   SupportedColorsBackground.Contains(emblem.ColorBackground1) &&
                   SupportedColorsBackground.Contains(emblem.ColorBackground2));
        }
Example #3
0
        public static Task <bool> ClientOfficerSetEmblem(FactionEmblem emblem)
        {
            throw new Exception("This feature is disabled");
#pragma warning disable 162
            ClientValidateHasAccessRights(FactionMemberAccessRights.EditDescription);

            if (emblem.Equals(
                    Faction.GetPublicState(ClientCurrentFaction).Emblem))
            {
                // this faction already has the same emblem
                return(Task.FromResult(true));
            }

            return(Instance.CallServer(
                       _ => _.ServerRemote_OfficerSetEmblem(emblem)));

#pragma warning restore 162
        }
Example #4
0
 public static bool TryGetValue(string clanTag, out FactionEmblem emblem)
 {
     return(CacheEmblems.TryGetValue(clanTag, out emblem));
 }