Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check validity first before loading instead of doing simultaneously #166

Open
gridhead opened this issue Sep 21, 2024 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@gridhead
Copy link
Owner

While loading the artifact of a certain area, if a certain substat is invalid then it loads the artifact up partially before throwing the dialog box showing the error.

Here is the affected code which can be found here https://github.com/gridhead/gi-loadouts/blob/main/gi_loadouts/face/wind/fclt.py

for indx in ["main", "a", "b", "c", "d"]:
    dropname = getattr(self, f"arti_{part}_name_{indx}")
    dropdata = getattr(self, f"arti_{part}_data_{indx}")
    namelist = [dropname.itemText(roll) for roll in range(dropname.count())]
    if getattr(arti, f"stat_{indx}").stat_name.value in namelist:
        dropname.setCurrentText(getattr(arti, f"stat_{indx}").stat_name.value)
        if indx != "main":
            dropdata.setText(str(getattr(arti, f"stat_{indx}").stat_data))
    else:
        raise ValueError("Artifact stat cannot be identified.")

For a mistaken GOOD format file as follows,

{
  "id": "BA394BF0",
  "location": "",
  "lock": false,
  "setKey": "NoblesseOblige",
  "rarity": 5,
  "level": 20,
  "slotKey": "circlet",
  "mainStatKey": "heal_",
  "substats": [
    {
      "key": "heal_",
      "value": 12.0
    },
    {
      "key": "atk_",
      "value": 34.0
    },
    {
      "key": "critRate_",
      "value": 56.0
    },
    {
      "key": "critDMG_",
      "value": 78.0
    }
  ]
}

The following is the result,

{FD9DF010-CB15-4F84-BCD5-165AC38BFBAD}

See how the artifact has partially loaded before the dialog is shown.

@gridhead gridhead added the bug Something isn't working label Sep 21, 2024
@gridhead gridhead self-assigned this Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant