Ejemplo n.º 1
0
        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);}
        }
Ejemplo n.º 2
0
        private void CollectTask_ChangeObject(object sender, int ObjectId)
        {
            try
            {
                AetherObject ao = AetherObjects.Collection[ObjectId];
                if(LastCollectTask == null || @LastCollectTask.Item != @ao.Name)
                {
                    if(!CollectItemsHash.Contains(@ao.Name)){return;}
                    else{LastCollectTask = mGeneralSettings.GearTaskerSettings.MasterCollectTaskHash.Where(x => @x.Item == @ao.Name).FirstOrDefault();}
                }

                if(LastCollectStatus == null || LastCollectStatus.TaskId != LastCollectTask.CollectTaskId)
                {
                    LastCollectStatus = mCharacterSettings.CollectTaskStatus.Where(x => x.TaskId == LastCollectTask.CollectTaskId).FirstOrDefault();
                    if(LastCollectStatus == null)
                    {
                        LastCollectStatus = new TaskStatus();
                        LastCollectStatus.TaskId = LastCollectTask.CollectTaskId;
                        LastCollectStatus.active = true;
                        mCharacterSettings.CollectTaskStatus.Add(LastCollectStatus);
                    }
                }

                LastCollectStatus.CurrentCount = mCurrentInventory.InvCountByName(@LastCollectTask.Item);

                if(LastCollectStatus.CurrentCount >= LastCollectTask.CompleteCount){LastCollectStatus.complete = true;}
                else{LastCollectStatus.complete = false;}

                UpdateTaskPanel();
            }catch(Exception ex){LogError(ex);}
        }
Ejemplo n.º 3
0
        private void KillTaskList_Click(object sender, int row, int col)
        {
            try
            {
                int scroll = KillTaskList.ScrollPosition;

                ClickRow = KillTaskList[row];
                KillTaskSelected.Text = ((HudStaticText)ClickRow[1]).Text;
                KillTaskSelected.TextColor = Color.Red;

                KillTask kt = mGeneralSettings.GearTaskerSettings.MasterKillTaskHash.Where(x => x.TaskName == ((HudStaticText)ClickRow[1]).Text).FirstOrDefault();
                if(col == 0)
                {
                    TaskStatus stat = mCharacterSettings.KillTaskStatus.Where(x => x.TaskId == kt.KillTaskId).FirstOrDefault();
                    if(stat == null)
                    {
                        stat = new TaskStatus();
                        stat.TaskId = kt.KillTaskId;
                        stat.track = ((HudCheckBox)ClickRow[0]).Checked;
                        mCharacterSettings.KillTaskStatus.Add(stat);
                    }
                    else
                    {
                        stat.track = ((HudCheckBox)ClickRow[0]).Checked;
                    }
                    iLockerUpdate.bSubmitCharacterSettings = true;
                }
                if(col == 1)
                {
                    string NPCs = String.Empty;
                    foreach(string npc in kt.NPCNames)
                    {
                        NPCs += npc + ", ";
                    }
                    WriteToChat(kt.TaskName + ":  " + NPCs + kt.NPCInfo + CoordsStringLink(kt.NPCCoords));
                }

                UpdateTaskPanel();

                KillTaskList.ScrollPosition = scroll;
            }catch(Exception ex){LogError(ex);}
        }
Ejemplo n.º 4
0
        private void SubscribeKillTasks()
        {
            try
            {
                Core.ChatBoxMessage += KillTask_ChatBoxMessage;
                AetherCharacter.CharacterLogOff += KillTask_LogOff;
                AetherObjects.ObjectChanged += CollectTask_ChangeObject;

            }catch(Exception ex){LogError(ex);}

            try
            {
                foreach(CollectTask coltsk in mGeneralSettings.GearTaskerSettings.MasterCollectTaskHash)
                {
                    CollectItemsHash.Add(@coltsk.Item);
                    if(mCurrentInventory.AllInventory.Any(x => @x.Name == @coltsk.Item))
                    {
                        TaskStatus stat = mCharacterSettings.CollectTaskStatus.Where(x => x.TaskId == coltsk.CollectTaskId).FirstOrDefault();
                        if(stat == null)
                        {
                            stat = new TaskStatus();
                            stat.TaskId = coltsk.CollectTaskId;
                            stat.active = true;
                            mCharacterSettings.CollectTaskStatus.Add(stat);
                        }
                        stat.CurrentCount = mCurrentInventory.InvCountByName(@coltsk.Item);
                        if(stat.CurrentCount >= coltsk.CompleteCount){stat.complete = true;}
                        else{stat.complete = false;}
                    }
                }
            }catch(Exception ex){LogError(ex);}
        }