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; namespace XmdsBotTest.Runner { public class AutionProto : BotRunner.RunnerModule { private pomelo.player.Player player; public AutionProto() { module_name = "寄卖行寄卖物品"; } public AutionProto(BotRunner r) : base(r) { } protected internal override void OnGateBindPlayer(BindPlayerResponse e) { base.OnGateBindPlayer(e); runner.do_gm_add_exp(999999999); runner.do_gm_add_gold(999); runner.do_gm_add_item("hp1",99); player = e.s2c_player; } protected internal override void OnBattleActorReady(CommonAI.ZoneClient.ZoneLayer layer, CommonAI.ZoneClient.ZoneActor actor) { layer.AddTimeDelayMS(Config.CheckIntervalMS, (t) => { if (Enable) { } }); layer.AddTimePeriodicMS(Config.CheckIntervalMS, (t) => { if (Enable && player.level >= 10)//10级暂时写死 { buyIntergalItemRequest(); } }); } private void buyIntergalItemRequest() { List bagGrids = player.store.bag.bagGrids; foreach (var grid in bagGrids) { if (null != grid && 0 != grid.item.itemType) { client.GameSocket.consignmentLineHandler.addConsignmentRequest(grid.gridIndex, Config.count, Config.price,0,0, "c2s_id", (err, rsp) => { if (err != null) { Console.WriteLine("buyIntergalItemRequest: err:{0} grid.item:{1}", err, grid.item.code); } else { Console.WriteLine("sucess grid.gridIndex:{0} Config.count:{1} ", grid.gridIndex, Config.count); } }); } } } [Desc("寄卖行寄卖物品配置")] [Expandable] public class Config : ConfigBase { [Desc("寄卖行寄卖物品检测间隔")] public static int CheckIntervalMS = 5000; [Desc("寄卖行寄卖物品购买数量")] public static int price = 2; public static int count = 1; public override string ToString() { return "寄卖行寄卖物品配置"; } public override void popG2DPropertyDialog() { CommonFroms.G2D.G2DPropertyDialog.Show("修改配置", this); } } } }