Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Invoke
- Action<MsgTaskDialog, Client> _invoker = TryGet(client.ActiveNpc) as Action<MsgTaskDialog, Client>;
- if (_invoker != null) _invoker.Invoke(npcRequest, client);
- #endregion
- public static void LoadAllNpcs()
- {
- Console.Write("\t Loading NpcAttribute ... ");
- _Tree = new RedBlackTree<uint, Delegate>();
- var methods = Assembly.GetCallingAssembly().GetTypes()
- .SelectMany(t => t.GetMethods())
- .Where(m => m.GetCustomAttributes(typeof(NpcAttribute), false).Length > 0)
- .ToArray();
- int count = 0;
- foreach (var i in methods)
- {
- foreach (var npcatt in i.GetCustomAttributes(false))
- {
- Console.Write("\b{0}", Loading.NextChar());
- NpcAttribute Att = npcatt as NpcAttribute;
- if (Att != null)
- {
- Delegate _Action;
- _Action = Delegate.CreateDelegate(typeof(Action<MsgTaskDialog, Client>), null, i);
- if (!_Tree.TryAppend((uint)Att.Type, _Action))
- {
- Delegate source = _Tree.TryGetValue((uint)Att.Type);
- source = Delegate.Combine(source as Delegate, _Action as Delegate);
- _Tree.AppendOrUpdate((uint)Att.Type, source);
- }
- count++;
- }
- }
- }
- var gc = new Client(null);
- gc.Account = null;
- gc.Entity = new Entity(EntityFlag.Player, false) { Name = "NONE" };
- NpcServer.Dialog.GetDialog(new MsgTaskDialog(true), gc, true);
- Console.WriteLine("\b Ok!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement