-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Config global function to extract values from a comma separated list #3267
Comments
like this?;p change the token part to whatever your seperator is |
there is another function to tokenize too, if I recall right, but anyway need to add it to the core and test it, which I didn't manage to do, needs someone who knows cpp |
yooo @Riztazz |
But you already have a function for it, why do you need another one?
Hello Shin! edit: Validate that string is not empty before tokenizing |
already possible see
|
Concept
We need a function in the config manager to easily extract values from a string list.
Ex: "1,2,3,4" or "1, 2, 3, 4"
In the module conf:
MyModule.List = "1, 2, 3, 4"
In the module cpp:
Actually, everytime we want to make a list, we have to recreate a similar function in our modules. This is very bad
Maybe we can also have an argument to choose the delimiter and by default it's a comma
,
.This is what I tried unsuccessfully:
On a suggestion by Malow:
common/Configuration/Config.cpp
common/Configuration/Config.h
The Config.h fails at compilation but I don't know how all this works so I can't fix it.
Also, I don't know if vector is the right data type to use as in the module I wanted that for, the list is in that form:
unordered_set and not vector
The idea was to put this in the config, but also add a secondary list of optional spells and then merge them together. cf: azerothcore/mod-learn-spells#17
Conclusion
Once done, it could also be used in mod-autobalance and replace the function created there
LoadForcedCreatureIdsFromString()
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: