SHARE
TWEET

s

a guest May 19th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #region Invoke
  2.                 Action<MsgTaskDialog, Client> _invoker = TryGet(client.ActiveNpc) as Action<MsgTaskDialog, Client>;
  3.                 if (_invoker != null) _invoker.Invoke(npcRequest, client);
  4.                 #endregion
  5.  
  6.  
  7. public static void LoadAllNpcs()
  8.         {
  9.             Console.Write("\t Loading NpcAttribute ... ");
  10.             _Tree = new RedBlackTree<uint, Delegate>();
  11.             var methods = Assembly.GetCallingAssembly().GetTypes()
  12.                      .SelectMany(t => t.GetMethods())
  13.                      .Where(m => m.GetCustomAttributes(typeof(NpcAttribute), false).Length > 0)
  14.                      .ToArray();
  15.             int count = 0;
  16.             foreach (var i in methods)
  17.             {
  18.                 foreach (var npcatt in i.GetCustomAttributes(false))
  19.                 {
  20.                     Console.Write("\b{0}", Loading.NextChar());
  21.                     NpcAttribute Att = npcatt as NpcAttribute;
  22.                     if (Att != null)
  23.                     {
  24.                         Delegate _Action;
  25.                         _Action = Delegate.CreateDelegate(typeof(Action<MsgTaskDialog, Client>), null, i);
  26.                         if (!_Tree.TryAppend((uint)Att.Type, _Action))
  27.                         {
  28.                             Delegate source = _Tree.TryGetValue((uint)Att.Type);
  29.                             source = Delegate.Combine(source as Delegate, _Action as Delegate);
  30.                             _Tree.AppendOrUpdate((uint)Att.Type, source);
  31.                         }
  32.                         count++;
  33.                     }
  34.                 }
  35.             }
  36.             var gc = new Client(null);
  37.             gc.Account = null;
  38.             gc.Entity = new Entity(EntityFlag.Player, false) { Name = "NONE" };
  39.             NpcServer.Dialog.GetDialog(new MsgTaskDialog(true), gc, true);
  40.             Console.WriteLine("\b Ok!");
  41.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top