Xian55/WowClassicGrindBot

[Actionbar] Index was outside the bounds of the array

Phatlynx opened this issue ยท 25 comments

Description

Hello, I've rebuild the build several times and this error keeps coming up.

Unhandled exception. System.IndexOutOfRangeException: Index was outside the bounds of the array.





### Addon Version

Current Verison

### World of Warcraft Client

Wrath of the Lich King Classic

### Reproduction Steps

N/A

### Last Good Version

N/A

### Screenshots





### Logs

[out20230117_003.log](https://github.com/Xian55/WowClassicGrindBot/files/10439429/out20230117_003.log)

Here's the class config

  "ClassName": "Druid",
  "Loot": true,
  "PathFilename": "_pack\\40-50\\Tanaris\\49-51 DewGland Critters.json",
  "PathReduceSteps": true,
  "PathThereAndBack": false,
  "NPCMaxLevels_Below": 5,
  "NPCMaxLevels_Above": 4,
  "CheckTargetGivesExp": true,
  "Blacklist": [],
  "IntVariables": {
    "MIN_TARGET_HP_DOT%": 20
  },
  "Form": [
    {
      "Name": "cancelform",
      "Key": "F11",
      "Form": "None"
    },
    {
      "Name": "Bear Form",
      "Key": "-",
      "Form": "Druid_Bear"
    },
    {
      "Name": "Cat form",
      "Key": "=",
      "Form": "Druid_Cat"
    },
    {
      "Name": "Travel form",
      "Key": "0",
      "Form": "Druid_Travel"
    }
  ],
  "Pull": {
    "Sequence": [
      {
        "Name": "Cat Form",
        "Key": "=",
        "Requirements": [
          "SpellInRange:0",
          "!Form:Druid_Cat"
        ]
      },
      {
        "Name": "Faerie Fire (Feral)",
        "Key": "F10",
        "AfterCastAuraExpected": true,
        "Requirements": [
          "Form:Druid_Cat || Form:Druid_Bear",
          "!Faerie Fire"
        ]
      }
    ]
  },
  "Combat": {
    "Sequence": [
      {
        "Name": "Rejuvenation",
        "Key": "7",
        "Form": "None",
        "BeforeCastStop": true,
        "AfterCastWaitBuff": true,
        "Requirements": [
          "Health% < 51",
          "Mana% > 31",
          "!Rejuvenation"
        ]
      },
      {
        "Name": "Tiger's Fury",
        "Key": "N8",
        "WhenUsable": true,
        "Requirements": [
          "Form:Druid_Cat",
          "!TigersFury",
          "Rip",
          "Rake",
          "InMeleeRange",
          "TargetHealth% > MIN_TARGET_HP_DOT%"
        ],
        "Form": "Druid_Cat"
      },
      {
        "Name": "Rip",
        "Key": "N6",
        "WhenUsable": true,
        "Requirements": [
          "MobCount < 2",
          "SpellInRange:2",
          "!Rip",
          "Combo Point > 0",
          "Form:Druid_Cat",
          "TargetHealth% > MIN_TARGET_HP_DOT%"
        ],
        "Form": "Druid_Cat"
      },
      {
        "Name": "Rake",
        "Key": "N7",
        "WhenUsable": true,
        "Requirements": [
          "SpellInRange:2",
          "!Rake",
          "MobCount < 2",
          "Form:Druid_Cat",
          "TargetHealth% > MIN_TARGET_HP_DOT%"
        ],
        "Form": "Druid_Cat"
      },
      {
        "Name": "Ferocious Bite",
        "Key": "N4",
        "WhenUsable": true,
        "Requirements": [
          "SpellInRange:2",
          "MobCount < 2",
          "Form:Druid_Cat",
          "TargetHealth% <= MIN_TARGET_HP_DOT%"
        ],
        "Form": "Druid_Cat"
      },
      {
        "Name": "Claw",
        "Key": "N2",
        "WhenUsable": true,
        "Requirements": [
          "SpellInRange:2",
          "MobCount < 2",
          "Form:Druid_Cat"
        ],
        "Form": "Druid_Cat"
      },
      {
        "Name": "Bear Form",
        "Key": "-",
        "Requirements": [
          "!Form:Druid_Bear",
          "MobCount > 1",
          "Mana% > 30"
        ]
      },
      {
        "Name": "Bash",
        "Key": "F8",
        "WhenUsable": true,
        "Requirements": [
          "SpellInRange:1",
          "(TargetCastingSpell && !TargetCastingSpell:3131) || Health% < 33"
        ],
        "Form": "Druid_Bear"
      },
      {
        "Name": "Enrage",
        "Key": "F6",
        "WhenUsable": true,
        "Requirement": "Form:Druid_Bear",
        "Form": "Druid_Bear"
      },
      {
        "Name": "Demoralizing Roar",
        "Key": "F5",
        "WhenUsable": true,
        "Requirements": [
          "InMeleeRange",
          "!Demoralizing Roar",
          "MobCount > 1",
          "Form:Druid_Bear"
        ],
        "Form": "Druid_Bear"
      },
      {
        "Name": "Swipe",
        "Key": "F4",
        "WhenUsable": true,
        "Requirements": [
          "InMeleeRange",
          "MobCount > 1",
          "Form:Druid_Bear"
        ],
        "Form": "Druid_Bear"
      },
      {
        "Name": "Maul",
        "Key": "F3",
        "Requirements": [
          "InMeleeRange",
          "MobCount < 3",
          "LastMainHandMs > 2100",
          "Form:Druid_Bear"
        ],
        "AfterCastWaitSwing": true,
        "Form": "Druid_Bear"
      },
      {
        "Name": "Cat Form",
        "Key": "=",
        "Requirements": [
          "!Form:Druid_Cat",
          "Health% > 50",
          "MobCount < 2"
        ]
      },
      {
        "Name": "AutoAttack",
        "Requirements": [
          "!AutoAttacking"
        ]
      },
      {
        "Name": "Approach",
        "Log": false
      }
    ]
  },
  "Adhoc": {
    "Sequence": [
      {
        "Name": "Mark of the Wild",
        "Key": "1",
        "Requirement": "!Mark of the Wild",
        "Form": "None"
      },
      {
        "Name": "Thorns",
        "Key": "9",
        "Requirement": "!Thorns",
        "Form": "None"
      },
      {
        "Name": "Regrowth",
        "Key": "8",
        "Form": "None",
        "HasCastBar": true,
        "WhenUsable": true,
        "AfterCastWaitBuff": true,
        "Requirements": [
          "Health% < 50",
          "Mana% > 31",
          "!Regrowth"
        ]
      },
      {
        "Name": "Rejuvenation",
        "Key": "7",
        "Form": "None",
        "BeforeCastStop": true,
        "AfterCastWaitBuff": true,
        "Requirements": [
          "Health% < 75",
          "Mana% > 31",
          "!Rejuvenation"
        ]
      },
      {
        "Name": "Innervate",
        "Key": "6",
        "Requirement": "Mana% < 21"
      }
    ]
  },
  "Parallel": {
    "Sequence": [
      {
        "Name": "Food",
        "Key": "2",
        "Requirement": "Health% < 40",
        "Form": "None"
      },
      {
        "Name": "Drink",
        "Key": "3",
        "Requirement": "Mana% < 40",
        "Form": "None"
      }
    ]
  },
  "Wait": {
    "Sequence": [
      {
        "Cost": 19,
        "Name": "Mana regen",
        "Requirements": [
          "DrinkCount == 0 || !Usable:Drink",
          "Mana%<20"
        ]
      }
    ]
  }
}
Xian55 commented

Hello there.

Based on the provided logs i can see, everything seems to be fine at first glance.

To avoid these kinds of issues there's a guard in the IAddonDataProvider specifically in AddonDataProviderGDI where it checks the very first and last pixels to nothing obstruct the screen at that region.

The optimal region looks like this:
image

However there could be a case where a small window could partially cover the area:
image
In this case an exception is thrown what you just sent, it can happen for sure.

One way reduce the risk of this exception is, to add more of these guard cells to prevent reading invalid / partial pixel data.


Have you experienced the exception multiple times?

Xian55 commented

Alright, i can take a look in depth.

Until then, i could recommend to delete the frame_config.json and regenerate it.

Xian55 commented

I've manged to create 70lvl character on the PTR and load your profile.

Beware of putting shapeshifting ability into the main actionbar as it changes when you shapeshift. In order to use Bear form first have to put the (Dire Bear Form / Bear Form) spell into the Cat form actionbar as well.

On the other hand i had to manually put Swipe (Bear) into the actionbar as Sync Actionbar failed to do so.

Did a 10min run works like a charm. No obvious error ๐Ÿ˜ž

Xian55 commented

Have you tried to recreate the frame_config.json ?

By manually deleting both the frame_config.json files right? And then restarting the frame configuration. If so, yes I have done so.

Xian55 commented

Yes you can delete it manually, and the next time you start BlazorServer you will be greeted with the configuration page

Yea, it didn't work. There has to be something I'm doing wrong. Let me list my steps:

  1. git clone https://github.com/Xian55/WowClassicGrindBot.git
  2. copy the MPQ files to C:/WoWClassicGrindBot/json/MPQ, my personal json class files and path files to C:/WoWClassicGrindBot/json
  3. open powershell in C:/WoWClassicGrindBot and enter: dotnet build
  4. click on run.bat
  5. setup frame configuration manually, auto has never worked for me
  6. init -> load profile -> sync actionbar -> start bot
  7. results in crash and errors from previous comments

I just tried this on a fresh PTR client that I just downloaded thinking it could be a client issue, resulting in the same errors, but this time, I didn't even get to load my class config file, I clicked on init and this came up.

   at Core.ActionBarCostReader.Read(IAddonDataProvider reader) in C:\Users\Kevin\Desktop\WoW\WowClassicGrindBot\Core\Actionbar\ActionBarCostReader.cs:line 61
   at Core.AddonReader.Update() in C:\Users\Kevin\Desktop\WoW\WowClassicGrindBot\Core\Addon\AddonReader.cs:line 117
   at Core.BotController.AddonThread() in C:\Users\Kevin\Desktop\WoW\WowClassicGrindBot\Core\BotController.cs:line 139
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

I've also tried using the default class config files provided: Druid_32_cat_bear.json without changing anything, also resulting in the same error after 15 seconds of bot running.

I think it's safe to say it's not a class config file issue.

Xian55 commented

I tested PTR few days back it worked fine. However there was patch today so there could be some changes. Going to look at it soon.

Xian55 commented

On the other hand please check you don't have installed the addon twice by accident

Xian55 commented

Please type in chat /console scriptErrors 1 to show any possible lua error showing up.

Just checked PTR, the addon seems fine, there are no immediate errors

Xian55 commented

So to recovery from this situation i recommend to do the following.

Navigate to your World of Warcraft install folder select _classic_ and delete the addon manually.

Then delete the following files next to the BlazorServer executable

  • addon_config.json
  • frame_config.json

At this point you have to reinstall the addon, and i suggest to increase the cell size from 1 to 3. Guide here and finally do a frame config.

In Theory the Auto button should work.

Xian55 commented

The V in chat seems to me that, the CTRL key down event doesn't detected. So Ctrl+V sequence fails.

Similar thing happened to me when i tried to run the game in Administrator mode, in that case the the BlazorServer doesn't have the permission to send keystrokes to the game process.


These two are definitely doesn't look good.

DataFrameMeta: hash: 3880767 | spacing: 0 | size: 38 | rows: 80 | frames: 767
DataFrameMeta: hash: 14606822 | spacing: 1 | size: 46 | rows: 6 | frames: 822

The V in chat seems to me that, the CTRL key down event doesn't detected.

Similar thing happened to me when i tried to run the game in Administrator mode, in that case the the BlazorServer doesn't have the permission to send keystrokes to the game process.

Ohhh I think I know what the issue is then for this one, I virtually swapped my control and capslock key on my keyboard similar to the HHKB keyboard layout. Let me try again by turning it off.

Xian55 commented

There was a patch today which were reseted my graphics settings. Maybe the glow post process effect got re enabled. Be sure to disable that.

You can check the interpreted values at the blazorserver theres a left side option for "raw values" take a look at the values to see if theres some strange value changes

Xian55 commented

Do you have the "cancelform" macro assigned to the actionbar?

Do you have the "cancelform" macro assigned to the actionbar?

F11 - /cancelform
image

Xian55 commented

Can you upload the frame_config.json file?

{"Version":3,"addonVersion":"1.7.33","rect":"0, 0, 1920, 1080","meta":{"hash":10101100,"spacing":1,"size":1,"rows":1,"frames":100},"frames":[{"Index":0,"X":0,"Y":0},{"Index":1,"X":3,"Y":0},{"Index":2,"X":5,"Y":0},{"Index":3,"X":8,"Y":0},{"Index":4,"X":10,"Y":0},{"Index":5,"X":13,"Y":0},{"Index":6,"X":15,"Y":0},{"Index":7,"X":18,"Y":0},{"Index":8,"X":20,"Y":0},{"Index":9,"X":23,"Y":0},{"Index":10,"X":25,"Y":0},{"Index":11,"X":28,"Y":0},{"Index":12,"X":30,"Y":0},{"Index":13,"X":33,"Y":0},{"Index":14,"X":35,"Y":0},{"Index":15,"X":38,"Y":0},{"Index":16,"X":41,"Y":0},{"Index":17,"X":43,"Y":0},{"Index":18,"X":46,"Y":0},{"Index":19,"X":48,"Y":0},{"Index":20,"X":51,"Y":0},{"Index":21,"X":53,"Y":0},{"Index":22,"X":56,"Y":0},{"Index":23,"X":58,"Y":0},{"Index":24,"X":61,"Y":0},{"Index":25,"X":63,"Y":0},{"Index":26,"X":66,"Y":0},{"Index":27,"X":68,"Y":0},{"Index":28,"X":71,"Y":0},{"Index":29,"X":73,"Y":0},{"Index":30,"X":76,"Y":0},{"Index":31,"X":78,"Y":0},{"Index":32,"X":81,"Y":0},{"Index":33,"X":84,"Y":0},{"Index":34,"X":86,"Y":0},{"Index":35,"X":89,"Y":0},{"Index":36,"X":91,"Y":0},{"Index":37,"X":94,"Y":0},{"Index":38,"X":96,"Y":0},{"Index":39,"X":99,"Y":0},{"Index":40,"X":101,"Y":0},{"Index":41,"X":104,"Y":0},{"Index":42,"X":106,"Y":0},{"Index":43,"X":109,"Y":0},{"Index":44,"X":111,"Y":0},{"Index":45,"X":114,"Y":0},{"Index":46,"X":116,"Y":0},{"Index":47,"X":119,"Y":0},{"Index":48,"X":122,"Y":0},{"Index":49,"X":124,"Y":0},{"Index":50,"X":127,"Y":0},{"Index":51,"X":129,"Y":0},{"Index":52,"X":132,"Y":0},{"Index":53,"X":134,"Y":0},{"Index":54,"X":137,"Y":0},{"Index":55,"X":139,"Y":0},{"Index":56,"X":142,"Y":0},{"Index":57,"X":144,"Y":0},{"Index":58,"X":147,"Y":0},{"Index":59,"X":149,"Y":0},{"Index":60,"X":152,"Y":0},{"Index":61,"X":154,"Y":0},{"Index":62,"X":157,"Y":0},{"Index":63,"X":159,"Y":0},{"Index":64,"X":162,"Y":0},{"Index":65,"X":165,"Y":0},{"Index":66,"X":167,"Y":0},{"Index":67,"X":170,"Y":0},{"Index":68,"X":172,"Y":0},{"Index":69,"X":175,"Y":0},{"Index":70,"X":177,"Y":0},{"Index":71,"X":180,"Y":0},{"Index":72,"X":182,"Y":0},{"Index":73,"X":185,"Y":0},{"Index":74,"X":187,"Y":0},{"Index":75,"X":190,"Y":0},{"Index":76,"X":192,"Y":0},{"Index":77,"X":195,"Y":0},{"Index":78,"X":197,"Y":0},{"Index":79,"X":200,"Y":0},{"Index":80,"X":203,"Y":0},{"Index":81,"X":205,"Y":0},{"Index":82,"X":208,"Y":0},{"Index":83,"X":210,"Y":0},{"Index":84,"X":213,"Y":0},{"Index":85,"X":215,"Y":0},{"Index":86,"X":218,"Y":0},{"Index":87,"X":220,"Y":0},{"Index":88,"X":223,"Y":0},{"Index":89,"X":225,"Y":0},{"Index":90,"X":228,"Y":0},{"Index":91,"X":230,"Y":0},{"Index":92,"X":233,"Y":0},{"Index":93,"X":235,"Y":0},{"Index":94,"X":238,"Y":0},{"Index":95,"X":240,"Y":0},{"Index":96,"X":243,"Y":0},{"Index":97,"X":246,"Y":0},{"Index":98,"X":248,"Y":0},{"Index":99,"X":251,"Y":0}]}
Xian55 commented

According to the stack trace, it has out of bound exception in ActionBarCostReader line 61.

Where it attempts to index the 35th cell in the frame_config.json file and you just shared the file above, where it has 100 frames element. This is beyond my comprehension.

Are you certain, that you have sent me the correct frame_config.json file what is actually used?

According to the stack trace, it has out of bound exception in ActionBarCostReader line 61.

Where it attempts to index the 35th cell in the frame_config.json file and you just shared the file above, where it has 100 frames element. This is beyond my comprehension.

Are you certain, that you have sent me the correct frame_config.json file what is actually used?

I actually do not know as there's 2 frame_config.json files, first one in \Blazorserver\bin\Release\net7.0 and the second one in \Blazorserver, I sent you the second one.

I just checked both are the same.

What does a normal frame_config.json is supposed to look like?

Xian55 commented
{"Version":3,"addonVersion":"1.7.33","rect":"0, 0, 1920, 1080","meta":{"hash":10101100,"spacing":1,"size":1,"rows":1,"frames":100},"frames":[{"Index":0,"X":0,"Y":0},{"Index":1,"X":3,"Y":0},{"Index":2,"X":5,"Y":0},{"Index":3,"X":8,"Y":0},{"Index":4,"X":10,"Y":0},{"Index":5,"X":13,"Y":0},{"Index":6,"X":15,"Y":0},{"Index":7,"X":18,"Y":0},{"Index":8,"X":20,"Y":0},{"Index":9,"X":23,"Y":0},{"Index":10,"X":25,"Y":0},{"Index":11,"X":28,"Y":0},{"Index":12,"X":30,"Y":0},{"Index":13,"X":33,"Y":0},{"Index":14,"X":35,"Y":0},{"Index":15,"X":38,"Y":0},{"Index":16,"X":41,"Y":0},{"Index":17,"X":43,"Y":0},{"Index":18,"X":46,"Y":0},{"Index":19,"X":48,"Y":0},{"Index":20,"X":51,"Y":0},{"Index":21,"X":53,"Y":0},{"Index":22,"X":56,"Y":0},{"Index":23,"X":58,"Y":0},{"Index":24,"X":61,"Y":0},{"Index":25,"X":63,"Y":0},{"Index":26,"X":66,"Y":0},{"Index":27,"X":68,"Y":0},{"Index":28,"X":71,"Y":0},{"Index":29,"X":73,"Y":0},{"Index":30,"X":76,"Y":0},{"Index":31,"X":78,"Y":0},{"Index":32,"X":81,"Y":0},{"Index":33,"X":84,"Y":0},{"Index":34,"X":86,"Y":0},{"Index":35,"X":89,"Y":0},{"Index":36,"X":91,"Y":0},{"Index":37,"X":94,"Y":0},{"Index":38,"X":96,"Y":0},{"Index":39,"X":99,"Y":0},{"Index":40,"X":101,"Y":0},{"Index":41,"X":104,"Y":0},{"Index":42,"X":106,"Y":0},{"Index":43,"X":109,"Y":0},{"Index":44,"X":111,"Y":0},{"Index":45,"X":114,"Y":0},{"Index":46,"X":116,"Y":0},{"Index":47,"X":119,"Y":0},{"Index":48,"X":122,"Y":0},{"Index":49,"X":124,"Y":0},{"Index":50,"X":127,"Y":0},{"Index":51,"X":129,"Y":0},{"Index":52,"X":132,"Y":0},{"Index":53,"X":134,"Y":0},{"Index":54,"X":137,"Y":0},{"Index":55,"X":139,"Y":0},{"Index":56,"X":142,"Y":0},{"Index":57,"X":144,"Y":0},{"Index":58,"X":147,"Y":0},{"Index":59,"X":149,"Y":0},{"Index":60,"X":152,"Y":0},{"Index":61,"X":154,"Y":0},{"Index":62,"X":157,"Y":0},{"Index":63,"X":159,"Y":0},{"Index":64,"X":162,"Y":0},{"Index":65,"X":165,"Y":0},{"Index":66,"X":167,"Y":0},{"Index":67,"X":170,"Y":0},{"Index":68,"X":172,"Y":0},{"Index":69,"X":175,"Y":0},{"Index":70,"X":177,"Y":0},{"Index":71,"X":180,"Y":0},{"Index":72,"X":182,"Y":0},{"Index":73,"X":185,"Y":0},{"Index":74,"X":187,"Y":0},{"Index":75,"X":190,"Y":0},{"Index":76,"X":192,"Y":0},{"Index":77,"X":195,"Y":0},{"Index":78,"X":197,"Y":0},{"Index":79,"X":200,"Y":0},{"Index":80,"X":203,"Y":0},{"Index":81,"X":205,"Y":0},{"Index":82,"X":208,"Y":0},{"Index":83,"X":210,"Y":0},{"Index":84,"X":213,"Y":0},{"Index":85,"X":215,"Y":0},{"Index":86,"X":218,"Y":0},{"Index":87,"X":220,"Y":0},{"Index":88,"X":223,"Y":0},{"Index":89,"X":225,"Y":0},{"Index":90,"X":228,"Y":0},{"Index":91,"X":230,"Y":0},{"Index":92,"X":233,"Y":0},{"Index":93,"X":235,"Y":0},{"Index":94,"X":238,"Y":0},{"Index":95,"X":240,"Y":0},{"Index":96,"X":243,"Y":0},{"Index":97,"X":246,"Y":0},{"Index":98,"X":248,"Y":0},{"Index":99,"X":251,"Y":0}]}

This one is correct. So most likely the issue is somewhere else.

Xian55 commented

Dragonflight has been added an extra actionbar it seems for dragon flying and slightly changed how the Second Actionbar has been mapped.

In Prior Dragonflight there was only 132 available actionbar slots but now it has 144. Thus the out of bound exception happened.

Thank you for your time to let me debug ๐Ÿ™‡