Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 public IDictionary<string, Tux> RegisterDelegates(TuxLib lib, int pkgCode)
 {
     TuxCottage tc = this;
     IDictionary<string, Tux> tx01 = new Dictionary<string, Tux>();
     List<Tux> tuxes = lib.ListAllTuxs(pkgCode);
     foreach (Tux tux in tuxes)
     {
         tx01.Add(tux.Code, tux);
         string cardCode = tux.Code;
         var methodAction = tc.GetType().GetMethod(cardCode + "Action");
         if (methodAction != null)
             tux.Action += delegate(Player player, int type, string fuse, string argst)
             {
                 methodAction.Invoke(tc, new object[] { player, type, fuse, argst });
             };
         var methodVestige = tc.GetType().GetMethod(cardCode + "Vestige");
         if (methodVestige != null)
         {
             tux.Vestige += delegate(Player player, int type, string fuse, ushort it)
             {
                 methodVestige.Invoke(tc, new object[] { player, type, fuse, it });
             };
         }
         var methodBribe = tc.GetType().GetMethod(cardCode + "Bribe");
         if (methodBribe != null)
             tux.Bribe += new Tux.ValidDelegate(delegate(Player player, int type, string fuse)
             {
                 return (bool)methodBribe.Invoke(tc, new object[] { player, type, fuse });
             });
         else if (tux.Type == Tux.TuxType.ZP)
             tux.Bribe += new Tux.ValidDelegate(delegate(Player player, int type, string fuse)
             {
                 return (bool)GeneralZPBribe(player);
             });
         else if (tux.IsTuxEqiup())
             tux.Bribe += delegate(Player player, int type, string fuse)
             {
                 return (bool)GeneralEquipmentBribe(player, tux.Type);
             };
         else
             tux.Bribe += new Tux.ValidDelegate(delegate (Player player, int type, string fuse)
             {
                 return (bool)GeneralTuxBribe(player);
             });
         var methodValid = tc.GetType().GetMethod(cardCode + "Valid");
         if (methodValid != null)
             tux.Valid += new Tux.ValidDelegate(delegate(Player player, int type, string fuse)
             {
                 return (bool)methodValid.Invoke(tc, new object[] { player, type, fuse });
             });
         var methodInput = tc.GetType().GetMethod(cardCode + "Input");
         if (methodInput != null)
         {
             tux.Input += new Tux.InputDelegate(delegate(Player player, int type, string fuse, string prev)
             {
                 return (string)methodInput.Invoke(tc, new object[] { player, type, fuse, prev });
             });
         }
         else
         {
             var methodInputAli = tc.GetType().GetMethod(cardCode + "InputHolder");
             if (methodInputAli != null)
             {
                 tux.Input += new Tux.InputDelegate(delegate(Player player, int type, string fuse, string prev)
                 {
                     return (string)methodInputAli.Invoke(tc, new object[] { player, player, type, fuse, prev });
                 });
             }
         }
         var metholdInputHolder = tc.GetType().GetMethod(cardCode + "InputHolder");
         if (metholdInputHolder != null)
         {
             tux.InputHolder += new Tux.InputHolderDelegate(delegate(Player provider,
                 Player user, int type, string fuse, string prev)
             {
                 return (string)metholdInputHolder.Invoke(tc, new object[] { provider, user, type, fuse, prev });
             });
         }
         else
         {
             var methodInputAli = tc.GetType().GetMethod(cardCode + "Input");
             if (methodInputAli != null)
             {
                 tux.InputHolder += new Tux.InputHolderDelegate(delegate(Player provider,
                     Player user, int type, string fuse, string prev)
                 {
                     return (string)methodInputAli.Invoke(tc, new object[] { provider, type, fuse, prev });
                 });
             }
         }
         //var methodEncrypt = tc.GetType().GetMethod(cardCode + "Encrypt");
         if (tux.IsTuxEqiup())
         {
             TuxEqiup tue = (TuxEqiup)tux;
             var methodConsumeAction = tc.GetType().GetMethod(cardCode + "ConsumeAction");
             if (methodConsumeAction != null)
             {
                 tue.ConsumeAction += new TuxEqiup.CsActionDelegate(delegate(Player player,
                     int consumeType, int type, string fuse, string argst)
                 {
                     methodConsumeAction.Invoke(tc, new object[] { player, consumeType, type, fuse, argst });
                 });
             }
             else
             {
                 var methodConsumeActionAli = tc.GetType().GetMethod(cardCode + "ConsumeActionHolder");
                 if (methodConsumeActionAli != null)
                 {
                     tue.ConsumeAction += new TuxEqiup.CsActionDelegate(delegate(Player player,
                         int consumeType, int type, string fuse, string argst)
                     {
                         methodConsumeActionAli.Invoke(tc, new object[] { player, player,
                             consumeType, type, fuse, argst });
                     });
                 }
             }
             var methodConsumeActionHolder = tc.GetType().GetMethod(cardCode + "ConsumeActionHolder");
             if (methodConsumeActionHolder != null)
             {
                 tue.ConsumeActionHolder += new TuxEqiup.CsActionHolderDelegate(delegate(Player provider,
                     Player user, int consumeType, int type, string fuse, string argst)
                 {
                     methodConsumeActionHolder.Invoke(tc, new object[] { provider, user,
                         consumeType, type, fuse, argst });
                 });
             }
             else
             {
                 var methodConsumeActionAli = tc.GetType().GetMethod(cardCode + "ConsumeAction");
                 if (methodConsumeActionAli != null)
                     tue.ConsumeActionHolder += new TuxEqiup.CsActionHolderDelegate(delegate(Player provider,
                         Player user, int consumeType, int type, string fuse, string prev)
                     {
                         methodConsumeActionAli.Invoke(tc, new object[] { provider, consumeType, type, fuse, prev });
                     });
             }
             var methodIncrAction = tc.GetType().GetMethod(cardCode + "IncrAction");
             if (methodIncrAction != null)
                 tue.IncrAction += new TuxEqiup.CrActionDelegate(delegate(Player player)
                 {
                     methodIncrAction.Invoke(tc, new object[] { player });
                 });
             tue.IncrAction += new TuxEqiup.CrActionDelegate(delegate(Player player)
             {
                 EquipGeneralIncrAction(tue, player);
             });
             var methodDecrAction = tc.GetType().GetMethod(cardCode + "DecrAction");
             if (methodDecrAction != null)
                 tue.DecrAction += new TuxEqiup.CrActionDelegate(delegate(Player player)
                 {
                     methodDecrAction.Invoke(tc, new object[] { player });
                 });
             tue.DecrAction += new TuxEqiup.CrActionDelegate(delegate(Player player)
             {
                 EquipGeneralDecrAction(tue, player);
             });
             var methodConsumeValid = tc.GetType().GetMethod(cardCode + "ConsumeValid");
             if (methodConsumeValid != null)
             {
                 tue.ConsumeValid += new TuxEqiup.CsValidDelegate(delegate(Player player,
                     int consumeType, int type, string fuse)
                 {
                     return (bool)methodConsumeValid.Invoke(tc, new object[] { player, consumeType, type, fuse });
                 });
             }
             else
             {
                 var methodConsumeValidAli = tc.GetType().GetMethod(cardCode + "ConsumeValidHolder");
                 if (methodConsumeValidAli != null)
                     tue.ConsumeValid += new TuxEqiup.CsValidDelegate(delegate(Player player,
                         int consumeType, int type, string fuse)
                     {
                         return (bool)methodConsumeValidAli.Invoke(tc, new object[] { player, player,
                             consumeType, type, fuse });
                     });
             }
             var methodConsumeValidHolder = tc.GetType().GetMethod(cardCode + "ConsumeValidHolder");
             if (methodConsumeValidHolder != null)
             {
                 tue.ConsumeValidHolder += new TuxEqiup.CsValidHolderDelegate(delegate(Player provider,
                     Player user, int consumeType, int type, string fuse)
                 {
                     return (bool)methodConsumeValidHolder.Invoke(tc, new object[] { provider, user,
                         consumeType, type, fuse });
                 });
             }
             else
             {
                 var methodConsumeValidAli = tc.GetType().GetMethod(cardCode + "ConsumeValid");
                 if (methodConsumeValidAli != null)
                     tue.ConsumeValidHolder += new TuxEqiup.CsValidHolderDelegate(delegate(Player provider,
                     Player user, int consumeType, int type, string fuse)
                     {
                         return (bool)methodConsumeValidAli.Invoke(tc, new object[] { provider,
                             consumeType, type, fuse });
                     });
             }
             var methodConsumeInput = tc.GetType().GetMethod(cardCode + "ConsumeInput");
             if (methodConsumeInput != null)
             {
                 tue.ConsumeInput += new TuxEqiup.CsInputDelegate(delegate(Player player,
                     int consumeType, int type, string fuse, string prev)
                 {
                     return (string)methodConsumeInput.Invoke(tc, new object[] { player,
                         consumeType, type, fuse, prev });
                 });
             }
             else
             {
                 var methodConsumeInputAli = tc.GetType().GetMethod(cardCode + "ConsumeInputHolder");
                 if (methodConsumeInputAli != null)
                     tue.ConsumeInput += new TuxEqiup.CsInputDelegate(delegate(Player player,
                         int consumeType, int type, string fuse, string prev)
                     {
                         return (string)methodConsumeInputAli.Invoke(tc, new object[] { player, player,
                             consumeType, type, fuse, prev });
                     });
             }
             var methodConsumeInputHolder = tc.GetType().GetMethod(cardCode + "ConsumeInputHolder");
             if (methodConsumeInputHolder != null)
             {
                 tue.ConsumeInputHolder += new TuxEqiup.CsInputHolderDelegate(delegate(Player provider,
                     Player user, int consumeType, int type, string fuse, string prev)
                 {
                     return (string)methodConsumeInputHolder.Invoke(tc, new object[] { provider,
                         user, consumeType, type, fuse, prev });
                 });
             }
             else
             {
                 var methodConsumeInputAli = tc.GetType().GetMethod(cardCode + "ConsumeInput");
                 if (methodConsumeInputAli != null)
                     tue.ConsumeInputHolder += new TuxEqiup.CsInputHolderDelegate(delegate(Player provider,
                         Player user, int consumeType, int type, string fuse, string prev)
                     {
                         return (string)methodConsumeInputAli.Invoke(tc, new object[] { provider,
                             consumeType, type, fuse, prev });
                     });
             }
             var methodUseAction = tc.GetType().GetMethod(cardCode + "UseAction");
             if (methodUseAction != null)
                 tue.UseAction += delegate(ushort cardUt, Player player, ushort source)
                 {
                     methodUseAction.Invoke(tc, new object[] { cardUt, player, source });
                 };
             else
                 tue.UseAction += delegate (ushort cardUt, Player player, ushort source)
                 {
                     EquipGeneralUseAction(cardUt, player, source);
                 };
             var methodInsAction = tc.GetType().GetMethod(cardCode + "InsAction");
             if (methodInsAction != null)
                 tue.InsAction += new TuxEqiup.CrActionDelegate(delegate(Player player)
                 {
                     methodInsAction.Invoke(tc, new object[] { player });
                 });
             var methodDelAction = tc.GetType().GetMethod(cardCode + "DelAction");
             if (methodDelAction != null)
                 tue.DelAction += new TuxEqiup.CrActionDelegate(delegate(Player player)
                 {
                     methodDelAction.Invoke(tc, new object[] { player });
                 });
         }
         tux.Locust += new Tux.LocustActionDelegate(delegate(Player player, int type, string fuse,
             string cdFuse, Player locuster, Tux locus, ushort it)
         {
             var methodLocust = tc.GetType().GetMethod(cardCode + "Locust");
             if (methodLocust != null)
                 methodLocust.Invoke(tc, new object[] { player, type, fuse, cdFuse, locuster, locus, it });
             else
                 GeneralLocust(player, type, fuse, cdFuse, locuster, locus, it);
         });
     }
     return tx01;
 }
Ejemplo n.º 3
0
 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;
 }