public static ushort Encode(string code, MonsterLib ml, NPCLib nl) { if (code.StartsWith("G")) return CodeOfMonster(ml.Encode(code)); else if (code.StartsWith("N")) return CodeOfNPC(nl.Encode(code)); else return 0; }
//public static bool IsDenger(ushort id) //{ // return id > 2000; //} public static NMB Decode(ushort id, MonsterLib ml, NPCLib nl) { if (id < 1000) return ml.Decode(id); else if (id > 1000 && id < 2000) return nl.Decode((ushort)(id - 1000)); else return null; }
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(); }
public IDictionary<string, Monster> RegisterDelegates(MonsterLib lib) { MonsterCottage mc = this; IDictionary<string, Monster> mt01 = new Dictionary<string, Monster>(); foreach (Monster mon in lib.Firsts) { string monCode = mon.Code; mt01.Add(monCode, mon); var methodDebut = mc.GetType().GetMethod(monCode + "Debut"); if (methodDebut != null) mon.Debut += new Monster.DebutDelegate(delegate () { methodDebut.Invoke(mc, new object[] { }); }); var methodCurtain = mc.GetType().GetMethod(monCode + "Curtain"); if (methodCurtain != null) mon.Curtain += new Monster.DebutDelegate(delegate () { methodCurtain.Invoke(mc, new object[] { }); }); var methodWin = mc.GetType().GetMethod(monCode + "WinEff"); if (methodWin != null) mon.WinEff += new Monster.WLDelegate(delegate () { methodWin.Invoke(mc, new object[] { }); }); var methodLose = mc.GetType().GetMethod(monCode + "LoseEff"); if (methodLose != null) mon.LoseEff += new Monster.WLDelegate(delegate () { methodLose.Invoke(mc, new object[] { }); }); var methodConsumeAction = mc.GetType().GetMethod(monCode + "ConsumeAction"); if (methodConsumeAction != null) mon.ConsumeAction += new Monster.CsActionDelegate(delegate (Player player, int consumeType, int type, string fuse, string argst) { methodConsumeAction.Invoke(mc, new object[] { player, consumeType, type, fuse, argst }); }); var methodIncrAction = mc.GetType().GetMethod(monCode + "IncrAction"); if (methodIncrAction != null) mon.IncrAction += new Monster.CrActionDelegate(delegate (Player player) { methodIncrAction.Invoke(mc, new object[] { player }); }); var methodDecrAction = mc.GetType().GetMethod(monCode + "DecrAction"); if (methodDecrAction != null) mon.DecrAction += new Monster.CrActionDelegate(delegate (Player player) { methodDecrAction.Invoke(mc, new object[] { player }); }); var methodConsumeValid = mc.GetType().GetMethod(monCode + "ConsumeValid"); if (methodConsumeValid != null) mon.ConsumeValid += new Monster.CsValidDelegate(delegate (Player player, int consumeType, int type, string fuse) { return (bool)methodConsumeValid.Invoke(mc, new object[] { player, consumeType, type, fuse }); }); var methodConsumeInput = mc.GetType().GetMethod(monCode + "ConsumeInput"); if (methodConsumeInput != null) mon.ConsumeInput += new Monster.CsInputDelegate(delegate (Player player, int consumeType, int type, string fuse, string prev) { return (string)methodConsumeInput.Invoke(mc, new object[] { player, consumeType, type, fuse, prev }); }); } return mt01; }
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; }