예제 #1
0
        public static IEnumerable <string> GetFlagList(this IGameEntity entity)
        {
            Validation.IsNotNull(entity, "entity");
            Validation.IsNotNull(entity.GetFlagContext(), "entity.Flags");

            return(entity.GetFlagContext().FlagList);
        }
예제 #2
0
        public static string GetFlags(this IGameEntity entity)
        {
            Validation.IsNotNull(entity, "entity");
            Validation.IsNotNull(entity.GetFlagContext(), "entity.Flags");

            return(entity.GetFlagContext().Flags);
        }
예제 #3
0
        public static bool UnsetFlag(this IGameEntity entity, string aFlag)
        {
            Validation.IsNotNull(entity, "entity");
            Validation.IsNotNullOrEmpty(aFlag, "aFlag");
            Validation.IsNotNull(entity.GetFlagContext(), "entity.Flags");

            return(entity.GetFlagContext().UnsetFlag(aFlag));
        }
예제 #4
0
        public static void SetFlagList(this IGameEntity entity, ICollection <string> flagList)
        {
            Validation.IsNotNull(entity, "entity");
            Validation.IsNotNull(entity.GetFlagContext(), "entity.Flags");
            Validation.IsNotNull(flagList, "flagList");
            Validation.IsNotEmpty(flagList);

            entity.GetFlagContext().FlagList = flagList;
        }
예제 #5
0
        private bool ExecuteVerb(Tuple <Action, Definition> tuple, IGameEntity entity, string phrase)
        {
            var action     = tuple.Item1.CastAs <Action>();
            var commandDef = tuple.Item2.CastAs <GameCommandDef>();

            if (commandDef.AdminOnly && !CommandManager.AdminFlagCheckAndNotify(entity, entity.GetFlagContext()))
            {
                return(false);
            }

            if (commandDef.LogAction == Globals.LogActionTypes.Always)
            {
                Logger.InfoFormat("Entity[{0}, {1}] executed Action[{2}, {3}]", entity.ID, entity.Name,
                                  commandDef.ID, commandDef.Name);
            }

            action.DynamicInvoke(phrase);
            return(true);
        }