1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using pomelo.connector;
- using CommonLang.Property;
- using pomelo.area;
- using XmdsBattleClientBot;
- using CommonLang;
- namespace XmdsBotTest.Runner
- {
- public class IllsionFunc : BotRunner.RunnerModule
- {
- private int lv;
- public IllsionFunc() {
- module_name = "幻境";
- }
- public IllsionFunc(BotRunner r) : base(r)
- {
-
- }
- protected internal override void OnGateBindPlayer(BindPlayerResponse e)
- {
- base.OnGateBindPlayer(e);
- lv = e.s2c_player.level;
- }
- protected internal override void OnBattleActorReady(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor)
- {
- layer.AddTimePeriodicMS(Config.CheckIntervalMS, (t) =>
- {
- if (IsCanJoin)
- {
- enterLllsionRequest();
- }
- });
- }
- private void enterLllsionRequest()
- {
- HashMap<int, Dictionary<string, object>> sect = BotClientManager.GetLuaData("Section.lua");
- if (sect == null) return;
- int id = 0;
- foreach (var elem in sect) {
- object minLv = null;
- object maxLv = null;
- elem.Value.TryGetValue("MinLv", out minLv);
- elem.Value.TryGetValue("MaxLv",out maxLv);
- if (lv >= Convert.ToInt32(minLv) && lv <= Convert.ToInt32(maxLv)) {
- id = elem.Key;
- break;
- }
- }
- if (id > 0)
- {
- client.GameSocket.fightLevelHandler.enterLllsionRequest(id,
- (err, rsp) =>
- { });
- }
- else {
- //Console.WriteLine("can not find the satisfied id:{0} playerLv;{1}",id,lv);
- }
- }
- protected override int rand()
- {
- return Config.RandNum;
- }
- [Desc("幻境配置")]
- [Expandable]
- public class Config : ConfigBase
- {
- [Desc("幻境检测间隔")]
- public static int CheckIntervalMS = 5000;
- [Desc("幻境随机数")]
- public static int RandNum = 15;
- public override string ToString()
- {
- return "幻境配置";
- }
- public override void popG2DPropertyDialog()
- {
- CommonFroms.G2D.G2DPropertyDialog<IllsionFunc.Config>.Show("修改配置", this);
- }
- }
- }
- }
|