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

Centralize some config reading function and add support for constants in mob skill db #3164

Merged
merged 6 commits into from
Oct 24, 2022

Conversation

guilherme-gm
Copy link
Member

Pull Request Prelude

Changes Proposed

The main objective of this PR is to allow the usage of constants and bitmask arrays in mob_skill_db.conf for fields that didn't support it yet.

This allows making configs a bit more readable and maybe less error prone as we have actual constants to use.

This change applies for the val* fields and Emotion, and now allows a config like: (Note: Yes, using val0 for NPC_EMOTION + Emotion doesn't make much sense, but serves as an example)

		NPC_EMOTION: {
			SkillState: "MSS_LOOT"
			SkillLevel: 1
			Rate: 2000
			Delay: 5000
			Cancelable: true
			SkillTarget: "MST_SELF"
			CastCondition: "MSC_ALWAYS"
			val0: "e_lv" //<-- Const instead of number
			val1: ["MD_CANMOVE", "MD_LOOTER"] //<-- Array with constants instead of bitmask number
			Emotion: "e_gg" //<-- Const instead of number
		}

As we already had functions to do that on itemdb (and also the same function for const in mob), I decided to centralize them in map.c (Thanks @4144 for the discussion 😄 ), this way we can use a single function and it doesn't look weird that monster is calling itemdb for no real reason.

Note: I was unsure whether I should make a script automatically update the files to use constants where possible. I am not sure if I know all the cases, but if you think it would be nice to have, I can work on a script that updates most common cases (such as slaves, emotion and mode changes)

Issues addressed:
Closes #2768

this is a better place for a function that may be reused in interfaces
that have nothing to do with item data
this way other interfaces that are unrelated to item db may also
use the existing logic to deal with bitmask arrays
this allows val0, val1, val2, val3, val4 and Emotion
fields to use constants available in the script engine,
such as monster name constants, emotion constants, etc
@MishimaHaruna MishimaHaruna added this to the Release v2022.11.02 milestone Oct 15, 2022
@MishimaHaruna MishimaHaruna added the hacktoberfest-accepted Easy-to-tackle issues label Oct 21, 2022
@MishimaHaruna MishimaHaruna merged commit fdde8c2 into HerculesWS:master Oct 24, 2022
@guilherme-gm guilherme-gm deleted the mob_skill_constants branch October 24, 2022 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Easy-to-tackle issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants