public LibGroup() { HL = new HeroLib(); TL = new TuxLib(); NL = new NPCLib(); ML = new MonsterLib(); EL = new EvenementLib(); SL = new SkillLib(); ZL = new OperationLib(); NJL = new NCActionLib(); RL = new RuneLib(); ESL = new ExspLib(); }
// Action class, 0 thread receives and maintain data base. // Input class, player.Uid thread receives and maintain data base. public IDictionary<string, Skill> RegisterDelegates(SkillLib lib) { SkillCottage sc = this; IDictionary<string, Skill> sk01 = new Dictionary<string, Skill>(); foreach (Skill sk in lib.Firsts) { sk01.Add(sk.Code, sk); string skCode = sk.Code; var methodAction = sc.GetType().GetMethod(skCode + "Action"); if (methodAction != null) sk.Action += new Skill.ActionDelegate(delegate (Player player, int type, string fuse, string argst) { methodAction.Invoke(sc, new object[] { player, type, fuse, argst }); }); var methodValid = sc.GetType().GetMethod(skCode + "Valid"); if (methodValid != null) sk.Valid += new Skill.ValidDelegate(delegate (Player player, int type, string fuse) { return (bool)methodValid.Invoke(sc, new object[] { player, type, fuse }); }); var methodInput = sc.GetType().GetMethod(skCode + "Input"); if (methodInput != null) sk.Input += new Skill.InputDelegate(delegate (Player player, int type, string fuse, string prev) { return (string)methodInput.Invoke(sc, new object[] { player, type, fuse, prev }); }); var methodEncrypt = sc.GetType().GetMethod(skCode + "Encrypt"); if (methodEncrypt != null) sk.Encrypt += new Skill.EncryptDelegate(delegate (string argst) { return (string)methodEncrypt.Invoke(sc, new object[] { argst }); }); if (sk.IsBK) { Bless bs = (Bless)sk; var methodBKValid = sc.GetType().GetMethod(skCode + "BKValid"); if (methodBKValid != null) bs.BKValid += new Bless.BKValidDelegate(delegate (Player player, int type, string fuse, ushort owner) { return (bool)methodBKValid.Invoke(sc, new object[] { player, type, fuse, owner }); }); } } return sk01; }
public LibGroup(HeroLib hl, TuxLib tl, NPCLib nl, MonsterLib ml, EvenementLib el, SkillLib sl, OperationLib zl, NCActionLib njl, RuneLib rl, ExspLib esl) { HL = hl; TL = tl; NL = nl; ML = ml; EL = el; SL = sl; ZL = zl; NJL = njl; RL = rl; ESL = esl; }