예제 #1
0
    public override void CloseRecord(BaseTask task)
    {
        CollectTask collect       = task as CollectTask;
        long        expStartTicks = ExperimentManager.ExpStartTicks;

        startTimeStamp = TicksToSecond(collect.startTick - expStartTicks);
        endTimeStamp   = TicksToSecond(collect.closedTick - expStartTicks);
    }
예제 #2
0
    public static string RecordHeader = "Index,TaskIndex,StartTimeStamp,EndTimeStamp"; // ,PrevDistance,TravelDistance

    // public float prevDistance;  // distance to previous target
    // public Vector3 targetPosition;

    public CollectRecord(CollectRecord preRecord, CollectTask task)
    {
        taskIndex   = task.TaskIndex;
        recordIndex = (preRecord == null)? 0: preRecord.recordIndex + 1;



        // targetPosition = task.gameObject.transform.position;
        // prevDistance = (recordIndex == 0) ? 0.0f : (targetPosition - preRecord.targetPosition).magnitude;
    }
        public void StartNewTask(CollectTask collectTask)
        {
            collectTask.CollectTaskId = currentId;
            currentId++;

            tasks.Add(collectTask);

            Trace.TraceEvent(TraceEventType.Start, collectTask.GetHashCode(), collectTask.ToString());

            Task.Factory.StartNew(startTask, collectTask);
        }
예제 #4
0
    private void NormalMode()
    {
        if (inQueue)
        {
            return;
        }

        SetInQueue(true);

        CollectTask _collect = new CollectTask(gameObject, blueprint);

        taskManager.AddTask(_collect);
    }
		public async Task Collect(CollectTask collectTask)
		{
			var blockFactory = new BlockFactory(collectTask);
			var blockController = new BlockController();
			blockController.Trace = DataCollector.Trace;
			blockFactory.Trace = DataCollector.Trace;

			// Create repo for write results
			var inputRepo = getRepository(collectTask.Input);
			var outputRepo = getRepository(collectTask.Output);

			var inputBufferBlock = blockFactory.InputBuffer();
			var bacthBlock = blockFactory.Batch<string>();
			var processBlock = blockFactory.Process();
			var outputBufferBlock = blockFactory.OutputBuffer();
			var outputBlock = blockFactory.WriteResults(outputRepo);

			blockController.LinkWithCompletion(inputBufferBlock, bacthBlock);
			blockController.LinkWithCompletion(bacthBlock, processBlock);
			blockController.LinkWithCompletion(processBlock, outputBufferBlock);
			blockController.LinkWithCompletion(outputBufferBlock, outputBlock);

			// Read data and send to blocks
			foreach (var item in inputRepo.GetInputData())
			{
				await inputBufferBlock.SendAsync(item);
				collectTask.AllItems++;

                if (collectTask.AllItems % 524288 == 0)
                    Thread.Sleep(TimeSpan.FromMinutes(15));

				if (collectTask.CancellationSource.IsCancellationRequested)
					break;
			}
			inputBufferBlock.Complete();

			await outputBlock.Completion;

			inputRepo.Dispose();
			outputRepo.Dispose();
		}
        CollectTask createTask(CollectForm collectForm)
        {
            var inputFilename = collectForm.InputFile.Trim('"','\'');

            CollectTask ct = new CollectTask() { SocialNetwork = collectForm.Network, Method = collectForm.Method };
            ct.Input = new CollectTaskIOFile() { Filename = inputFilename };

            if (collectForm.OutputInDb)
            {
                //string connStr = ConfigurationManager.ConnectionStrings["postgresql"].ConnectionString;
                string connStr = ConfigurationManager.ConnectionStrings["sqlserver"].ConnectionString;
                ct.Output = new CollectTaskIODatabase() { ConnectionString = connStr };
            }
            else
            {
                var outputFilename = collectForm.OutputFilename.Trim('"', '\'');
                ct.Output = new CollectTaskIOFile() { Filename = outputFilename };
            }

            return ct;
        }
예제 #7
0
        private void CTPopView_VisibleChanged(object sender, EventArgs e)
        {
            try
            {
                CTHolder.TaskName = CTPopTaskName.Text;
                CTHolder.CompleteCount = Convert.ToInt32(CTPopCompleteCount.Text);
                CTHolder.Item = CTPopItemName.Text;
                CTHolder.NPCInfo = CTPopNPCInfo.Text;
                CTHolder.NPCCoords = CTPopNPCCoords.Text;
                CTHolder.NPCYellowFlagText = CTPopNPCFlagTxt.Text;
                CTHolder.NPCYellowCompleteText = CTPopNPCCompleteTxt.Text;

                List<CollectTask> MasterCTList = ReadMasterCTList();

                if(MasterCTList.Any(x => x.TaskName == OldCTName))
                {
                    MasterCTList.RemoveAll(x => x.TaskName == OldCTName);
                }

                MasterCTList.Add(CTHolder);

                WriteMasterCTList(MasterCTList);

                if(!mKTSet.MyCollectTasks.Any(x => x.TaskName == CTHolder.TaskName))
                {
                    mKTSet.MyCollectTasks.Add(CTHolder);
                }

                if(OldCTName != CTHolder.TaskName)
                {
                    mKTSet.MyCollectTasks.RemoveAll(x => x.TaskName == OldCTName);
                }

                ReadWriteGearTaskSettings(false);

                CTHolder = null;
                OldCTName = String.Empty;

                CTPopDispose();

                UpdateTaskPanel();
            }catch(Exception ex){LogError(ex);}
        }
예제 #8
0
        private void CollectTaskNew_Hit(object sender, EventArgs e)
        {
            try
            {
                CollectTask NewCollectTask = new CollectTask();

                NewCollectTask.TaskName = "NewTask " + DateTime.Now;
                CTHolder = NewCollectTask;
                OldCTName = NewCollectTask.TaskName;
                RenderCollectTaskPopUp();
            }catch(Exception ex){LogError(ex);}
        }
예제 #9
0
        private void CollectTaskEdit_Hit(object sender, EventArgs e)
        {
            try
            {
                int Index = mKTSet.MyCollectTasks.FindIndex(x => x.TaskName == CollectTaskSelected.Text);
                if(Index == -1)
                {
                    WriteToChat("First select a collect task.");
                    return;
                }

                CTHolder = mKTSet.MyCollectTasks[Index];
                OldCTName = CTHolder.TaskName;
                RenderCollectTaskPopUp();
            }catch(Exception ex){LogError(ex);}
        }
예제 #10
0
        private void CollectTaskDelete_Hit(object sender, EventArgs e)
        {
            try
            {
                int scroll = CollectTaskList.ScrollPosition;

                int Index = mKTSet.MyCollectTasks.FindIndex(x => x.TaskName == CollectTaskSelected.Text);
                if(Index == -1)
                {
                    WriteToChat("First select a collect task.");
                    return;
                }

                List<CollectTask> MasterCTList = ReadMasterCTList();
                if(MasterCTList.Any(x => x.TaskName == CollectTaskSelected.Text))
                {
                    MasterCTList.RemoveAll(x => x.TaskName == CollectTaskSelected.Text);
                }

                WriteMasterCTList(MasterCTList);

                mKTSet.MyCollectTasks.RemoveAll(x => x.TaskName == CollectTaskSelected.Text);
                ReadWriteGearTaskSettings(false);

                CollectTaskSelected.Text = null;
                OldCTName = String.Empty;
                CTHolder = null;

                UpdateTaskPanel();

                CollectTaskList.ScrollPosition = scroll;

            }catch(Exception ex){LogError(ex);}
        }
예제 #11
0
        private void BuildCollectionTaskList()
        {
            List<CollectTask> NewCollectTasks = new List<PluginCore.CollectTask>();

            CollectTask t;

            t = new CollectTask();
            t.TaskName = "Prickly Pear Collecting (Neftet)";
            t.Item = "Prickly Pear";
            t.MobNames.Add("Prickly Pear");
            t.CompleteCount = 15;
            t.NPCNames.Add("Hammah al Rundik");
            t.NPCInfo = "Neftet Encampment";
            t.NPCCoords = "22.2S, 6.2E";
            t.NPCYellowFlagText = "If you'll bring me 15 Prickly Pears, I'll happily reward you.";
            t.NPCYellowCompleteText = "Ahh, a full bushel of Prickly Pears, just what every gourmet needs.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Stone Tablet Collecting (Neftet)";
            t.Item = "Broken Stone Tablet";
            t.MobNames.Add("Cracked Stone Tablet");
            t.CompleteCount = 15;
            t.NPCNames.Add("Taylarn bint Tulani");
            t.NPCInfo = "Neftet Encampment";
            t.NPCCoords = "22.2S, 6.2E";
            t.NPCYellowFlagText = "If you bring me any tablets you find, I'm prepared to reward any of sufficient experience for bringing me 15 stone tablets.";
            t.NPCYellowCompleteText = "Ahh, a full stack of 15 stone tablets.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "A'nekshay Bracer Collecting (Neftet)";
            t.Item = "Engraved A'nekshay Bracer";
            t.MobNames.Add("A'nekshay");
            t.CompleteCount = 15;
            t.NPCNames.Add("T'ing Setsuko");
            t.NPCInfo = "Neftet Encampment";
            t.NPCCoords = "22.2S, 6.2E";
            t.NPCYellowFlagText = "I am prepared to reward Adventurers of sufficient experience for their efforts in collecting 15 of these A'nekshay Bracers.";
            t.NPCYellowCompleteText = "Ahh, a full stack of 15 A'nekshay Bracers.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Snow Tusker Blood Collection (Frozen Valley)";
            t.Item = "Snow Tusker Blood Sample";
            t.MobNames.Add("Snow Tusker");
            t.CompleteCount = 10;
            t.NPCNames.Add("Archmage Ichihiri");
            t.NPCInfo = "Frozen Valley";
            t.NPCCoords = "83.8N 4.3W";
            t.NPCYellowFlagText = "If you could bring me 10 samples of Snow Tusker Blood";
            t.NPCYellowCompleteText = "I see that you have gathered 10 vials of blood from these Snow Tuskers.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Undead Jaw Collection (Society)";
            t.Item = "Pyre Skeleton Jaw";
            t.MobNames.Add("Pyre Minion");
            t.MobNames.Add("Pyre Skeleton");
            t.MobNames.Add("Pyre Champion");
            t.CompleteCount = 8;
            t.NPCNames.Add("Balon Strongarm");
            t.NPCNames.Add("Hador the Vengeful");
            t.NPCNames.Add("Cullum of Celdon");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "Be on your way, and come talk to me when you have eight!";
            t.NPCYellowCompleteText = "Well done. Let me take those from you";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Collect Gear Knight Parts (Society)";
            t.Item = "Pile of Gearknight Parts";
            t.MobNames.Add("Invading");
            t.CompleteCount = 10;
            t.NPCNames.Add("Trathium");
            t.NPCNames.Add("Dark Reshan");
            t.NPCNames.Add("Drocogst");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "Bring back parts from 10 of the Gearknights and I shall reward you.";
            t.NPCYellowCompleteText = "A solid blow to their forces.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Falatacot Report Collector (Society)";
            t.Item = "Falatacot Battle Report";
            t.MobNames.Add("Falatacot Blood Prophetess");
            t.CompleteCount = 10;
            t.NPCNames.Add("Boroth Bearhand");
            t.NPCNames.Add("Turvald Snorborgson");
            t.NPCNames.Add("Agbeart");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "Go to Dark Isle and collect the Falatacot reports.";
            t.NPCYellowCompleteText = "Ah, here we go.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Black Coral Collection (Society)";
            t.Item = "Black Coral";
            t.MobNames.Add("");
            t.CompleteCount = 10;
            t.NPCNames.Add("Hidoshi Kawara");
            t.NPCNames.Add("Manto Sakara");
            t.NPCNames.Add("Daisei Chirana");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "Bring exactly ten of this black coral to me.";
            t.NPCYellowCompleteText = "This is sufficient.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Glowing Jungle Lily Collector (Society)";
            t.Item = "Glowing Jungle Lily";
            t.MobNames.Add("Blessed Moarsman");
            t.MobNames.Add("Blessed Moar");
            t.MobNames.Add("Ashris Niffis");
            t.CompleteCount = 20;
            t.NPCNames.Add("Kojina");
            t.NPCNames.Add("Satsuki");
            t.NPCNames.Add("Atsuko");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "If you get me at least 20 Glowing Jungle Lilies";
            t.NPCYellowCompleteText = "Ahh, the flowers, here, let me take those from you";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Glowing Moar Gland Collector (Society)";
            t.Item = "Glowing Moar Gland";
            t.MobNames.Add("Blessed Moar");
            t.CompleteCount = 30;
            t.NPCNames.Add("Aurellia du Cinghalle");
            t.NPCNames.Add("Elloisa du Cinghalle");
            t.NPCNames.Add("Pia du Cinghalle");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "kill enough Blessed Moars to collect at least 30 Glowing Moar Glands";
            t.NPCYellowCompleteText = "Perfect, you have the glands";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Mana-Infused Jungle Flower Collector (Society)";
            t.Item = "Mana-Infused Jungle Flower";
            t.MobNames.Add("");
            t.CompleteCount = 20;
            t.NPCNames.Add("Giri bint Ashud");
            t.NPCNames.Add("Leisall bint Jumadd");
            t.NPCNames.Add("Ti'alla bint Ashud");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "If you get me at least 20 Mana-Infused Jungle Flowers";
            t.NPCYellowCompleteText = "Ahh, the flowers, here, let me take those from you";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Phyntos Honey Collector (Society)";
            t.Item = "Phyntos Honey";
            t.MobNames.Add("Giant Jungle Phyntos Wasp");
            t.MobNames.Add("Killer Phyntos Hive");
            t.MobNames.Add("Killer Phyntos Swarm");
            t.CompleteCount = 10;
            t.NPCNames.Add("Narris");
            t.NPCNames.Add("Zahid al-Din");
            t.NPCNames.Add("Kenji");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "Bring me anything phyntos related you find";
            t.NPCYellowCompleteText = "We're studying their honey to see if it will reveal anything about their aggressive nature";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Phyntos Splinter Collector (Society)";
            t.Item = "Hive Splinters";
            t.MobNames.Add("Killer Phyntos Hive");
            t.CompleteCount = 10;
            t.NPCNames.Add("Narris");
            t.NPCNames.Add("Zahid al-Din");
            t.NPCNames.Add("Kenji");
            t.NPCInfo = "Society";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = " I'll determine what we can use";
            t.NPCYellowCompleteText = "These Phyntos Hive Splinters are proof of destroyed hives";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Noble Remains Kill Task (Mhoire)";
            t.Item = "Mhoire Signet Ring";
            t.MobNames.Add("Noble Remain");
            t.CompleteCount = 10;
            t.NPCNames.Add("Shade of Ormend");
            t.NPCInfo = "Mhoire Castle Northeast Tower";
            t.NPCCoords = "64.7S 45.2W";
            t.NPCYellowFlagText = "Destroy these corrupted remains and gather the signet rings from the bones. Return them to me and I will reward you.";
            t.NPCYellowCompleteText = "I see that you have recovered 10 signet rings of House Mhoire.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "High Priest of T'thuun (Society)";
            t.Item = "Holy Symbol";
            t.MobNames.Add("High Priest of T'thuun");
            t.CompleteCount = 1;
            t.NPCNames.Add("Kaymor ibn Dumandi");
            t.NPCNames.Add("Milos ibn Ashud");
            t.NPCNames.Add("Lunbal Dolicci");
            t.NPCInfo = "Society Stronghold";
            t.NPCCoords = "Unknown";
            t.NPCYellowFlagText = "Kill this Moarsman High Priest and bring back the Holy Symbol he wields as proof of your kill.";
            t.NPCYellowCompleteText = "Excellent, you were able to defeat the High Priest!";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Alb'arean Ore Collection";
            t.Item = "Alb'arean Ore";
            t.MobNames.Add("");
            t.CompleteCount = 10;
            t.NPCNames.Add("Lady Dan'eel Trianna");
            t.NPCInfo = "Cragstone";
            t.NPCCoords = "26.2N, 47.1E";
            t.NPCYellowFlagText = "collecting 10 pieces of Alb'arean Ore";
            t.NPCYellowCompleteText = "Ahh, a full stack of 10 Alb'arean Ore.";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Bloodroot Vine Collection";
            t.Item = "Bloodroot Vine";
            t.MobNames.Add("");
            t.CompleteCount = 10;
            t.NPCNames.Add("Lady Sherath Trianna");
            t.NPCInfo = "Cragstone";
            t.NPCCoords = "26.2N, 47.1E";
            t.NPCYellowFlagText = "collecting 10 Bloodroot Vines";
            t.NPCYellowCompleteText = "";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Rez'arean Ore Collection";
            t.Item = "Rez'arean Ore";
            t.MobNames.Add("");
            t.CompleteCount = 10;
            t.NPCNames.Add("Lady Kiara Trianna");
            t.NPCInfo = "Cragstone";
            t.NPCCoords = "26.2N, 47.1E";
            t.NPCYellowFlagText = "collecting 10 pieces of Rez'arean Ore";
            t.NPCYellowCompleteText = "Ahh, a full stack of 10 Rez'arean Ore";
            NewCollectTasks.Add(t);

            t = new CollectTask();
            t.TaskName = "Desert Flower Collection";
            t.Item = "Desert Flower";
            t.MobNames.Add("");
            t.CompleteCount = 10;
            t.NPCNames.Add("Lady Mashal Trianna");
            t.NPCInfo = "Cragstone";
            t.NPCCoords = "26.2N, 47.1E";
            t.NPCYellowFlagText = "collecting 10 Desert Flowers";
            t.NPCYellowCompleteText = "Ahh, a full stack of 10 Desert Flowers.";
            NewCollectTasks.Add(t);

            //			t = new CollectTask();
            //			t.TaskName = "";
            //			t.Item = "";
            //			t.MobNames.Add("");
            //			t.CompleteCount = ;
            //			t.NPCNames.Add("");
            //			t.NPCNames.Add("");
            //			t.NPCNames.Add("");
            //			t.NPCInfo = "Society";
            //			t.NPCCoords = "Unknown";
            //			t.NPCYellowFlagText = "";
            //			t.NPCYellowCompleteText = "";
            //			mKTSet.MyCollectTasks.Add(t);

            FileInfo TaskFile = new FileInfo(GearDir + @"\Collect.xml");
            if(TaskFile.Exists)
            {
                TaskFile.Delete();
            }

            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;
            settings.NewLineOnAttributes = true;

            XmlWriter writer = XmlWriter.Create(TaskFile.ToString(), settings);

               			XmlSerializer serializer2 = new XmlSerializer(typeof(List<CollectTask>));
               			serializer2.Serialize(writer, NewCollectTasks);
               			writer.Close();
        }