예제 #1
0
        public void FindRaidTargets(SearchingRaidTargetOption option)
        {
            Thread t = new Thread(new ParameterizedThreadStart(doFindRaidTargets));

            t.Name = "FindRaidTargets";
            t.Start(option);
        }
예제 #2
0
 public void FindRaidTargets(SearchingRaidTargetOption option)
 {
     Thread t = new Thread(new ParameterizedThreadStart(doFindRaidTargets));
     t.Name = "FindRaidTargets";
     t.Start(option);
 }
예제 #3
0
        private void doFindRaidTargets(object o)
        {
            lock (Level2Lock)
            {
                SearchingRaidTargetOption search_option = o as SearchingRaidTargetOption;
                int  VillageID  = search_option.VillageID;
                int  Range      = search_option.Range;
                int  popu_limit = search_option.Population;
                bool bInclOss   = search_option.bInclOss;
                bool bInclTribe = search_option.bInclTribe;

                int axis_x = TD.Villages[VillageID].Coord.X;
                int axis_y = TD.Villages[VillageID].Coord.Y;
                RaidTargetFoundLog("开始以村子【" + TD.Villages[VillageID].Name
                                   + "(" + axis_x + "|" + axis_y
                                   + ")】为中心,在" + Range + "范围内查找绿洲和人口低于"
                                   + popu_limit + "的死羊。");

                List <RaidTargetInfo> info_lst = new List <RaidTargetInfo>();
                RaidTargetFoundLog("[" + 1 + " / " + 1 + "] 搜索以("
                                   + axis_x + "|" + axis_y + ")为中心的地图块");
                string data = FetchBlockMap(VillageID, axis_x, axis_y);
                if (data != null)
                {
                    ParseRaidTarget(VillageID, data, info_lst, popu_limit, bInclOss, bInclTribe);
                }

                for (int i = 1; i <= Range; i++)
                {
                    RaidTargetFoundLog("正在进行第" + i + "重扫描:");
                    for (int j = 0; j < i; j++)
                    {
                        if (i % 2 == 1)
                        {
                            axis_y = CalcAxisTran(axis_y, 9);
                            RaidTargetFoundLog("[" + (j + 1) + " / " + (2 * i) + "] 搜索以("
                                               + axis_x + "|" + axis_y + ")为中心的地图块");
                            data = FetchBlockMap(VillageID, axis_x, axis_y);
                        }
                        else
                        {
                            axis_y = CalcAxisTran(axis_y, -9);
                            RaidTargetFoundLog("[" + (j + 1) + " / " + (2 * i) + "] 搜索以("
                                               + axis_x + "|" + axis_y + ")为中心的地图块");
                            data = FetchBlockMap(VillageID, axis_x, axis_y);
                        }

                        if (data != null)
                        {
                            ParseRaidTarget(VillageID, data, info_lst, popu_limit, bInclOss, bInclTribe);
                        }
                    }

                    for (int j = 0; j < i; j++)
                    {
                        if (i % 2 == 1)
                        {
                            axis_x = CalcAxisTran(axis_x, 11);
                            RaidTargetFoundLog("[" + (i + j + 1) + " / " + (2 * i) + "] 搜索以("
                                               + axis_x + "|" + axis_y + ")为中心的地图块");
                            data = FetchBlockMap(VillageID, axis_x, axis_y);
                        }
                        else
                        {
                            axis_x = CalcAxisTran(axis_x, -11);
                            RaidTargetFoundLog("[" + (i + j + 1) + " / " + (2 * i) + "] 搜索以("
                                               + axis_x + "|" + axis_y + ")为中心的地图块");
                            data = FetchBlockMap(VillageID, axis_x, axis_y);
                        }

                        if (data != null)
                        {
                            ParseRaidTarget(VillageID, data, info_lst, popu_limit, bInclOss, bInclTribe);
                        }
                    }
                }

                RaidTargetFoundLog("共搜索到" + info_lst.Count + "个目标。");

                CallRaidTargetsListUpdate(info_lst);
            }
        }
예제 #4
0
        void Button1Click(object sender, EventArgs e)
        {
            if (bIsInSearching)
                return;

            bIsInSearching = true;
            int Range, Population;
            try
            {
                Range = Convert.ToInt32(this.NUD_Range.Value);
                Population = Convert.ToInt32(this.NUDPopulation.Value);
            }
            catch
            {
                return;
            }
            SearchingRaidTargetOption option = new SearchingRaidTargetOption()
            {
                VillageID = this.Village.ID,
                Range = Range,
                Population = Population,
                bInclOss = this.checkBoxInclOss.Checked,
                bInclTribe = this.checkBoxInclTribe.Checked,
            };
            this.Village.UpCall.FindRaidTargets(option);
        }