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

Creature: Add SetMulticlassLimit #1788

Merged
merged 2 commits into from
Oct 22, 2024
Merged

Conversation

hendrikgit
Copy link
Contributor

Adds NWNX_Creature_SetMulticlassLimit(object oCreature, int nLimit) to limit the number of classes a PC can take dynamically.


NWNX_EXPORT ArgumentStack SetMulticlassLimit(ArgumentStack&& args)
{
if (!s_bGetIsClassAvailableHookInitialized)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to check/set a static bool, the static hook below will only be initialized once

static Hooks::Hook s_GetClassLevelHook = nullptr;

static std::unordered_map<uint8_t, std::unordered_map<ObjectID, int16_t>> s_RollModifier;
static std::unordered_map<ObjectID, bool> s_ParryAllAttacks;
static std::unordered_map<OBJECT_ID, uint> s_MulticlassLimits;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why an unordered_map instead of using NWNX's POS? With POS you can have it persist to the bic too

@hendrikgit
Copy link
Contributor Author

Thanks Daz. I removed the static bool and switched to using POS.

@Daztek
Copy link
Member

Daztek commented Oct 13, 2024

Maybe add a GetMulticlassLimit too?

@hendrikgit
Copy link
Contributor Author

Added a get function.

@Daztek Daztek merged commit 57a3800 into nwnxee:master Oct 22, 2024
5 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