SBox SearchBox()
        {
            double NearestDis = 60.0;//
            SBox   box        = null;

            foreach (var item in boxList)
            {
                if (ClickedBoxList.Contains(item.ID))
                {
                    continue;
                }
                if (item.Color > Program.config.BoxFilterColor)
                {
                    ClickedBoxList.Add(item.ID);
                    continue;
                }
                double dis = CalcDis(player.Pos, item.Pos);
                if (dis < NearestDis)
                {
                    double Astardis = GGetAstarDis(player.Pos.x, player.Pos.y, item.Pos.x, item.Pos.y);
                    double bi       = Astardis / dis;
                    if (bi < 1.5)
                    {
                        box        = item;
                        NearestDis = dis;
                    }
                }
            }
            return(box);
        }
Esempio n. 2
0
        const sbyte PollutantGateType = 9; //地图连接门

        void UpdateGameInfo()
        {
            round = Program.client.GetRoundList();
            monsterList.Clear();
            boxList.Clear();
            doorList.Clear();
            trophyList.Clear();
            trophyIDList.Clear();
            NearbyPollutantGatePos = null;
            foreach (var item in round)
            {
                //掉落物品
                //门
                //桶箱
                //传送门
                switch (item.Type)
                {
                case MonsterType:
                    SMonsterInfo monster = new SMonsterInfo(item);
                    monsterList.Add(monster);
                    break;

                case ChestType:
                    SBox box = new SBox(item);
                    boxList.Add(box);
                    break;

                case DoorType:
                    SDoor door = new SDoor(item);
                    doorList.Add(door);
                    break;

                case TrophyType:
                    TrophyBaseInfo trophy = new TrophyBaseInfo();
                    trophy.ObjPtr = item.ObjPtr;
                    trophy.X      = (short)item.X;
                    trophy.Y      = (short)item.Y;
                    trophyIDList.Add(trophy);
                    break;

                case AreaCrossType:
                    AreaCrossInfo areaCross = new AreaCrossInfo(item);
                    areaCrossList.Add(areaCross);
                    break;

                case WaypointType:
                    break;

                case PollutantGateType:
                    NearbyPollutantGatePos   = new GPoint();
                    NearbyPollutantGatePos.x = (ushort)item.X;
                    NearbyPollutantGatePos.y = (ushort)item.Y;
                    break;
                }
            }
            CurMapID   = Program.client.GetCurrentMapID();
            trophyList = Program.client.GetTrophyList(trophyIDList);

            PlayerInfo tempPlayer = Program.client.GetPlayerInfo();

            player.Level  = tempPlayer.Level;
            player.HP     = tempPlayer.HP;
            player.MaxHP  = tempPlayer.MaxHP;
            player.MP     = tempPlayer.MP;
            player.Shield = tempPlayer.Shield;
            player.MaxMP  = tempPlayer.MaxMP;
            player.Pos.x  = (ushort)tempPlayer.X;
            player.Pos.y  = (ushort)tempPlayer.Y;
        }
        ////拾取


        ////拾取策略
        int BoxPolicy(int curTickCount)
        {
            SBox Box = null;

            if (TargetBox.ID != 0)
            {
                Box = TargetBox;
            }
            else
            {
                Box = SearchBox();
                if (Box != null)
                {
                    TargetBox.ID     = Box.ID;
                    TargetBox.ObjPtr = Box.ObjPtr;
                    TargetBox.Pos.x  = Box.Pos.x;
                    TargetBox.Pos.y  = Box.Pos.y;
                }
            }
            //如果有宝箱
            if (Box != null)
            {
                //检测阻塞
                if (player.Pos == lastPlayerPos && Box.Pos == lastTargetPoint)
                {
                    blockCount++;
                    nSleepTime = 50;
                }
                else
                {
                    blockCount = 0;
                }
                lastPlayerPos.x   = player.Pos.x;
                lastPlayerPos.y   = player.Pos.y;
                lastTargetPoint.x = Box.Pos.x;
                lastTargetPoint.y = Box.Pos.y;

                if (blockCount > 3)
                {
                    ClickedBoxList.Add(Box.ID);
                    TargetBox.ID = 0;
                    nSleepTime   = 50;
                    return(0);
                }
                if (Box.Color > 0)
                {
                    SetPassAbleArea(Box.Pos.x, Box.Pos.y);
                }
                //获取A*距离,过大的走过去
                double dis = CalcDis(Box.Pos, player.Pos);
                if (dis > 16.5)
                {
                    ActSafeMove(Box.Pos);
                }
                else
                {
                    if (Box.Color > 0)
                    {
                        //釋放圖騰
                        CastTTSkillNow(curTickCount);

                        //釋放陷阱
                        CastTrapSkillNow(curTickCount, player.Pos);

                        //施放护盾技能
                        CastShieldSkillNow(curTickCount);
                    }
                    // 否则点击
                    Program.client.ActiveTarget(Box.ObjPtr);
                    //   ClickedBoxList.Add(Box.ID);
                    TargetBox.ID = 0;
                }

                nSleepTime = 50;
                return(0);
            }
            return(1);
        }
Esempio n. 4
0
        int HandMissionAnalysis()
        {
            //如果不在任务地点,去任务地点

            //如果在城里,如果需要去传送门,则去传送门,否则去传送点
            if (InTown())
            {
                MessageBox.Show("輔助模式,請在目標探索地圖開啟輔助程式");
                return(0);
            }



            if (CurMapID != LoadBattleMapID)
            {
                Program.client.Update();
                Thread.Sleep(1000);
                UpdateMap(bGroupExploreModel);


                LoadBattleMapID = CurMapID;
                FilterMonsterList.Clear();
                PassedDoor.Clear();
                areaCrossList.Clear();
                AddedCrossPoint.Clear();
                ClickedBoxList.Clear();
                LootFilter.Clear();
                curGroup = -1;

                Program.client.ClearTrophyFilter();

                //    bGroupExploreModel = false;//判断
                bNeedCross = false; //判断探索还是穿越
                bCrossing  = false; //判断穿越中还是移动到穿越点
                bNeedCastBattleOnceSkill = true;
                //    Thread.Sleep(1000);
            }
            int curTickCount = System.Environment.TickCount;

            //贫血小退
            if (Program.config.LogoutType == 0)
            {
                int data = player.HP;
                if (data < Program.config.LogOutData)
                {
                    ReturnRolePolicy();
                    if ((curTickCount - lastReturnTime) < 1000 * 60)
                    {
                        LogoutCount++;
                    }
                    else
                    {
                        LogoutCount = 0;
                    }
                    lastReturnTime = curTickCount;
                    if (LogoutCount > 5)
                    {
                        LogoutCount = 0;
                        curStatus   = Status.GotoBack;
                        SetNeedGoBack();
                        bNeedResetBattleMapInfo = true;
                        ChangeToNextMissionMap();
                        //bNeedResetBattleMapID = true;
                        //pollutantMapID = 0;//污染地穴地图ID
                        //LoadPollutantMapID = 0;
                        //pollutantGatePos = null;//门位置
                        //pollutantComplete = false;//已经刷完
                        //bEnterPollutanting = false;//正在进入污染地穴
                    }
                    Thread.Sleep(1000);
                    return(0);
                }
            }
            else if (Program.config.LogoutType == 1)
            {
                int data = player.Shield;
                if (data < Program.config.LogOutData)
                {
                    ReturnRolePolicy();
                    if ((curTickCount - lastReturnTime) < 1000 * 60)
                    {
                        LogoutCount++;
                    }
                    else
                    {
                        LogoutCount = 0;
                    }
                    lastReturnTime = curTickCount;
                    if (LogoutCount > 5)
                    {
                        LogoutCount = 0;
                        curStatus   = Status.GotoBack;
                        SetNeedGoBack();
                        bNeedResetBattleMapInfo = true;
                        ChangeToNextMissionMap();
                        //bNeedResetBattleMapID = true;
                        //ChangeToNextMissionMap();

                        //pollutantMapID = 0;//污染地穴地图ID
                        //LoadPollutantMapID = 0;
                        //pollutantGatePos = null;//门位置
                        //pollutantComplete = false;//已经刷完
                        //bEnterPollutanting = false;//正在进入污染地穴
                    }
                    Thread.Sleep(1000);
                    return(0);
                }
            }
            //如果需要施放光环
            if ((curTickCount - LastCheckHaloTime) > (5 * 1000))
            {
                if (Program.config.bAutoUpSkill)
                {
                    Program.client.UpSkill();
                }
                if (Program.config.haloSkill.Count > 0)
                {
                    foreach (var item in Program.config.haloSkill)
                    {
                        if (Program.client.IsBuffExists(item) == false)
                        {
                            Program.client.CastUntargetSkill((short)player.Pos.x, (short)player.Pos.y, (short)item, 8);
                            Thread.Sleep(1000);
                        }
                    }
                }
                LastCheckHaloTime = curTickCount;
            }
            if (bNeedCastBattleOnceSkill)
            {
                if (Program.config.battleOnceSkill.Count > 0)
                {
                    foreach (var item in Program.config.battleOnceSkill)
                    {
                        Program.client.CastUntargetSkill((short)player.Pos.x, (short)player.Pos.y, (short)item, 8);
                        Thread.Sleep(1000);
                    }
                }
                bNeedCastBattleOnceSkill = false;
            }
            //区域传送点
            if (bGroupExploreModel)
            {
                //
                if (curGroup != -1)
                {
                    foreach (var item in areaCrossList)
                    {
                        //如果没被处理过
                        if (AddedCrossPoint.Contains(item.Pos))
                        {
                            continue;
                        }
                        CrossPoint crossPoint = new CrossPoint();
                        crossPoint.firstGroup = GetCurGroup(player.Pos.x, player.Pos.y);
                        crossPoint.firstPos.x = item.Pos.x;
                        crossPoint.firstPos.y = item.Pos.y;
                        allCrossPoint.Add(crossPoint);
                        AddedCrossPoint.Add(item.Pos);
                        SetPassAbleArea(item.Pos.x, item.Pos.y);
                    }
                }
            }


            ////////////////////////////////药剂

            ActDrinkFlask(curTickCount);

            ////////////////////////////////////
            // //如果有门在身边,则点
            SDoor Door = SearchDoor();

            if (Door != null)
            {
                //  Program.client.ActiveTarget(DoorObjPtr);
                ActOpenDoor(Door);
                return(0);
            }

            /////////////////////////////////////
            int nMonsterCount = 0;
            List <SMonsterInfo> NearbyMonster = null;
            SMonsterInfo        targetMonster = SearchMonsterAndLootNew(out nMonsterCount, out NearbyMonster);

            if (targetMonster != null)
            {
                KillMonsterNew(targetMonster, nMonsterCount, NearbyMonster, curTickCount);
                return(0);
            }
            TrophyInfo trophy = SearchLoot();

            if (trophy != null)
            {
                ActHandLootTrophy(trophy);
                return(0);
            }



            SBox Box = null;

            if (TargetBox.ID != 0)
            {
                Box = TargetBox;
            }
            else
            {
                Box = SearchBox();
                if (Box != null)
                {
                    TargetBox.ID     = Box.ID;
                    TargetBox.ObjPtr = Box.ObjPtr;
                    TargetBox.Pos.x  = Box.Pos.x;
                    TargetBox.Pos.y  = Box.Pos.y;
                }
            }
            //如果有宝箱
            if (Box != null)
            {
                //检测阻塞
                if (player.Pos == lastPlayerPos && Box.Pos == lastTargetPoint)
                {
                    blockCount++;
                    nSleepTime = 50;
                }
                else
                {
                    blockCount = 0;
                }
                lastPlayerPos.x   = player.Pos.x;
                lastPlayerPos.y   = player.Pos.y;
                lastTargetPoint.x = Box.Pos.x;
                lastTargetPoint.y = Box.Pos.y;
                if (blockCount > 3)
                {
                    ClickedBoxList.Add(Box.ID);
                    TargetBox.ID = 0;
                    nSleepTime   = 50;
                    return(0);
                }
                //获取A*距离,过大的走过去
                double dis = CalcDis(Box.Pos, player.Pos);
                if (dis > 15)
                {
                    ActSafeMove(Box.Pos);
                }
                else
                {
                    if (Box.Color > 0)
                    {
                        //釋放圖騰
                        CastTTSkillNow(curTickCount);

                        //釋放陷阱
                        CastTrapSkillNow(curTickCount, player.Pos);

                        //施放护盾技能
                        CastShieldSkillNow(curTickCount);
                    }
                    // 否则点击
                    Program.client.ActiveTarget(Box.ObjPtr);
                    //   ClickedBoxList.Add(Box.ID);
                    TargetBox.ID = 0;
                }

                nSleepTime = 50;
                return(0);
            }

            ////卡位检测

            //////////////////////////////////////////打怪探索
            ActDrinkSpeedFlask(curTickCount);

            //if (bGroupExploreModel)
            //{
            //    return GroupExplore();
            //}
            return(ActHandNormalExplore());
        }