//攻击
        int AttackAndTrophyPolicy(int curTickCount)
        {
            int nMonsterCount = 0;
            List <SMonsterInfo> NearbyMonster = null;

            if (Program.config.bPriorityAttack)//优先攻击策略
            {
                SMonsterInfo targetMonster = SearchMonsterAndLootNew(out nMonsterCount, out NearbyMonster);
                if (targetMonster != null)
                {
                    KillMonsterNew(targetMonster, nMonsterCount, NearbyMonster, curTickCount);
                    return(0);
                }
                TrophyInfo trophy = SearchLoot();
                if (trophy != null)
                {
                    ActLootTrophy(trophy);
                    return(0);
                }
            }
            else
            {
                SMonsterInfo targetMonster = SearchMonsterAndLoot(out nMonsterCount);
                if (targetMonster != null)
                {
                    KillMonster(targetMonster, nMonsterCount, curTickCount);
                    return(0);
                }
                TrophyInfo trophy = SearchLoot();
                if (trophy != null)
                {
                    ActLootTrophy(trophy);
                    return(0);
                }
            }
            return(1);
        }
Exemplo 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;
        }
Exemplo n.º 3
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());
        }
Exemplo n.º 4
0
        int SearchLootAndMonster(out SMonsterInfo monster, out TrophyInfo trophy, out int MonsterRoundCount)
        {
            //过滤列表中的不要
            //优先搜索怪物,如果小于10,则直接攻击.
            double NearestDis = 50.0;//攻击距离,不太合适,以后修改

            MonsterRoundCount = 0;

            bool bNearByMonster = false;

            //     GPoint attPos = null;
            monster = null;
            trophy  = null;
            double SearchNearByDis = NEARBY_DIS;
            GPoint searchCenter    = new GPoint();

            searchCenter.x = player.Pos.x;
            searchCenter.y = player.Pos.y;
            //搜索近距离怪物
            foreach (var item in monsterList)
            {
                if (item.MaxHP == 0 || item.HP == 0)
                {
                    continue;
                }
                if (FilterMonsterList.Contains(item.Pos))
                {
                    continue;
                }

                double dis = CalcDis(searchCenter, item.Pos);
                if (dis > SearchNearByDis)
                {
                    continue;
                }
                MonsterRoundCount++;
                if (MonsterRoundCount > Program.config.MultiCount)
                {
                    break;
                }
                if (bNearByMonster)
                {
                    continue;
                }
                searchCenter.x  = item.Pos.x;
                searchCenter.y  = item.Pos.y;
                SearchNearByDis = 20.0;
                bNearByMonster  = true;
                monster         = item;
            }
            if (bNearByMonster)
            {
                return(MONSTER_TYPE);
            }
            //如果距离大于10,搜索拾取,拾取小于10的,直接返回
            double NearestTrophyDis = 50.0;

            foreach (var item in trophyList)
            {
                if (LootFilter.Contains(item.ObjPtr))
                {
                    continue;
                }
                double dis = CalcDis(player.Pos, item.X, item.Y);
                if (dis < NEARBY_DIS)
                {
                    trophy = item;
                    return(TROPHY_TYPE);
                }
                if (dis < NearestTrophyDis)
                {
                    //   double Astardis = GetAstarDis(player.Pos.x, player.Pos.y, (ushort)item.X, (ushort)item.Y);

                    double Astardis = GGetAstarDis(player.Pos.x, player.Pos.y, (ushort)item.X, (ushort)item.Y);

                    double bi = Astardis / dis;
                    if (bi < 2.0)
                    {
                        trophy           = item;
                        NearestTrophyDis = dis;
                    }
                }
            }
            if (trophy != null)
            {
                return(TROPHY_TYPE);
            }
            //如果战力品为空,返回怪物,否则优先战利品

            //搜索远处怪物数量
            //再遍历一次怪物
            foreach (var item in monsterList)
            {
                if (item.MaxHP == 0 || item.HP == 0)
                {
                    continue;
                }
                if (FilterMonsterList.Contains(item.Pos))
                {
                    continue;
                }

                double dis = CalcDis(player.Pos, item.Pos);
                if (dis > 50.0)//SearchAttDis
                {
                    continue;
                }
                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.0)
                    {
                        monster    = item;
                        NearestDis = dis;
                    }
                }
            }
            if (monster == null)
            {
                return(0);
            }
            //搜索目标旁边的怪物
            foreach (var item in monsterList)
            {
                if (item.MaxHP == 0 || item.HP == 0)
                {
                    continue;
                }
                if (FilterMonsterList.Contains(item.Pos))
                {
                    continue;
                }
                if (monster == item)
                {
                    continue;
                }
                double dis = CalcDis(monster.Pos, item.Pos);
                if (dis < 20.0)
                {
                    MonsterRoundCount++;
                }
                if (MonsterRoundCount > Program.config.MultiCount)
                {
                    break;
                }
            }
            return(MONSTER_TYPE);
        }
Exemplo n.º 5
0
        SMonsterInfo SearchMonsterAndLootNew(out int MonsterRoundCount, out List <SMonsterInfo> NearbyMonster)
        {
            NearbyMonster = new List <SMonsterInfo>();
            //搜索周围战利品,加入到记忆列表
            //    double NearestTrophyDis = 50.0;
            foreach (var item in trophyList)
            {
                if (LootFilter.Contains(item.ObjPtr))
                {
                    continue;
                }
                GPoint tpos = new GPoint();
                tpos.x = (ushort)item.X;
                tpos.y = (ushort)item.Y;
                if (LootMemory.Contains(tpos) == false)
                {
                    LootMemory.Add(tpos);
                }
            }
            //优先攻击怪,近身怪,目标怪身边数量
            //金色和优先攻击怪物的放弃时间加长
            //   double SearchNearByDis = NEARBY_DIS;
            MonsterRoundCount = 0;
            GPoint searchCenter = new GPoint();

            searchCenter.x = player.Pos.x;
            searchCenter.y = player.Pos.y;
            double       NearestMonsterDis = 1000.0;
            SMonsterInfo targetMonster     = null;

            //搜索怪物,找最近的,再找最近的身边的
            foreach (var item in monsterList)
            {
                if (item.MaxHP == 0 || item.HP == 0)
                {
                    continue;
                }
                if (FilterMonsterList.Contains(item.Pos))
                {
                    continue;
                }
                if (LastTargetMonster != null)
                {
                    if (LastTargetMonster.ID == item.ID)
                    {
                        targetMonster = item;
                        break;
                    }
                }
                double dis = CalcDis(player.Pos, item.Pos);
                if (item.Priority == 0)
                {
                    if (dis > 60.0)
                    {
                        continue;
                    }
                }
                else if (item.Priority > 0)
                {
                    if (dis > 90.0)
                    {
                        continue;
                    }
                }

                if (dis < 17.0)
                {
                    NearbyMonster.Add(item);
                }
                //if (dis > NearestMonsterDis)
                //    continue;
                double Astardis = GGetAstarDis(player.Pos.x, player.Pos.y, (ushort)item.Pos.x, (ushort)item.Pos.y);

                double bi = Astardis / dis;
                if (bi < 1.3)
                {
                    //已经有目标
                    if (targetMonster != null)
                    {
                        if (targetMonster.Priority < item.Priority)
                        {
                            targetMonster     = item;
                            NearestMonsterDis = dis;
                        }
                        else if (targetMonster.Priority == item.Priority)
                        {
                            if (dis < NearestMonsterDis)
                            {
                                targetMonster     = item;
                                NearestMonsterDis = dis;
                            }
                        }
                    }
                    else//没有目标的话
                    {
                        targetMonster     = item;
                        NearestMonsterDis = dis;
                    }
                }
            }
            if (targetMonster == null)
            {
                LastTargetMonster = null;
                return(null);
            }
            foreach (var item in monsterList)
            {
                if (item.MaxHP == 0 || item.HP == 0)
                {
                    continue;
                }
                if (FilterMonsterList.Contains(item.Pos))
                {
                    continue;
                }
                if (targetMonster.ID == item.ID)
                {
                    continue;
                }
                double dis = CalcDis(targetMonster.Pos, item.Pos);
                if (dis < 25.0)
                {
                    MonsterRoundCount++;
                }
            }
            LastTargetMonster = targetMonster;
            return(targetMonster);
        }
Exemplo n.º 6
0
        SMonsterInfo SearchMonsterAndLoot(out int MonsterRoundCount)
        {
            //搜索周围战利品,加入到记忆列表
            //    double NearestTrophyDis = 50.0;
            foreach (var item in trophyList)
            {
                if (LootFilter.Contains(item.ObjPtr))
                {
                    continue;
                }
                GPoint tpos = new GPoint();
                tpos.x = (ushort)item.X;
                tpos.y = (ushort)item.Y;
                if (LootMemory.Contains(tpos) == false)
                {
                    LootMemory.Add(tpos);
                }
            }

            //   double SearchNearByDis = NEARBY_DIS;
            MonsterRoundCount = 0;
            GPoint searchCenter = new GPoint();

            searchCenter.x = player.Pos.x;
            searchCenter.y = player.Pos.y;
            double       NearestMonsterDis = 1000.0;
            SMonsterInfo targetMonster     = null;

            //搜索怪物,找最近的,再找最近的身边的
            foreach (var item in monsterList)
            {
                if (item.MaxHP == 0 || item.HP == 0)
                {
                    continue;
                }
                if (FilterMonsterList.Contains(item.Pos))
                {
                    continue;
                }
                double dis = CalcDis(player.Pos, item.Pos);
                if (dis > 50.0)
                {
                    continue;
                }
                if (dis < 17.0)
                {
                    targetMonster = item;
                    break;
                }
                if (dis > NearestMonsterDis)
                {
                    continue;
                }
                double Astardis = GGetAstarDis(player.Pos.x, player.Pos.y, (ushort)item.Pos.x, (ushort)item.Pos.y);

                double bi = Astardis / dis;
                if (bi < 1.3)
                {
                    targetMonster     = item;
                    NearestMonsterDis = dis;
                }
            }
            if (targetMonster == null)
            {
                return(null);
            }
            foreach (var item in monsterList)
            {
                if (item.MaxHP == 0 || item.HP == 0)
                {
                    continue;
                }
                if (FilterMonsterList.Contains(item.Pos))
                {
                    continue;
                }
                if (targetMonster.ID == item.ID)
                {
                    continue;
                }
                double dis = CalcDis(targetMonster.Pos, item.Pos);
                if (dis < 17.0)
                {
                    MonsterRoundCount++;
                }
            }
            return(targetMonster);
        }