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)); }
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; } } }
public bool HasProg(MudProgTypes type) => HasProg((int)type);
public static bool ExecuteRoomProg(MudProgTypes mudProgType, params object[] args) => _kernel.Get <IMudProgHandler>().Execute(MudProgLocationTypes.Room, mudProgType, args);