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

Custom Race loading similar to league settings loading #169

Open
williamleonard opened this issue Sep 21, 2016 · 5 comments
Open

Custom Race loading similar to league settings loading #169

williamleonard opened this issue Sep 21, 2016 · 5 comments

Comments

@williamleonard
Copy link

I would like to suggest that instead of requiring a person edit header.php, following other custom races, adding a setting, and adding a file into the lib file, it should do something like this:

Add a setting in settings.php.
header.php parses the $settings['custom_races'] array and loads files based on the key name removing spaces and setting it to lowercase. Example: $settings['custom_races']['Apes of wrath'] loads 'lib/game_data_apesofwrath.php'

Though, I think these custom files should be in another folder that is just for custom races. custom may be a good folder name. It could allow another feature of loading custom libs if people wanted to edit lib files, but that is beyond this suggestion.

@darkporpoise
Copy link

I think the neatest solution would be to load the default races from game_data.php into a races table on first install and then reference that table thereafter.

New and existing races could then be added or edited fairly easily via phpMyAdmin initially without having to edit php files on the server. Longer term it would be great to create an admin page in OBBLM for race maintenance.

@williamleonard
Copy link
Author

I agree with the custom interface to just load it directly into the database. There should probably be a clean function to set it back to default as well.

@williamleonard
Copy link
Author

The game data isn't just used to populate the database, it is used in other parts of the code. I was going to make some suggestions on this, but with the little reward and high risk, I don't think a front end for this would be worth it.

@darkporpoise
Copy link

Would a races import/export function be easier or less risky to implement? e.g. edit a CSV to add races and then load it back in to OBBLM.

@williamleonard
Copy link
Author

CSV would be tough because of the nesting.
XML would be the best especially since we can have an XSD file to do a full verification of the import. You can see an XSD that I did here: https://github.com/TheNAF/naflm/blob/master/modules/leegmgr/botocsreport.xsd
You can see a sample of how the verification is done here: https://github.com/TheNAF/naflm/blob/master/modules/leegmgr/class_upload_botocs.php line 802 in the valxml function.

Still OBBLM uses the $DEA array in other parts of the code, so the best flow in something like this would be:
Read the XML, validate, transform that to an array. Then there is the matter of the race index variable and constants. I think it is still a bit complicated.

I did a test with json_encode and was able to set the entire $DEA to a json string, but then the reverse loses the constants and only brings it back as the numbers.

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

No branches or pull requests

2 participants