示例#1
1
        public CraftingAI(Character user)
        {
            OpenFileDialog openfiledialog = new OpenFileDialog();
            openfiledialog.Filter = Resources.CraftingAI_CraftingAI_Crafting_AI_Script____csx____csx;

            if (openfiledialog.ShowDialog() == DialogResult.Cancel)
                return;

            _scriptingObject = new ScriptingObject(user);
            _host = new ScriptingHost(_scriptingObject);

            _host.ImportNamespace("Chocobot.Utilities.Keyboard");
            _host.ImportNamespace("Chocobot.Datatypes");

            try
            {
                _host.ExecuteFile(openfiledialog.FileName);
            }
            catch (Roslyn.Compilers.CompilationErrorException ex)
            {
                MessageBox.Show(ex.Diagnostics.ToString(), Resources.CraftingAI_CraftingAI_Scripting_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Debug.Print(ex.Diagnostics.ToString());
                return;
            }

            try
            {
                var res = _host.Execute("Initialize();");

            }
            catch (Roslyn.Compilers.CompilationErrorException ex)
            {
                Console.WriteLine("{0}{1}", Environment.NewLine,
                                            ex.Diagnostics);
                throw;
            }

            _valid = true;
        }
示例#2
0
        public override void Fight(Character user, Character monster, Recast recast)
        {
            base.Fight(user, monster, recast);

            if (_valid == false)
                return;

            UIWindow ui = new UIWindow();
            ui.RefreshPointers();

            if (ui.GetActiveWindowName() == "chatlog")
                return;

            recast.Refresh();

            _scriptingObject.Cooldowns = recast;
            _scriptingObject.CurrentMonster = monster;
            _scriptingObject.CurrentUser = user;

            //Debug.Print("Fighting");
            try
            {

                var res = _host.Execute("Fight();");

                if (res != null)
                    Console.WriteLine(" = " + res.ToString());
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex.Message);

            }
        }
示例#3
0
 public virtual void Fight(Character user, Character monster, Recast recast)
 {
     if (HasCure)
         if (user.Health_Percent < 50)
         {
             Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D0);
         }
 }
示例#4
0
        public override void Fight(Character user, Character monster, Recast recast)
        {
            base.Fight(user, monster, recast);

            monster.Target();
            recast.Refresh();

            if (recast.WeaponSpecials.Count == 0)
            {
                Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D1);
            }
        }
示例#5
0
        private static Character FindBestAOETarget(List<Character> damagedTargets, bool userOrigin, Character user, double range, out int bestRange)
        {
            Character bestTarget = null;
            bestRange = 0;

            if(userOrigin)
            {
                int withinRange = 0;
                foreach (Character checkTarget in damagedTargets)
                {
                    if (checkTarget.DistanceFrom(user) <= range)
                    {
                        withinRange++;
                    }
                }

                if (bestRange < withinRange)
                {
                    bestRange = withinRange;
                    bestTarget = user;
                }

            } else
            {
                foreach (Character damagedTarget in damagedTargets)
                {

                    int withinRange = 0;
                    foreach (Character checkTarget in damagedTargets)
                    {
                        if (checkTarget.DistanceFrom(damagedTarget) <= range && (checkTarget.Health_Max - checkTarget.Health_Current) > 400)
                        {
                            withinRange++;
                        }
                    }

                    if (bestRange < withinRange)
                    {
                        bestRange = withinRange;
                        bestTarget = damagedTarget;
                    }
                }

            }

            return bestTarget;
        }
示例#6
0
 public ScriptingObject(Character user)
 {
     CurrentUser = user;
     Craftwindow = null;
     CraftStep = 0;
 }
示例#7
0
        public override void Fight(Character user, Character monster, Recast recast)
        {
            base.Fight(user, monster, recast);
            bool dotNeeded = !monster.ContainsStatusEffect(246, user.ID, true);
            bool dragonkickNeeded = !monster.ContainsStatusEffect(98, 0, false);
            bool lockIcon;
            monster.Target();
            recast.Refresh(2.0);

            try
            {

                ePosition position = monster.Position(user);

                Hotkeys hotkeys = new Hotkeys();
                Hotkeys.Hotkey highlightedAbility = null;

                hotkeys.RefreshAbilities();

                _mnkHelper.txt_Title.Content = "Position: " + position.ToString();

                if (user.ContainsStatusEffect(103, 0, false) == false && hotkeys[63].PercentReady == 100)
                {
                    hotkeys[63].UseAbility();
                }

                int colorOffset = (int)((hotkeys.Abilities[53].PercentReady - 25) * 3.4);
                if (colorOffset > 255)
                    colorOffset = 255;

                if (hotkeys.Abilities[53].PercentReady < 75)
                {
                    _mnkHelper.txt_Current.Foreground =
                        new SolidColorBrush(Color.FromRgb(255, 0, 255));
                    lockIcon = true;
                }
                else
                {
                    lockIcon = false;
                    _mnkHelper.txt_Current.Foreground = new SolidColorBrush(Color.FromRgb((byte)(255 - colorOffset), (byte)colorOffset, 0));
                }

                if (user.ContainsStatusEffect(110, 0, false))
                {
                    if (position == ePosition.Side)
                        highlightedAbility = hotkeys.Abilities[56]; // Snap Punch
                    else if (position == ePosition.Back)
                        highlightedAbility = hotkeys.Abilities[54]; // True Strike
                    else
                        highlightedAbility = hotkeys.Abilities[56]; // Snap Punch

                    if (hotkeys.Abilities[53].PercentReady > 50 && lockIcon == false)
                    {
                        SetCurrentAbilityImage(highlightedAbility.ID, recast, true, dotNeeded, dragonkickNeeded);
                    }

                }
                else
                {
                    foreach (KeyValuePair<short, Hotkeys.Hotkey> hk in hotkeys.Abilities)
                    {
                        if (hk.Value.Highlighted)
                        {
                            if (user.ContainsStatusEffect(101, 0, false) == false && hk.Value.ID == 61 && user.TP_Current >= 60) // Twin Snakes if damage buff is down
                            {
                                highlightedAbility = hk.Value;
                                break;
                            }
                            else if (hk.Value.ID == 58 && user.TP_Current >= 40) // Haymaker
                            {
                                highlightedAbility = hk.Value;
                                break;
                            }
                            else if (position == ePosition.Side)
                            {
                                if (hk.Value.ID == 61 && user.TP_Current >= 60) // Twin Snakes
                                {
                                    highlightedAbility = hk.Value;
                                }
                                else if (hk.Value.ID == 56 && user.TP_Current >= 50) // Snap Punch
                                {
                                    highlightedAbility = hk.Value;
                                }

                            }
                            else if (position == ePosition.Back)
                            {
                                if (hk.Value.ID == 54 && user.TP_Current >= 50) // True Strike
                                {
                                    highlightedAbility = hk.Value;
                                }
                                else if (hk.Value.ID == 66 && monster.ContainsStatusEffect(246, user.ID, true) == false && user.TP_Current >= 50) // Demolish DOT
                                {
                                    highlightedAbility = hk.Value;
                                }
                                else if (hk.Value.ID == 56 && user.TP_Current >= 50) // Snap Punch
                                {
                                    if (highlightedAbility != null)
                                        if (highlightedAbility.ID == 66)
                                            continue;

                                    highlightedAbility = hk.Value;
                                }
                            }
                            else
                            {
                                if (hk.Value.ID != 72 && hk.Value.ID != 36 && user.TP_Current >= 60)
                                {
                                    highlightedAbility = hk.Value;
                                }

                            }
                        }
                    }

                    // Check for highlighted abilities if there is no position combos available.
                    if (highlightedAbility == null)
                    {
                        foreach (KeyValuePair<short, Hotkeys.Hotkey> hk in hotkeys.Abilities)
                        {
                            if (hk.Value.Highlighted)
                            {
                                if (user.ContainsStatusEffect(101, 0, false) == false && hk.Value.ID == 61 && user.TP_Current >= 60)
                                    // Twin Snakes if damage buff is down
                                {
                                    highlightedAbility = hk.Value;
                                    break;
                                }

                                if (hk.Value.ID == 66 && monster.ContainsStatusEffect(246, user.ID, true) == false && user.TP_Current >= 50)
                                    // Demolish DOT
                                {
                                    highlightedAbility = hk.Value;
                                    break;
                                }

                                if (hk.Value.ID != 72 && hk.Value.ID != 36 && user.TP_Current >= 60)
                                    highlightedAbility = hk.Value;
                            }
                        }

                    }

                    if (highlightedAbility == null)
                    {
                        if (lockIcon == false)
                        {
                            if (monster.ContainsStatusEffect(106, user.ID, true) == false)
                            {
                                SetCurrentAbilityImage(68, recast, false, dotNeeded, dragonkickNeeded);
                                    // Touch of Death

                            }
                            else if (position == ePosition.Back)
                            {
                                SetCurrentAbilityImage(53, recast, false, dotNeeded, dragonkickNeeded);
                            }
                            else if (position == ePosition.Side)
                            {
                                SetCurrentAbilityImage(74, recast, false, dotNeeded, dragonkickNeeded);
                            }
                            else
                            {
                                SetCurrentAbilityImage(53, recast, false, dotNeeded, dragonkickNeeded);
                            }
                        }
                    }
                    else
                    {
                        if (hotkeys.Abilities[53].PercentReady > 75 && lockIcon == false)
                        {
                            SetCurrentAbilityImage(highlightedAbility.ID, recast, false, dotNeeded, dragonkickNeeded);
                        }
                    }
                }

                if (recast.SubAbilities.Contains(80) == false && user.TP_Current < 450)
                {
                    hotkeys.Abilities[80].UseAbility(); // Invigorate
                }
                else if (hotkeys.Abilities[53].PercentReady > 80 && hotkeys.Abilities[53].InRange == 1)
                {
                    if (highlightedAbility != null) // Use Combo
                    {
                        highlightedAbility.UseAbility();
                    }
                    else if (monster.ContainsStatusEffect(106, user.ID, true) == false && user.TP_Current >= 80) // Touch of Death
                    {
                        hotkeys.Abilities[68].UseAbility();
                    }
                    else if (position == ePosition.Back && user.TP_Current >= 60)
                    {
                        hotkeys.Abilities[53].UseAbility(); // Start Bootshine Combo
                    }
                    else if (position == ePosition.Side && user.TP_Current >= 60)
                    {
                        hotkeys.Abilities[74].UseAbility(); // Start Dragonkick
                    }
                    else if(user.TP_Current >= 60)
                    {
                        hotkeys.Abilities[53].UseAbility();
                    }
                }
                else if (hotkeys.Abilities[53].InRange == 1)
                {
                    if (recast.Abilities.Contains(3) == false || recast.SubAbilities.Contains(85) == false)
                    {
                        Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.Dash);
                    }
                    else if (recast.Abilities.Contains(8) == false && user.ContainsStatusEffect(112, 0, false) == false && user.ContainsStatusEffect(113, 0, false) == false && user.Level >= 50)
                    {
                        hotkeys.Abilities[69].UseAbility(); // Perfect Balance
                    }
                    else if (recast.Abilities.Contains(5) == false)
                    {
                        hotkeys.Abilities[64].UseAbility(); // Steel Peak
                    }
                    else if (recast.Abilities.Contains(7) == false)
                    {
                        hotkeys.Abilities[67].UseAbility(); // Howling Fist
                    }
                    else if (hotkeys[36].PercentReady >= 99 && hotkeys[36].IsInHotbar && hotkeys[36].Activated) // Mercy Stroke
                    {
                        hotkeys[36].UseAbility();
                    }

                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.StackTrace.ToString());
            }
        }
示例#8
0
        public bool MonsterNear(Character monster, string monsterSearch)
        {
            List<Character> nearby = monster.MonstersNear(15);

            foreach (Character currmonster in nearby)
            {
                if (currmonster.Name.ToLower().Contains(monsterSearch.ToLower()))
                {
                    return true;
                }
            }

            return false;
        }
示例#9
0
        private static void WaitForAbility(Character user, Keys key, bool controlKey)
        {
            user.Refresh();

            //Debug.Print("Before: " + user.Status.ToString() + " " + user.IsCrafting.ToString());
            Stopwatch timer = new Stopwatch();

            timer.Reset();
            timer.Start();

            while ((user.UsingAbility) && user.IsCrafting && timer.Elapsed.Seconds < 3)
            {
                user.Refresh();
            }

            while ((user.UsingAbility == false) && user.IsCrafting && timer.Elapsed.Seconds < 3)
            {
                if (controlKey)
                {
                    Utilities.Keyboard.KeyBoardHelper.Ctrl(key);
                }
                else
                {
                    Utilities.Keyboard.KeyBoardHelper.KeyPress(key);
                }
                user.Refresh();
            }

            Debug.Print("Waiting for start: " + timer.Elapsed.Milliseconds.ToString());
            //while ((user.Status == CharacterStatus.Idle || user.Status == CharacterStatus.Crafting_Idle) && user.IsCrafting && timer.Elapsed.Seconds < 4)
            //{
            //    user.Refresh();
            //}

               // Debug.Print("After: " + user.Status.ToString() + " " + user.IsCrafting.ToString());
            timer.Restart();

            while ((user.UsingAbility == true) && user.IsCrafting && timer.Elapsed.Seconds < 3)
            {
                user.Refresh();
            }

            Debug.Print("Ability Finished: " + timer.Elapsed.Milliseconds.ToString());
            //while (user.Status != CharacterStatus.Idle && user.Status != CharacterStatus.Crafting_Idle2 && user.IsCrafting && timer.Elapsed.Seconds < 7)
            //{
            //    user.Refresh();
            //}

            //Debug.Print("After2: " + user.Status.ToString() + " " + user.IsCrafting.ToString());
            user.Refresh();
            //Debug.Print("End: " + user.Status.ToString() + " " + user.IsCrafting.ToString());
            Thread.Sleep(300);
        }
示例#10
0
 public ScriptingObject(Character user, Character monster, Recast recast)
 {
     CurrentMonster = monster;
     CurrentUser = user;
     Cooldowns = recast;
     AttackStep = 0;
 }
示例#11
0
        public override void Fight(Character user, Character monster, Recast recast)
        {
            base.Fight(user, monster, recast);
            bool ignoreDOT = false;
            Hotkeys hotkeys = new Hotkeys();
            hotkeys.RefreshAbilities();

            if (hotkeys[STRAIGHTSHOT].InRange == 0)
                return;

            UIWindow ui = new UIWindow();
            ui.RefreshPointers();

            //  if (ui.GetActiveWindowName() == "chatlog")
            //      return;

            monster.Target();
            recast.Refresh(2.1);
            user.Refresh();

            if (user.ContainsStatusEffect2(451, (float) 3.5))
            {
                Debug.Print("Cursed Voice");
                SoundModule.PlayAsyncSound("cursedVoice.wav");

                while (user.ContainsStatusEffect(451, 0, false))
                {
                    Thread.Sleep(100);
                }

                Thread.Sleep(200);
                user.Refresh();
            }

            if (monster.Name.ToLower().Contains("renaud"))
                return;

            // Stop for turn 6 ability
            if (monster.UsingAbilityID == 1949)
            {
                //Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D6);
                return;
            }

            List<Character> nearMobs = monster.MonstersNear(100.0);

            // Blight Turn 6
            if (nearMobs.Any(mob => mob.UsingAbilityID == 1949))
            {
                //Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D6);
                return;
            }

            // Turn 7 Petrification
            if (nearMobs.Any(mob => mob.UsingAbilityID == 1979))
            {
                SoundModule.PlayAsyncSound("petrification.wav");
                //Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D6);
                return;
            }
            if (nearMobs.Any(mob => mob.UsingAbilityID == 1969))
            {
                SoundModule.PlayAsyncSound("petrification.wav");
                //Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D6);
                return;
            }

            if (user.ContainsStatusEffect(452, 0, false))
            {
                SoundModule.PlayAsyncSound("Shriek.wav");
            }

            //if (nearMobs.Any(mob => mob.UsingAbilityID == 1967))
            //{
            //    if (user.ContainsStatusEffect(452, 0, false))
            //    {
            //        SoundModule.PlayAsyncSound("Shriek.wav");
            //    }
            //    else
            //    {
            //        SoundModule.PlayAsyncSound("Shriek2.wav");
            //    }
            //}

            if (MemoryFunctions.GetGroundCursor() > 0)
                return;

            foreach (string mobToIgnore in _ignoreDOTMobs)
            {
                if (monster.Name.ToLower().Contains(mobToIgnore.ToLower()) &&
                    monster.Name.ToLower().Contains("gaoler") == false)
                {
                    ignoreDOT = true;
                }
            }

            if (MemoryFunctions.GetMapID() == 364 && monster.Name.Contains("Good King") == false)
                ignoreDOT = true;

            if (hotkeys[INTERNALRELEASE].PercentReady >= 99 &&
                user.Level >= 26 && Global.DisableBuffs == false && user.TP_Current >= 40 && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(INTERNALRELEASE, 21, MemoryFunctions.ActionType.Ability);
                hotkeys[INTERNALRELEASE].UseAbility();
            }
            else if (recast.WeaponSpecials.Count == 0)
            {
                if ((user.ContainsStatusEffect(130, 0, false, (float) 3.0) == false ||
                     user.ContainsStatusEffect(122, 0, false)) && user.Level >= 2 && user.TP_Current >= 70)
                {
                    //MemoryFunctions.ForceAction(STRAIGHTSHOT, 20, MemoryFunctions.ActionType.WS);
                    hotkeys[STRAIGHTSHOT].UseAbility();
                }
                else if (monster.ContainsStatusEffect(124, user.ID, true, (float) 2.5) == false &&
                         user.Level >= 6 && user.TP_Current >= 100 && ignoreDOT == false && monster.StatusEffects().Count < 29)
                {
                    //MemoryFunctions.ForceAction(VENOMOUSBITE, 20, MemoryFunctions.ActionType.WS);
                    hotkeys[VENOMOUSBITE].UseAbility();
                }
                else if (monster.ContainsStatusEffect(129, user.ID, true, (float) 2.5) == false &&
                         user.Level >= 30 && user.TP_Current >= 100 && monster.StatusEffects().Count < 29 &&
                         (ignoreDOT == false || monster.Name.ToLower().Contains("infernal nail")))
                {
                    //MemoryFunctions.ForceAction(WINDBITE, 20, MemoryFunctions.ActionType.WS);
                    hotkeys[WINDBITE].UseAbility();
                }
                else if (hotkeys[HAYMAKER].Highlighted && user.Level >= 10 && user.TP_Current >= 40)
                {
                    //MemoryFunctions.ForceAction(HAYMAKER, 20, MemoryFunctions.ActionType.WS);
                    hotkeys[HAYMAKER].UseAbility();
                }
                else if (user.TP_Current >= 60)
                {
                    //MemoryFunctions.ForceAction(HEAVYSHOT, 20, MemoryFunctions.ActionType.WS);
                    hotkeys[HEAVYSHOT].UseAbility();
                }
            }
            else if (hotkeys[INVIGORATE].PercentReady >= 100 && user.Level >= 4 &&
                     user.TP_Current <= 550 && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(INVIGORATE, 20, MemoryFunctions.ActionType.Ability);
                hotkeys[INVIGORATE].UseAbility();

            }
            else if (hotkeys[RAGINGSTRIKES].PercentReady >= 100 && user.Level >= 4 && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(RAGINGSTRIKES, 19, MemoryFunctions.ActionType.Ability);
                hotkeys[RAGINGSTRIKES].UseAbility();
            }
            else if (hotkeys[BLOODFORBLOOD].PercentReady >= 100 && user.Level >= 38 &&
                     monster.Name.Contains("Twintania") == false &&
                     monster.Name.Contains("Conflagration") == false && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78)
                // && user.ContainsStatusEffect(125, 0, false) == false
            {
                //MemoryFunctions.ForceAction(BLOODFORBLOOD, 20, MemoryFunctions.ActionType.Ability);
                hotkeys[BLOODFORBLOOD].UseAbility();
            }
            else if (
                hotkeys[BLOODFORBLOOD].PercentReady >= 100 && user.Level >= 38 && monster.Name.Contains("Twintania") &&
                monster.Health_Percent <= 55 && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78)
                // && user.ContainsStatusEffect(125, 0, false) == false
            {
                //MemoryFunctions.ForceAction(BLOODFORBLOOD, 20, MemoryFunctions.ActionType.Ability);
                hotkeys[BLOODFORBLOOD].UseAbility();
            }
            else if (hotkeys[HAWKSEYE].PercentReady >= 100 && user.Level >= 26 && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(HAWKSEYE, 15, MemoryFunctions.ActionType.Ability);
                hotkeys[HAWKSEYE].UseAbility();
            }
            else if (hotkeys[BARRAGE].PercentReady >= 100 &&
                     user.Level >= 38 && monster.Name.Contains("Twintania") == false &&
                     monster.Name.Contains("Conflagration") == false && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(BARRAGE, 12, MemoryFunctions.ActionType.Ability);
                hotkeys[BARRAGE].UseAbility();
            }
            else if (hotkeys[BARRAGE].PercentReady >= 100 &&
                     user.Level >= 38 && monster.Name.Contains("Twintania") &&
                     monster.Health_Percent <= 55 && Global.DisableBuffs == false && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(BARRAGE, 12, MemoryFunctions.ActionType.Ability);
                hotkeys[BARRAGE].UseAbility();
            }

            else if (hotkeys[BLOODLETTER].PercentReady >= 99 && user.Level >= 12 && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(BLOODLETTER, 16, MemoryFunctions.ActionType.Ability);
                hotkeys[BLOODLETTER].UseAbility();
            }
            else if (monster.Health_Percent <= 20 &&
                     hotkeys[MISERYSEND].PercentReady >= 99 && user.Level >= 8 && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(MISERYSEND, 16, MemoryFunctions.ActionType.Ability);
                hotkeys[MISERYSEND].UseAbility();
            }
            else if (
                hotkeys[BLUNTARROW].PercentReady >= 99 && user.Level >= 42 && Global.StunBotOpen == false && hotkeys[HEAVYSHOT].PercentReady <= 78)
            {
                //MemoryFunctions.ForceAction(BLUNTARROW, 16, MemoryFunctions.ActionType.Ability);
                hotkeys[BLUNTARROW].UseAbility();
            }
        }
示例#12
0
        private void DetectMonster()
        {
            Character closestMonster = null;
            List<int> aggroList = _aggrohelper.GetAggroList();

            // Check if we have aggro
            if (aggroList.Count > 0)
            {
                foreach(int aggroID in aggroList){
                    Character aggroMob = GetMonsterFromID(aggroID);
                    if(aggroMob == null)
                    {
                        Debug.Print("Null monster in aggro detection\n");
                        continue;
                    }
                    if (aggroMob.Health_Percent > 0)
                        closestMonster = aggroMob;
                }

            }

            // Make sure we do not have any aggro...
            if (closestMonster == null)
            {
                // Check if our Hp/Tp is OK
                if(CheckHealth())
                    return;

                // If our health is fine, check for the next closest montser.
                closestMonster = GetClosestMonster();

                // If there is no monster nearby, exit out and try again.
                if (closestMonster == null)
                    return;
            }

            //Debug.Print("Found Monster");
            // We have a valid monster, so stop navigating and enable Fight mode!
            _navigation.Stop();

            _currentmonster = closestMonster;

            _aiFighter.Reset();
            _botstage = BotStage.Fighting;

            // Start timer to see if we have run into a problem claiming the monster.
            _claimwatch = new Stopwatch();
            _claimwatch.Start();
        }
示例#13
0
        private void DrawPlayerIcon(DrawingContext drawingContext, Character player, Coordinate screenCoordinate)
        {
            switch (player.Job)
            {
                case JOB.ACN:
                case JOB.SCH:
                    drawingContext.DrawImage(_playerSch,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;
                case JOB.ARC:
                case JOB.BRD:
                    drawingContext.DrawImage(_playerBrd,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;
                case JOB.THM:
                case JOB.BLM:
                    drawingContext.DrawImage(_playerBlm,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;
                case JOB.LNC:
                case JOB.DRG:
                    drawingContext.DrawImage(_playerDrg,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;
                case JOB.WAR:
                case JOB.MRD:
                    drawingContext.DrawImage(_playerMrd,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;

                case JOB.PGL:
                case JOB.MNK:
                    drawingContext.DrawImage(_playerMnk,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;

                case JOB.GLD:
                case JOB.PLD:
                    drawingContext.DrawImage(_playerPld,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;

                case JOB.CNJ:
                case JOB.WHM:
                    drawingContext.DrawImage(_playerWhm,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;

                case JOB.SMN:
                    drawingContext.DrawImage(_playerSmn,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;
                default:
                    drawingContext.DrawImage(_playericon,
                        new Rect(new Point(screenCoordinate.X, screenCoordinate.Y),
                            new Size(16, 16)));
                    break;
            }
        }
示例#14
0
        private void btn_ShowTarget_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int targetID = MemoryFunctions.GetTarget();
                Character selected = new Character((uint)targetID, true);
                Character selectedtargetTarget = MemoryFunctions.GetCharacterFromID(selected.TargetID);
                selected.ContainsStatusEffect(1, 1, false, (float) 1.0);
                Debug.Print(selected.Name);
                Debug.Print("Address: " + selected.Address.ToString("X") + "   ID: " +
                                   selected.ID.ToString("X") + "   Dist: " +
                                   _user.DistanceFrom(selected));
                if (selectedtargetTarget != null)
                    Debug.Print("Targets Target: " + selectedtargetTarget.Name);

                foreach (StatusEffect statusEffect in selected.StatusEffects())
                {
                    Debug.Print("SE: " + statusEffect.ID + " From: " + statusEffect.RecievedFrom.ToString("X"));
                }
                Debug.Print(selected.UsingAbilityID.ToString());
                Debug.Print(selected.Owner.ToString());

                List<Gathering> gathering = new List<Gathering>();

                MemoryFunctions.GetGathering(gathering);
                foreach (Gathering gather in gathering)
                {
                    if (gather.Address == targetID)
                        Debug.Print("Target: " + gather.Address.ToString("X") + "   ID: " + gather.ID.ToString("X") + "   Dist: " + _user.Coordinate.Distance2D(gather.Coordinate));

                }
            }
            catch (Exception ex)
            {

            }
        }
示例#15
0
        private bool CheckTankHealth(Character tank, List<Character> deadTargets, Recast recast, List<Character> damagedTargets)
        {
            if (tank != null)
            {

                // Benediction Check
                if (chk_WHMMode.IsChecked == true)
                {

                    if (tank.Health_Percent <= 25 && _hotkeys[BENEDICTION].PercentReady == 100 && tank.Health_Current > 0)
                    {
                        tank.Target();
                        Thread.Sleep(100);

                        _hotkeys[BENEDICTION].UseAbility();

                        _spellCastTimer = new Stopwatch();
                        _spellCastTimer.Reset();
                        _spellCastTimer.Start();
                        _spellCast = true;
                        return true;
                    }

                    // Swiftcast Heal
                    if (tank.Health_Percent <= 35 && _hotkeys[SWIFTCAST].PercentReady == 100 && deadTargets.Count == 0)
                    {
                        _hotkeys[SWIFTCAST].UseAbility();
                    }
                }

                if (damagedTargets.Contains(tank) && tank.Health_Percent < 80)
                {
                    damagedTargets.Clear();
                    damagedTargets.Add(tank);

                    if (_user.Health_Percent < 30 && damagedTargets.Count < 3)
                    {
                        damagedTargets.Add(_user);
                    }
                }
            }

            return false;
        }
示例#16
0
            private void InitializeGatheringSpot(Character user, GatheringWindow uiWindow, Gathering currentSpot)
            {
                user.Refresh();
                Debug.Print("User Status: " + user.Status.ToString() + "  -  " + user.Status.ToString("X"));
                currentSpot.Target();
                Thread.Sleep(100);

                while (uiWindow.RefreshPointers() == false)
                {

                    user.Refresh();

                    user.Heading = user.Coordinate.AngleTo(currentSpot.Coordinate);

                    Utilities.Keyboard.KeyBoardHelper.KeyDown(Keys.W);

                    if (user.Coordinate.Distance2D(currentSpot.Coordinate) > DistanceThreshold)
                    {
                        user.Heading = user.Coordinate.AngleTo(currentSpot.Coordinate);

                        Utilities.Keyboard.KeyBoardHelper.KeyDown(Keys.W);
                        continue;
                    }

                    Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.W);

                    Thread.Sleep(350);
                    user.Refresh();
                    user.Heading = user.Coordinate.AngleTo(currentSpot.Coordinate);

                    Debug.Print("Waiting for window...");
                    Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad0);
                    Thread.Sleep(750);
                }
            }
示例#17
0
            private void GatherSpot(Character user, Gathering currentSpot)
            {
                currentSpot.Refresh();
                user.Refresh();

                if (user.Health_Current == 0)
                {
                    _botstage = BotStage.Nothing;
                    _navigation.Stop();
                    return;
                }

                if (user.Coordinate.Distance(currentSpot.Coordinate) < 0.5)
                {
                    user.Heading = user.Coordinate.AngleTo(currentSpot.Coordinate);

                    Utilities.Keyboard.KeyBoardHelper.KeyDown(Keys.S);
                    Thread.Sleep(150);
                    Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.S);
                }

                // We are close enough.. stop running
                //Utilities.Keyboard.KeyBoardHelper.KeyUp(Keys.W);

                if (currentSpot.IsHidden == false)
                {
                    Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.NumPad0);
                    Thread.Sleep(350);
                }
                else
                {
                    //_ignorelist.Clear();
                    _navigation.Resume();
                    _botstage = BotStage.Detection;
                }

                //// Check if we should ignore the monster because it has not been claimed for a while..
                //// This typically happens if monster is out of line of sight.
                //if (_claimwatch.Elapsed.Seconds > 7 && currentSpot.IsClaimed == false)
                //{
                //    _claimwatch.Stop();
                //    _ignorelist.Add(currentSpot.ID);

                //    _navigation.Resume();
                //    _botstage = BotStage.Detection;
                //}
            }
示例#18
0
            private static void WaitForAbility(Character user)
            {
                Thread.Sleep(700);
                user.Refresh();
                while (user.Status != CharacterStatus.Idle && user.Status != CharacterStatus.Crafting_Idle && user.Status != CharacterStatus.Crafting_Idle && user.IsCrafting == true)
                {
                    user.Refresh();
                }

                Thread.Sleep(700);
            }
示例#19
0
        public void Refresh()
        {
            // Fixed
            _id = MemoryHandler.Instance.GetInt32(Address + 0x74);
            _name = Textinfo.ToTitleCase(MemoryHandler.Instance.GetString(Address + 0x30, 32));

            // Check if the name doesnt look right.... went to far on npc list?
            if(_name.Trim().Length == 0)
            {
                _valid = false;
                return;
            }

            _coordinate = new Coordinate(
                       MemoryHandler.Instance.GetFloat(Address + 0xA0),
                       MemoryHandler.Instance.GetFloat(Address + 0xA8),
                       MemoryHandler.Instance.GetFloat(Address + 0xA4)
                  );

            _heading = MemoryHandler.Instance.GetFloat(Address + 0xB0);

            _type = MemoryHandler.Instance.GetByte(Address + 0x8A, false);

            _currenthealth = MemoryHandler.Instance.GetInt32(Address + 0x17E8);
            _maxhealth = MemoryHandler.Instance.GetInt32(Address + 0x17EC);
            if (_maxhealth == 0)
                _maxhealth = 1;

            _currentmp = MemoryHandler.Instance.GetInt32(Address + 0x17F0);
            _maxmp = MemoryHandler.Instance.GetInt32(Address + 0x17F4);
            _currenttp = MemoryHandler.Instance.GetInt16(Address + 0x17F8);
            _maxtp = 1000;

            _currentcp = MemoryHandler.Instance.GetInt16(Address + 0x17FE);
            _maxcp = MemoryHandler.Instance.GetInt16(Address + 0x1800);
            _craftbool = MemoryHandler.Instance.GetInt32(Address + 0x17A8); //?

            _currentGp = MemoryHandler.Instance.GetInt16(Address + 0x17FA);
            _maxgp = MemoryHandler.Instance.GetInt16(Address + 0x17FC);
            _level = MemoryHandler.Instance.GetByte(Address + 0x17E1, false);
            _job = MemoryHandler.Instance.GetByte(Address + 0x17E0, false);
            _icon = MemoryHandler.Instance.GetByte(Address + 0x18C, false);
            _status = MemoryHandler.Instance.GetByte(Address + 0x18E, false);
            _hidden = MemoryHandler.Instance.GetInt32(Address + 0x10C) != 0; //?

            _isMoving = MemoryHandler.Instance.GetByte(Address + 0x224, false) == 1;
            _owner = MemoryHandler.Instance.GetInt32(Address + 0x84);

            _distance = MemoryHandler.Instance.GetByte(Address + 0x8D, false);
            //UInt32 abilityAddress = MemoryHandler.Instance.GetUInt32(Address + 2300);

            _usingAbilityID = MemoryHandler.Instance.GetInt16(Address + 0x3334);
            _usingAbility = MemoryHandler.Instance.GetByte(Address + 0x7D4, false) == 1;
            _statusEffectsAddress = 0x3168;

            // Needs Work

            if (_isUser == false)
            {
                _target = MemoryHandler.Instance.GetInt32(Address + 0x1A8);
            } else
            {
                int targAddress = MemoryFunctions.GetTarget();
                if(targAddress == -1)
                {
                    _target = -1;
                } else
                {
                    _target = new Character((uint)targAddress, true).ID;
                }
            }

            _claimed = MemoryHandler.Instance.GetByte(Address + 0x1A0, false);

            _fate = MemoryHandler.Instance.GetUInt32(Address + 0xE4);

            if (_target == -536870912)
                _target = -1;
        }
示例#20
0
 private void GrabUser()
 {
     uint startAddress = MemoryLocations.Database["charmap"];
     _user = new Character(startAddress);
 }
示例#21
0
        private void DetectAssistMonsters()
        {
            Character closestMonster = null;
            List<Character> fate = new List<Character>();
            List<Character> players = new List<Character>();
            List<Character> monsters = new List<Character>();

            MemoryFunctions.GetCharacters(monsters, fate, players, ref _user);
            monsters.AddRange(fate);

            if (chk_PVPMode.IsChecked == true)
            {
                monsters.AddRange(players);
            }

            //Garuda Helper
            foreach (Character monster in monsters)
            {
                if (monster.Health_Percent > 0 && monster.Health_Percent <= 100 && monster.Name.ToLower() == "satin plume")
                {
                    monster.Target();
                    break;
                }
            }

            foreach (Character monster in monsters)
            {
                if (monster.Health_Percent > 0 && monster.Health_Percent <= 100 && monster.Name.ToLower() != "spiny plume" &&  _user.TargetID == monster.ID)
                {
                    closestMonster = monster;
                    break;
                }
            }

            // Make sure we do not have any aggro...
            if (closestMonster == null)
            {
                return;
            }

            _currentmonster = closestMonster;

            _aiFighter.Reset();
            _botstage = BotStage.Fighting;

            // Start timer to see if we have run into a problem claiming the monster.
            _claimwatch = new Stopwatch();
            _claimwatch.Start();
        }
示例#22
0
        public ePosition Position(Character person)
        {
            double angle = Coordinate.AngleTo(person.Coordinate) - Heading;

            angle = (angle * 57.2957795);
            if(angle < 0)
                angle += 360;

               // Debug.Print(angle.ToString());

            if(angle >= 125 && angle <= 230)
                return ePosition.Back;
            if ((angle < 125 && angle >= 60) || (angle > 230 && angle < 300))
                return ePosition.Side;

            return ePosition.Front;
        }
示例#23
0
        private void Stunner_Tick(object sender, EventArgs e)
        {
            Hotkeys hotkeys = new Hotkeys();
            hotkeys.RefreshAbilities();

            int targetID = MemoryFunctions.GetTarget();
            if(targetID == -1)
                return;

            Character selected = new Character((uint)targetID, true);

            if (selected.UsingAbilityID != 0)
                lbl_CurrAbility.Content = selected.UsingAbilityID.ToString("X");

            bool found = false;

            foreach (var item in lst_StunID.Items)
            {
                if (selected.UsingAbilityID.ToString("X").ToLower() == item.ToString().ToLower())
                {
                    found = true;
                    break;
                }
            }

            if(found)
            {
                if (hotkeys[109].PercentReady == 100)
                {
                    Global.PauseInput = true;
                    Utilities.Keyboard.KeyBoardHelper.Ctrl(Keys.D3);
                }

            } else
            {
                Global.PauseInput = false;
            }
        }
示例#24
0
        private static void WaitForCraft(Character user)
        {
            Thread.Sleep(700);
            user.Refresh();
            while (user.IsCrafting == false)
            {
                user.Refresh();
            }

            Thread.Sleep(700);
        }
示例#25
0
        public static void GetNPCs(List<Character> NPCs)
        {
            try
            {
                uint startAddress = MemoryLocations.Database["npcmap"];
                const uint length = 256;

                NPCs.Clear();

                for (uint i = 0; i <= length; i += 4)
                {
                    Character newChar = new Character(startAddress + i);

                    if (newChar.Valid)
                        NPCs.Add(newChar);
                }

            } catch(Exception ex)
            {
                System.Diagnostics.Debug.Print("Problem getting NPCs");
            }
        }
示例#26
0
        public static void GetCharacters(List<Character> monsters, List<Character> fate, List<Character> players, ref Character user)
        {
            uint startAddress = MemoryLocations.Database["charmap"];
            const uint length = 396;

            players.Clear();
            monsters.Clear();
            fate.Clear();

            for (uint i = 0; i <= length; i += 4)
            {
                Character newChar = new Character(startAddress + i);

                if (i == 0)
                {
                    user = newChar;
                    user.IsUser = true;
                }

                if (newChar.Valid)
                {
                    if (newChar.Type == Datatypes.CharacterType.PC)
                        players.Add(newChar);
                    else
                    {
                        if(newChar.IsFate)
                            fate.Add(newChar);
                        else
                            monsters.Add(newChar);
                    }

                }

            }
        }
示例#27
0
        public override void Fight(Character user, Character monster, Recast recast)
        {
            base.Fight(user, monster, recast);

            //byte distance = monster.Distance;
            monster.Target();
            recast.Refresh(2.0);
            user.Refresh();

            ePosition position = monster.Position(user);

            Hotkeys hotkeys = new Hotkeys();
            Hotkeys.Hotkey highlightedAbility = null;

            hotkeys.RefreshAbilities();

            if (hotkeys.Abilities[92].InRange == 0)
                return;

            foreach (KeyValuePair<short, Hotkeys.Hotkey> hk in hotkeys.Abilities)
            {
                if (hk.Value.Highlighted && hk.Value.ID != 89)
                {
                    highlightedAbility = hk.Value;
                }
            }

            if (recast.Abilities.Contains(2) == false && user.TP_Current < 450)
            {
                hotkeys.Abilities[80].UseAbility(); // Invigorate
            } else if (recast.WeaponSpecials.Count == 0 && hotkeys.Abilities[75].InRange == 1)
            {

                //if (distance > 7)
                //{
                //    hotkeys.Abilities[90].UseAbility(); // Piercing Talon
                //} else
                if (highlightedAbility != null)
                {
                    if (highlightedAbility.ID == 84 && recast.Abilities.Contains(4) == false)
                    {
                        hotkeys.Abilities[83].UseAbility(); // Life Surge for Full Thrust
                    }
                    else
                    {
                        highlightedAbility.UseAbility();
                    }

                }
                else if (user.ContainsStatusEffect(115, 0, false) == false && position == ePosition.Side)
                    //Heavy Thrust Dmg Buff From Side
                {
                    hotkeys.Abilities[79].UseAbility();
                }
                else if (monster.ContainsStatusEffect(119, user.ID, true) == false) //Phlebotomize DOT
                {
                    hotkeys.Abilities[91].UseAbility();
                }
                else if (position == ePosition.Back && monster.ContainsStatusEffect(121, user.ID, true) == false)
                {
                    hotkeys.Abilities[81].UseAbility(); // Start Impulse Drive Combo
                }
                else
                {
                    hotkeys.Abilities[75].UseAbility(); // Start True Thrust Combo
                }

            }
            else
            {

                if ((recast.Abilities.Contains(5) == false || recast.SubAbilities.Contains(59) == false) && hotkeys.Abilities[75].InRange == 1)
                    // Blood for Blood or Internal Release
                {
                    Utilities.Keyboard.KeyBoardHelper.KeyPress(Keys.D0);
                }

                if (monster.Name.Contains("Titan") == false)
                {
                    if (recast.Abilities.Contains(7) == false && recast.Abilities.Contains(10) == false)
                    {
                        hotkeys.Abilities[93].UseAbility(); // Power Surge
                    }
                    else if (recast.Abilities.Contains(10) == false)
                    {
                        hotkeys.Abilities[96].UseAbility(); // Dragonfire Dive
                    }
                    else if (recast.Abilities.Contains(6) == false)
                    {
                        hotkeys.Abilities[92].UseAbility(); // Jump
                    }
                    else if (recast.Abilities.Contains(9) == false)
                    {
                        hotkeys.Abilities[95].UseAbility(); // Spineshatter drive
                    }
                }
            }
        }
示例#28
0
 public float DistanceFrom(Character otherChar)
 {
     //Refresh()
     return Calculations.PointDistance(Coordinate, otherChar.Coordinate);
 }