private void KillTask_ChatBoxMessage(object sender, ChatTextInterceptEventArgs e) { try { if(e.Color != 0 && e.Color != 3) {return;} if(e.Color == 0) { // You have killed 20 Frozen Wights! Your task is complete! // You have killed 18 Gurog Soldiers! You must kill 20 to complete your task. if([email protected]("You have killed")){return;} int mobskilled = 0; int totalmobs = 0; string mobname = String.Empty; bool taskcomplete = false; nibble = e.Text.Remove(0, 16); Int32.TryParse(nibble.Substring(0, nibble.IndexOf(' ')), out mobskilled); nibble = nibble.Remove(0, nibble.IndexOf(' ')); mobname = (@nibble.Substring(0, nibble.IndexOf('!'))).Trim(); if(@mobname.EndsWith("ies")){@mobname = @mobname.Replace("ies","y").Trim();} else if(@mobname.EndsWith("xes")){@mobname = @mobname.Remove(mobname.Length - 2, 2).Trim();} else if(@mobname.EndsWith("s")){@mobname = @mobname.Remove(mobname.Length -1, 1).Trim();} else if(mobname.EndsWith("men")){@mobname = @mobname.Replace("men","man");} nibble = nibble.Remove(0, nibble.IndexOf('!') + 2).Trim(); if(nibble.IndexOf("Your task is complete") == -1) { nibble = nibble.Remove(0, 14).Trim(); Int32.TryParse(nibble.Substring(0, nibble.IndexOf(' ')), out totalmobs); } else { totalmobs = mobskilled; taskcomplete = true; } if(LastKillTask == null || !LastKillTask.MobNames.Contains(@mobname)) { LastKillTask = mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.Where(x => x.CompleteCount == totalmobs && x.MobNames.Any(y => y == mobname)).FirstOrDefault(); if(LastKillTask == null) { WriteKillTaskFailureToFile(mobname, mobskilled, totalmobs); WriteToChat("Caught an untrackable killtask."); WriteToChat("You Killed " + mobname + " and need to kill " + totalmobs); WriteToChat("Results saved to file for future inclusion in kill task tracker."); return; } } if(LastKillStatus == null || LastKillStatus.TaskId != LastKillTask.KillTaskId) { LastKillStatus = mCharacterSettings.KillTaskStatus.Where(x => x.TaskId == LastKillTask.KillTaskId).FirstOrDefault(); if(LastKillStatus == null) { LastKillStatus = new TaskStatus(); LastKillStatus.TaskId = LastKillTask.KillTaskId; mCharacterSettings.KillTaskStatus.Add(LastKillStatus); } } LastKillStatus.CurrentCount = mobskilled; LastKillStatus.complete = taskcomplete; LastKillStatus.active = true; iLockerUpdate.bSubmitCharacterSettings = true; UpdateTaskPanel(); } if(e.Color == 3) { List<CollectTask> coltsklst = mGeneralSettings.GearTaskerSettings.MasterCollectTaskHash.Where(x => x.NPCNames.Any(y => @e.Text.StartsWith(@y))).ToList(); List<KillTask> kiltsklst = mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.Where(x => x.NPCNames.Any(y => @e.Text.StartsWith(@y))).ToList(); if (coltsklst.Count != 0) { CollectTask coltsk; if(coltsklst.Count == 1) { coltsk = coltsklst.FirstOrDefault(); } else { coltsk = coltsklst.Where(x => (@e.Text.Contains(@x.NPCYellowFlagText) || @e.Text.Contains(@x.NPCYellowCompleteText))).FirstOrDefault(); } if(coltsk == null) {return;} bool flag = @e.Text.Contains(@coltsk.NPCYellowFlagText); bool complete = @e.Text.Contains(@coltsk.NPCYellowCompleteText); if(!flag && !complete) {return;} TaskStatus status = mCharacterSettings.CollectTaskStatus.Where(x => x.TaskId == coltsk.CollectTaskId).FirstOrDefault(); if(status == null) { status = new TaskStatus(); status.TaskId = coltsk.CollectTaskId; mCharacterSettings.CollectTaskStatus.Add(status); } if(flag) { status.active = true; status.complete = false; } if(complete) { status.active = false; status.complete = false; } try { foreach(CollectTask ctsk in mGeneralSettings.GearTaskerSettings.MasterCollectTaskHash) { if(mCurrentInventory.AllInventory.Any(x => @x.Name == @ctsk.Item)) { TaskStatus stat = mCharacterSettings.CollectTaskStatus.Where(x => x.TaskId == ctsk.CollectTaskId).FirstOrDefault(); if(stat == null) { stat = new TaskStatus(); stat.TaskId = ctsk.CollectTaskId; stat.active = true; mCharacterSettings.CollectTaskStatus.Add(stat); } stat.CurrentCount = (int)AetherObjects.Inventory.Where(x => @x.Name == @coltsk.Item).Select(x => x.StackCount).ToArray().Sum(); if(stat.CurrentCount > ctsk.CompleteCount) { stat.complete = true; } } } }catch(Exception ex){LogError(ex);} iLockerUpdate.bSubmitCharacterSettings = true; UpdateTaskPanel(); return; } if (kiltsklst.Count > 0) { KillTask kiltsk; if(kiltsklst.Count == 1) { kiltsk = kiltsklst.FirstOrDefault(); } else { kiltsk = kiltsklst.Where(x => (@e.Text.Contains(@x.NPCYellowFlagText) || @e.Text.Contains(@x.NPCYellowCompleteText))).FirstOrDefault(); } if(kiltsk == null) {return;} bool flag = @e.Text.Contains(kiltsk.NPCYellowFlagText); bool complete = @e.Text.Contains(kiltsk.NPCYellowCompleteText); if(!flag && !complete) {return;} TaskStatus status = mCharacterSettings.KillTaskStatus.Where(x => x.TaskId == kiltsk.KillTaskId).FirstOrDefault(); if(status == null) { status = new TaskStatus(); status.TaskId = kiltsk.KillTaskId; mCharacterSettings.KillTaskStatus.Add(status); } if(flag) { status.active = true; status.complete = false; status.CurrentCount = 0; } if(complete) { status.active = false; status.complete = false; status.CurrentCount = 0; } } iLockerUpdate.bSubmitCharacterSettings = true; UpdateTaskPanel(); } }catch(Exception ex){LogError(ex);} }
private void KillTaskNew_Hit(object sender, EventArgs e) { try { KillTask NewKillTask = new KillTask(); NewKillTask.TaskName = "NewTask " + DateTime.Now; int i = 0; for(i = 0; i <= mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.Count; ) { if(!mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.Any(x => x.KillTaskId == i)) {break;} else{i++;} } NewKillTask.KillTaskId = i; KTHolder = NewKillTask; OldKTName = NewKillTask.TaskName; RenderKillTaskPopUp(); }catch(Exception ex){LogError(ex);} }
private void KillTaskDelete_Hit(object sender, EventArgs e) { try { int scroll = KillTaskList.ScrollPosition; KillTask deltask = mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.Where(x => x.TaskName == KillTaskSelected.Text).FirstOrDefault(); if(deltask == null) { WriteToChat("First select a kill task."); return; } mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.RemoveWhere(x => x.TaskName == deltask.TaskName); KillTaskSelected.Text = null; OldKTName = String.Empty; KTHolder = null; UpdateTaskPanel(); KillTaskList.ScrollPosition = scroll; }catch(Exception ex){LogError(ex);} }
private void KillTaskEdit_Hit(object sender, EventArgs e) { try { KTHolder = mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.Where(x => x.TaskName == KillTaskSelected.Text).FirstOrDefault(); if(KTHolder == null) { WriteToChat("First select a kill task."); return; } OldKTName = KTHolder.TaskName; RenderKillTaskPopUp(); }catch(Exception ex){LogError(ex);} }
private void KTPopView_VisibleChanged(object sender, EventArgs e) { try { KTHolder.TaskName = KTPopTaskName.Text; KTHolder.CompleteCount = Convert.ToInt32(KTPopCompleteCount.Text); KTHolder.NPCInfo = KTPopNPCInfo.Text; KTHolder.NPCCoords = KTPopNPCCoords.Text; KTHolder.NPCYellowFlagText = KTPopNPCFlagTxt.Text; KTHolder.NPCYellowCompleteText = KTPopNPCCompleteTxt.Text; mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.RemoveWhere(x => x.TaskName == OldKTName); mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.Add(KTHolder); iLockerUpdate.bSubmitGeneralSettings = true;; KTHolder = null; OldKTName = String.Empty; KTPopDispose(); UpdateTaskPanel(); }catch(Exception ex){LogError(ex);} }