Aura.Channel.Scripting.Scripts.NpcScript.Hook C# (CSharp) Метод

Hook() защищенный Метод

Execute Hook! Harhar.
Runs all hook funcs, one by one.
protected Hook ( string hookName ) : Task
hookName string
Результат Task
		protected async Task<bool> Hook(string hookName, params object[] args)
		{
			// Not hooked if no hooks found
			var hooks = ChannelServer.Instance.ScriptManager.NpcScriptHooks.Get(this.NPC.Name, hookName);
			if (hooks == null)
				return false;

			foreach (var hook in hooks)
			{
				var result = await hook(this, args);
				switch (result)
				{
					case HookResult.Continue: continue; // Run next hook
					case HookResult.Break: return true; // Stop and go back into the NPC
					case HookResult.End: this.Exit(); return true; // Exit script
				}
			}

			// Not hooked if no break or end.
			// XXX: Technically a script could do something and return
			//   Continue, which would make it hooked without break,
			//   but you really shouldn't continue on hook, it would lead
			//   to confusing dialogues... Maybe add a second Continue type,
			//   in case we actually need it.
			return false;
		}