示例#1
0
        public void MoveNPC(int npcid)
        {
            //获取NPC坐标
            model.MhxyNPC npc = model.MhxyNPC.GetNPCID(npcid);
            if (npc == null || npc.x == 0 || npc.y == 0)
            {
                return;
            }
            am.ReSetMove(Global.addr.GetMapID(hwnd), npc.x, npc.y, 0);
            bool to = true;

            while (to)
            {
                int[] xy = Global.addr.getPeopleXY(hwnd);
                if (xy[0] == npc.x && xy[1] == npc.y)
                {
                    Log.WriteLine("已到达NPC所在坐标!");
                    to = false;
                    if (callback != null)
                    {
                        callback();
                    }
                }
                System.Threading.Thread.Sleep(1000);
            }
        }
示例#2
0
文件: Distance.cs 项目: sczhaoyu/mh
        public void MoveNPC(int npcid)
        {
            //获取NPC坐标
            model.MhxyNPC npc = model.MhxyNPC.GetNPCID(npcid);
            if (npc == null || npc.x == 0 || npc.y == 0)
            {
                return;
            }
            //坐标偏移
            bean.Axis      a  = OffsetAxis(npc.x, npc.y, -3, 3, -4, 4);
            model.MhxyAxis ma = RandomAxis(npcid, 0);
            if (ma != null)
            {
                a = new bean.Axis(ma.x, ma.y);
            }


            npc.x = a.x;
            npc.y = a.y;
            am.ReSetMove(Global.addr.GetMapID(hwnd), npc.x, npc.y, 0);
            bool to = true;

            while (to)
            {
                int[] xy = Global.addr.getPeopleXY(hwnd);
                if (xy[0] == npc.x && xy[1] == npc.y)
                {
                    Log.WriteLine("已到达NPC所在坐标!");
                    to = false;
                    if (callback != null)
                    {
                        callback();
                    }
                }
                System.Threading.Thread.Sleep(1000);
            }
        }