Xian55 / WowClassicGrindBot

Highly configurable and responsive World of Warcraft Classic pixel Grind Bot - No DLL injection or memory tampering, just screen capture and input simulation.
179 stars 123 forks source link

Pet based class, fighting with multiple enemy stuck on dead target #451

Closed Phatlynx closed 1 year ago

Phatlynx commented 1 year ago

Description

Sometimes I run into the issue of being in combat with 2 or more mobs, 1st mob will be killed while the other(s) is being tanked by Voidwalker. After the first mob is dead, I'll sit there targeting the corpse and switch target only after Voidwalker dies. If I manually click anywhere on the screen to "clear target", script will continue working.

I'm sure there has to be a way to prevent this from happening so targeting can work properly so I want to try ClearTargetKey but not sure how to implement it.

Addon Version

Current Verison

World of Warcraft Client

Wrath of the Lich King Classic

Reproduction Steps

N/A

Last Good Version

No response

Screenshots

No response

Logs

No response

Xian55 commented 1 year ago

Hello there 👋

Please upload the related log files.

The related log files can be found the following locations

example file format: out20221111.log

Phatlynx commented 1 year ago

This is where I die towards the end of the log. Voidwalker is dead, I'm targeting corpse, and mob attacks me till I die while still targeting mob corpse.

Xian55 commented 1 year ago

Will do some tests, when Beta or PTR is back online.

Phatlynx commented 1 year ago

Here is my class config and below that is my recorded path in Stormpeaks.

{
  "ClassName": "Warlock",
  "Loot": true,
  "NPCMaxLevels_Below": 5,
  "NPCMaxLevels_Above": 4,
  "UseMount": true,
  "MountKey": "N0",
  "PathFilename": "_pack\\60-70\\Nagrand\\65-70 Oshugun.json",
  "PathThereAndBack": true,
  "PathReduceSteps": true,
  "Blacklist": [
    "Murloc Hunter",
    "Murloc Oracle",
    "Murloc Tidehunter"
  ],
  "IntVariables": {
    "Item_Soul_Shard": 6265,
    "Item_Healthstone": 22103,
    "DOT_MIN_HEALTH%": 35
  },
  "Pull": {
    "Sequence": [
      {
        "Name": "Approach",
        "Requirements": [
          "Has Pet",
          "MinRange > 15",
          "Mana%>40"
        ]
      },
      {
        "Name": "Haunt",
        "Key": "4",
        "HasCastBar": true,
        "ResetOnNewTarget": true,
        "Cooldown": 3000
      }
    ]
  },
  "Combat": {
    "Sequence": [
      {
        "Name": "heal",
        "Key": "N1",
        "Requirements": [
          "Health% < 35",
          "BagItem:Item_Healthstone"
        ],
        "Cooldown": 120000,
        "InCombat": "true"
      },
      {
        "Name": "Shadow Bolt",
        "Key": "5",
        "Requirements": [
          "Talent:Nightfall",
          "Shadow Trance"
        ]
      },
      {
        "Name": "Drain Soul",
        "Key": "9",
        "HasCastBar": true,
        "Requirements": [
          "TargetHealth% < 25",
          "!BagItem:Item_Soul_Shard:5",
          "TargetYieldXP"
        ]
      },
      {
        "Name": "Drain Life",
        "Key": "N3",
        "HasCastBar": true,
        "Requirements": [
          "Health% < 70",
          "Mana% > 5"
        ]
      },
      {
        "Name": "Void Walker: Sacrifice",
        "Key": "N6",
        "Requirements": [
          "Health% < 20"
        ]
      },
      {
        "Name": "Health Funnel",
        "Key": "N5",
        "HasCastBar": true,
        "WhenUsable": true,
        "Requirements": [
          "Has Pet",
          "Health% > 70",
          "PetHealth% < 40"
        ]
      },
      {
        "Name": "Curse of Agony",
        "Key": "1",
        "ResetOnNewTarget": true,
        "Requirements": [
          "TargetHealth% > DOT_MIN_HEALTH%",
          "!Curse of Agony"
        ]
      },
      {
        "Name": "Corruption",
        "Key": "2",
        "Requirements": [
          "TargetHealth% > DOT_MIN_HEALTH%",
          "!Corruption"
        ],
        "ResetOnNewTarget": true
      },
      {
        "Name": "Haunt",
        "Key": "3",
        "HasCastBar": true,
        "ResetOnNewTarget": true,
        "Requirements": [
          "TargetHealth% > DOT_MIN_HEALTH%",
          "!TargetsMe"
        ],
        "Cooldown": 12000
      },
      {
        "Name": "Life Tap",
        "Key": "8",
        "Charge": 2,
        "Requirements": [
          "Health% > 60",
          "Mana% < 40"
        ]
      },
      {
        "Name": "Shoot",
        "Key": "0",
        "Item": true,
        "Requirements": [
          "HasRangedWeapon",
          "!Shooting",
          "!Casting",
          "SpellInRange:1"
        ]
      },
      {
        "Name": "AutoAttack",
        "Requirements": [
          "!HasRangedWeapon",
          "!AutoAttacking"
        ]
      }
    ]
  },
  "Parallel": {
    "Sequence": [
      {
        "Name": "Food",
        "Key": "-",
        "Requirement": "Health% < 50"
      },
      {
        "Name": "Drink",
        "Key": "=",
        "Requirement": "Mana% < 40"
      }
    ]
  },
  "Wait": {
    "Sequence": [
          {
        "Cost": 19,
        "Name": "Mana regen",
        "Requirements": [
            "DrinkCount == 0 || !Usable:Drink",
            "Mana%<30"
        ]
    },
    {
      "Cost": 19,
      "Name": "Hp regen",
      "Requirements": [
          "FoodCount == 0 || !Usable:Food",
          "Health%<50"
      ]
    }
    ]
  },

  "Adhoc": {
    "Sequence": [
      {
        "Name": "Fel Armor",
        "Key": "7",
        "Requirement": "!Fel Armor"
      },
      {
        "Name": "Summon Voidwalker",
        "Key": "6",
        "HasCastBar": true,
        "Requirements": [
          "BagItem:Item_Soul_Shard",
          "!Has Pet",
          "!Mounted"
        ],
        "AfterCastWaitCastbar": true
      },
      {
        "Name": "Consume Shadows",
        "Key": "N8",
        "Cooldown": 15000,
        "Requirements": [
          "Has Pet",
          "PetHealth% < 65"
        ]
      },
      {
        "Name": "Life Tap",
        "Key": "8",
        "Charge": 2,
        "Requirements": [
          "Health% > 60",
          "Mana% < 40"
        ]
      },
      {
        "Name": "Healthstone",
        "Key": "N2",
        "HasCastBar": true,
        "Requirements": [
          "BagItem:Item_Soul_Shard",
          "!BagItem:Item_Healthstone",
          "!BagFull"
        ],
        "AfterCastWaitCastbar": true,
        "AfterCastWaitBag": true
      }

    ]
  },
  "NPC": {
    "Sequence": [

    ]
  }
}

[{"X":38.2638,"Y":83.0385,"Z":0.0},{"X":38.2164,"Y":82.3994,"Z":0.0},{"X":38.0341,"Y":81.7529,"Z":0.0},{"X":37.3985,"Y":81.6948,"Z":0.0},{"X":37.3239,"Y":82.3501,"Z":0.0},{"X":37.1276,"Y":82.9956,"Z":0.0},{"X":36.5426,"Y":83.2642,"Z":0.0},{"X":35.9469,"Y":83.1141,"Z":0.0},{"X":35.3331,"Y":82.9597,"Z":0.0},{"X":34.9182,"Y":83.4264,"Z":0.0},{"X":34.5689,"Y":83.9404,"Z":0.0},{"X":34.9936,"Y":84.3888,"Z":0.0},{"X":35.573498,"Y":84.087204,"Z":0.0},{"X":36.077198,"Y":83.738495,"Z":0.0},{"X":36.6618,"Y":83.5706,"Z":0.0},{"X":37.3023,"Y":83.456696,"Z":0.0},{"X":37.8504,"Y":83.1536,"Z":0.0},{"X":38.4776,"Y":83.0076,"Z":0.0}]

Xian55 commented 1 year ago

When is "ClearTargetKey: Insert" being called, do I have to put it in my class config, if so where?

No, that's the default settings if you take a peek at the log file it is clearly there, these are the keybinds what are used:

2022-11-11 08:37:22.232 -06:00 [INF] [Jump] Uses "Spacebar" -> Spacebar - Slot: 0
2022-11-11 08:37:22.240 -06:00 [INF] [TargetLastTarget] Uses "G" -> G - Slot: 0
2022-11-11 08:37:22.242 -06:00 [INF] [StandUp] Uses "X" -> X - Slot: 0
2022-11-11 08:37:22.244 -06:00 [INF] [ClearTarget] Uses "Insert" -> Insert - Slot: 0
2022-11-11 08:37:22.247 -06:00 [INF] [StopAttack] Uses "Delete" -> Delete - Slot: 0
2022-11-11 08:37:22.249 -06:00 [INF] [TargetNearestTarget] Uses "Tab" -> Tab - Slot: 0
2022-11-11 08:37:22.254 -06:00 [INF] [TargetPet] Uses "Multiply" -> Multiply - Slot: 0
2022-11-11 08:37:22.256 -06:00 [INF] [TargetTargetOfTarget] Uses "F" -> F - Slot: 0
2022-11-11 08:37:22.259 -06:00 [INF] [TargetFocus] Uses "PageUp" -> PageUp - Slot: 0
2022-11-11 08:37:22.261 -06:00 [INF] [FollowTarget] Uses "PageDown" -> PageDown - Slot: 0
2022-11-11 08:37:22.263 -06:00 [INF] [PetAttack] Uses "Subtract" -> Subtract - Slot: 0
2022-11-11 08:37:22.265 -06:00 [INF] [Mount] Uses "N0" -> NumPad0 - Slot: 58
2022-11-11 08:37:22.266 -06:00 [INF] [Mount] Actionbar Form key map: Key:N0 -> Actionbar:58 -> Index:57
2022-11-11 08:37:22.270 -06:00 [INF] [Hearthstone] Uses "I" -> I - Slot: 0
2022-11-11 08:37:22.272 -06:00 [INF] [Interact] Uses "I" -> I - Slot: 0
2022-11-11 08:37:22.275 -06:00 [INF] [InteractMouseOver] Uses "J" -> J - Slot: 0
2022-11-11 08:37:22.277 -06:00 [INF] [Approach] Uses "I" -> I - Slot: 0
2022-11-11 08:37:22.279 -06:00 [INF] [AutoAttack] Uses "I" -> I - Slot: 0

For pet based combat it is mandatory to set the following keys:


However in your case the TargetPetTargetGoal dosen't work at all. Most likely because you stuck at the dead target.

Its a bug at my end, which requires my attention.

Xian55 commented 1 year ago

As of this current moment, i have no way to test this, in theory this should prevent stucking on dead target, when your pet is fighting with multiple targets.

diff --git a/Core/Goals/TargetPetTargetGoal.cs b/Core/Goals/TargetPetTargetGoal.cs
index 65b8d49c..ffd7cd5a 100644
--- a/Core/Goals/TargetPetTargetGoal.cs
+++ b/Core/Goals/TargetPetTargetGoal.cs
@@ -17,7 +17,7 @@ namespace Core.Goals
             this.playerReader = playerReader;
             this.wait = wait;

-            AddPrecondition(GoapKey.hastarget, false);
+            AddPrecondition(GoapKey.targetisalive, false);

             if (input.ClassConfig.KeyboardOnly)
             {
Phatlynx commented 1 year ago

However in your case the TargetPetTargetGoal dosen't work at all. Most likely because you stuck at the dead target.

Its a bug at my end, which requires my attention.

It does sometimes work though, so there has to be a sequence or combat issue. I've been looking at how the bot works, when the issue occurs [targeting corpse, voidwalker still in combat with second target], these are the boolean values, hope these can also help. Maybe a simple solution would be to set a simple /cleartarget as it fixes the targetting when I manually click offscreen to clear target and it is able to reacquire the second pet target.

image

Xian55 commented 1 year ago

In my previous message i posted a possible fix, for this situation.

It is a diff file, you can apply with git command or do it manually.

image

Xian55 commented 1 year ago

Maybe a simple solution would be to set a simple /cleartarget as it fixes the targetting when I manually click offscreen to clear target and it is able to reacquire the second pet target.

That only means, you clearing the target manually, since the Esc -> Interface -> Controls -> Sticky Target options is disabled at your side.

Phatlynx commented 1 year ago

Would I have to rebuild the entire tool after making that 1 line change?

Xian55 commented 1 year ago

Yes, you have to rebuild the Core and BlazorServer projects.

Let me know, what's your experience with the given change 🙇

Phatlynx commented 1 year ago

So after almost a 24 hour test. It's working properly now. Appreciate the fix!

Xian55 commented 1 year ago

Thanks for the feedback, i will make it an actual fix :)