Jump to content
Haru

[2016-01-13] ConstDB converted to libconfig format, added doc/constants.md

Recommended Posts

Rationale:

This is an (unplanned) episode in the txt->libconfig conversion project. The reason for the conversion is that we suddenly needed a way to add attributes (specifically, "deprecated" to some constants, since simply removing them would mean that any scripts using them would silently fail (talk about terrible script engine).

 

Contents:

The Constants Database (db/const.txt) has been converted to the usual libconfig format. This allows us to add new attributes to the constants.

Old, unused, constants have been marked as deprecated using the facilities provided by the new database format (mostly, Job_Alchem, VAR_*), and their use will now trigger a warning at parse time (previously, it would result in a value of zero being used silently, in a very nasty way).

A new docuemntation file (doc/constants.md) is provided, listing all the constants available to the scripting engine (coming from Constants DB, Item DB, Mob DB, Skill DB or even hardcoded in source), since there wasn't any centralized place where all the constants were listed. The file will get automatically updated in future through the HerculesWSAPI bot.

The document is readily available online through the following link: https://github.com/HerculesWS/Hercules/blob/master/doc/constants.md (it will always point to the latest version)

 

Impact:

The impact of this changeset on customizations is low. If using custom constants in const.txt, users can either use the provided script to re-generate their constants.conf, or add the entries manually.

 

Details:

The format of constants.conf is the following:

constants_db: {
/************* Entry structure (short) ************************************
	Identifier: value            // (int)
 ************* Entry structure (full) *************************************
	Identifier: {
		Value: value         // (int)
		Parameter: true      // (boolean)      Defaults to false.
		Deprecated: true     // (boolean)      Defaults to false.
	}
**************************************************************************/

(each entry can use either the short or full format).

 

A special "comment__" field can be added, to generate a corresponding title in the documentation file. Comments will have no other effects (they're not normally parsed, but they're available to plugins).

 

Merge Date:

Wed, 13 Jan 2016 19:22:45 +0300

 

Related Pull Requests:

- #1088 - https://github.com/HerculesWS/Hercules/pull/1088 - Constdb revamp [Haru]

- #908 - https://github.com/HerculesWS/Hercules/pull/908 - Add EQP_ = Equipment Position constants [AnnieRuru]

- #1124 - https://github.com/HerculesWS/Hercules/pull/1124 - Constdb2doc plugin (doc/constants.md) [Haru]

 

Related Commits:

- a815472 - https://github.com/HerculesWS/Hercules/commit/a815472 - Sun, 10 Jan 2016 02:01:55 +0100 Converted const.txt to libconfig format [Haru]

- 6ae9045 - https://github.com/HerculesWS/Hercules/commit/6ae9045 - Sun, 10 Jan 2016 02:33:15 +0100 Added support to mark constants in db/constants.conf as deprecated [Haru]

- 3f56ffc - https://github.com/HerculesWS/Hercules/commit/3f56ffc - Sun, 10 Jan 2016 02:33:41 +0100 Marked Job_Alchem and Job_Baby_Alchem as deprecated [Haru]

- 99f707e - https://github.com/HerculesWS/Hercules/commit/99f707e - Wed, 13 Jan 2016 11:47:47 +0100 Added converter script from const.txt to constants.conf [Haru]

- 49081f4 - https://github.com/HerculesWS/Hercules/commit/49081f4 - Wed, 13 Jan 2016 19:22:45 +0300 Merge pull request #1088 from HerculesWS/constdb [Andrei Karas]

- 9e48e2a - https://github.com/HerculesWS/Hercules/commit/9e48e2a - Wed, 13 Jan 2016 17:23:31 +0100 HPM Hooks Update [Hercules.ws] (dastgir/master)

- de33b02 - https://github.com/HerculesWS/Hercules/commit/de33b02 - Fri, 15 Jan 2016 20:34:26 +0100 Fixed a typo in the constdb converter script [Haru]

- a1310e2 - https://github.com/HerculesWS/Hercules/commit/a1310e2 - Wed, 6 Jan 2016 16:38:43 +0800 Remove VAR_ constants - there are 2 same constants for setlook script command, remove the wrong one - VAR_ constant added by l

one_wolf is invalid https://github.com/HerculesWS/Hercules/commit/f4278f36db32f35e535a0ea8feb1cf83ca95019e, so use the LOOK_ constant [AnnieRuru]

- 7610346 - https://github.com/HerculesWS/Hercules/commit/7610346 - Sat, 16 Jan 2016 20:23:57 +0100 Merge pull request #908 from AnnieRuru/request_26 [Haru]

- e3253b4 - https://github.com/HerculesWS/Hercules/commit/e3253b4 - Mon, 25 Jan 2016 16:52:27 +0100 Added source support for special comments in the constdb [Haru]

- 72a75cb - https://github.com/HerculesWS/Hercules/commit/72a75cb - Mon, 25 Jan 2016 15:53:56 +0100 Added constdb2doc plugin [Haru]

- 15bca8f - https://github.com/HerculesWS/Hercules/commit/15bca8f - Mon, 25 Jan 2016 16:00:44 +0100 Generated doc/constants.md [Haru] (HEAD -> constdb2doc, origin/constdb2doc)

 

Trivia:

The constdb2doc plugin introduced in 72a75cb is based on my 'vimsyntaxgen' plugin (see https://github.com/HerculesWS/StaffPlugins/tree/master/Haru/vimsyntaxgen).

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.