Ejemplo n.º 1
0
        public bool Execute(MudProgLocationTypes locationType, MudProgTypes mudProgType, params object[] args)
        {
            if (!MudProgTable.ContainsKey(locationType))
            {
                return(false);
            }

            var functionList = MudProgTable[locationType];

            if (functionList.All(x => x.Type != mudProgType))
            {
                return(false);
            }

            var function = functionList.First(x => x.Type == mudProgType);

            return(function.Function.Invoke(args));
        }
Ejemplo n.º 2
0
        public static void CheckIfExecute(MobileInstance mob, MudProgTypes type)
        {
            foreach (var mprog in mob.MobIndex.MudProgs)
            {
                int chance;
                if (!int.TryParse(mprog.ArgList, out chance))
                {
                    throw new InvalidDataException();
                }

                if (mprog.Type != type || SmaugRandom.D100() > chance)
                {
                    continue;
                }

                mprog.Execute(mob);

                if (type != MudProgTypes.Greet && type != MudProgTypes.GreetAll)
                {
                    break;
                }
            }
        }
Ejemplo n.º 3
0
 public bool HasProg(MudProgTypes type) => HasProg((int)type);
Ejemplo n.º 4
0
 public static bool ExecuteRoomProg(MudProgTypes mudProgType, params object[] args)
 => _kernel.Get <IMudProgHandler>().Execute(MudProgLocationTypes.Room, mudProgType, args);