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

feat: update ClassID & AscendencyID as enums #20

Merged
merged 3 commits into from
Feb 19, 2025
Merged

Conversation

Euheimr
Copy link
Contributor

@Euheimr Euheimr commented Feb 17, 2025

Build & Spec structs within pob/types_saved.go now use named types (ClassName, AscendancyName) and enums (ClassID, AscendancyID) instead of strings.

  1. SelectClass(...) & SelectAscendancyClass(...) within passive_spec.go now use enums (ClassID, AscendancyID). This behavior is identical to the original Lua implementation.
  2. ClassName & AscendancyName may be retrieved by using the ClassID or AscendancyID respectively as an index within new maps: ClassNameByID[ClassID] & AscendancyNameByID[AscendancyID]
  3. SetClass(...) & SetAscendancy(...) within pob/methods_saved.go now use their respective enumerated IDs
    REVERTED see commit #9310a2e and my explanation below.
  4. data.UnarmedWeaponData[...] now uses the ClassID enum directly as an index instead of ClassName (improves code readability)

Something to note:
I considered implementing a String() function for getting the ClassName or AscendancyName, but using maps with the ClassID/AscendancyID as the index seemed more straight forward and made more sense for it belonging within types_saved.go.

If desired, I can change the implementation to ClassID.String() and AscendancyID.String() instead of maps with their respective IDs as indexes.

I just don't know where those String() functions should belong as the enums and maps are in types_saved.go.

Build & Spec structs now use constrained types and enums instead of strings respectively.
Copy link

vercel bot commented Feb 17, 2025

@Euheimr is attempting to deploy a commit to the vilsol's projects Team on Vercel.

A member of the Team first needs to authorize it.

@Euheimr
Copy link
Contributor Author

Euheimr commented Feb 17, 2025

commit #8e1f724 changed a struct field ID from a string to a named typed enum, thus breaking the frontend.

commit #9310a2e reverts this change, as well as reverts the SetClass() and SetAscendancy() go functions from numeric IDs to named string types ClassName and AscendancyName.

I'm sorry, I didn't know those functions hook into the frontend as they do. My mistake. I learned a lot today about how Svelte interacts with the backend.

Copy link

vercel bot commented Feb 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
go-pob ✅ Ready (Inspect) Visit Preview Feb 18, 2025 8:02am

@Vilsol Vilsol merged commit a6fc56e into Vilsol:dev Feb 19, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants