Ver código fonte

Added a config for disabling novice/summoner character creation (#3008)

* Added a config for disabling novice/summoner character creation.
* Summoner can no longer be created on pre-renewal by default.
Thanks to @Lemongrass3110 for the help
Jittapan Pluemsumran 7 anos atrás
pai
commit
aab5d54945

+ 7 - 0
conf/battle/player.conf

@@ -261,3 +261,10 @@ fame_pharmacy_10: 50
 // Be mindful that the more options used, the easier it becomes to cheat features that rely on idletime (e.g. checkidle()).
 // Default: walk (0x1) + useskilltoid (0x2) + useskilltopos (0x4) + useitem (0x8) + attack (0x10) = 0x1F
 idletime_option: 0x1F
+
+// Adjust the summoner class' special traits.
+// 0: Summoners behave like other classes.
+// 1: Summoners belong to brute race instead of demi-human
+// 2: Summoners are small size instead of medium
+// 3: Both of the above (official value)
+summoner_trait: 3

+ 8 - 0
conf/char_athena.conf

@@ -189,6 +189,14 @@ char_del_option: 2
 // 3: Character cannot be deleted as long as he remains in a party or guild(default)
 char_del_restriction: 3
 
+// Restrict certain class from being created. (Only functional on 20151001aRagexe or later)
+// 0: No character creation is allowed
+// 1: Only novice is allowed to be created    (pre-renewal default)
+// 2: Only summoner is allowed to be created
+// 3: Both novice and summoner can be created (renewal default)
+// Uncomment to customize the restriction
+//allowed_job_flag: 3
+
 // What folder the DB files are in (item_db.txt, etc.)
 db_path: db
 

+ 10 - 1
src/char/char.cpp

@@ -1456,7 +1456,8 @@ int char_make_new_char_sql(struct char_session_data* sd, char* name_, int str, i
 	}
 
 #if PACKETVER >= 20151001
-	if (start_job != JOB_NOVICE && start_job != JOB_SUMMONER)
+	if(!(start_job == JOB_NOVICE && (charserv_config.allowed_job_flag&1)) && 
+		!(start_job == JOB_SUMMONER && (charserv_config.allowed_job_flag&2)))
 		return -2; // Invalid job
 
 	// Check for Doram based information.
@@ -2779,6 +2780,12 @@ void char_set_defaults(){
 	charserv_config.clan_remove_inactive_days = 14;
 	charserv_config.mail_return_days = 14;
 	charserv_config.mail_delete_days = 14;
+
+#if defined(RENEWAL) && PACKETVER >= 20151001
+	charserv_config.allowed_job_flag = 3;
+#else
+	charserv_config.allowed_job_flag = 1;
+#endif
 }
 
 /**
@@ -3057,6 +3064,8 @@ bool char_config_read(const char* cfgName, bool normal){
 			charserv_config.mail_return_days = atoi(w2);
 		} else if (strcmpi(w1, "mail_delete_days") == 0) {
 			charserv_config.mail_delete_days = atoi(w2);
+		} else if (strcmpi(w1, "allowed_job_flag") == 0) {
+			charserv_config.allowed_job_flag = atoi(w2);
 		} else if (strcmpi(w1, "import") == 0) {
 			char_config_read(w2, normal);
 		}

+ 2 - 0
src/char/char.hpp

@@ -185,6 +185,8 @@ struct CharServ_Config {
 	int clan_remove_inactive_days;
 	int mail_return_days;
 	int mail_delete_days;
+
+	int allowed_job_flag;
 };
 extern struct CharServ_Config charserv_config;
 

+ 1 - 0
src/map/battle.cpp

@@ -8505,6 +8505,7 @@ static const struct _battle_data {
 	{ "skill_drop_items_full",              &battle_config.skill_drop_items_full,           0,      0,      1,              },
 	{ "feature.homunculus_autofeed",        &battle_config.feature_homunculus_autofeed,     1,      0,      1,              },
 	{ "feature.homunculus_autofeed_rate",   &battle_config.feature_homunculus_autofeed_rate,30,     0,    100,              },
+    { "summoner_trait",                     &battle_config.summoner_trait,                  3,      0,      3,              },
 
 #include "../custom/battle_config_init.inc"
 };

+ 2 - 1
src/map/battle.hpp

@@ -639,8 +639,9 @@ struct Battle_Config
 	int autoloot_adjust;
 	int broadcast_hide_name;
 	int skill_drop_items_full;
-	int feature_homunculus_autofeed;
+    int feature_homunculus_autofeed;
 	int feature_homunculus_autofeed_rate;
+	int summoner_trait;
 
 #include "../custom/battle_config_struct.inc"
 };

+ 2 - 2
src/map/status.cpp

@@ -3415,7 +3415,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
 	// Give them all modes except these (useful for clones)
 	base_status->mode = static_cast<e_mode>(MD_MASK&~(MD_STATUS_IMMUNE|MD_IGNOREMELEE|MD_IGNOREMAGIC|MD_IGNORERANGED|MD_IGNOREMISC|MD_DETECTOR|MD_ANGRY|MD_TARGETWEAK));
 
-	base_status->size = (sd->class_&JOBL_BABY || (sd->class_&MAPID_BASEMASK) == MAPID_SUMMONER) ? SZ_SMALL : SZ_MEDIUM;
+	base_status->size = (sd->class_&JOBL_BABY || ((battle_config.summoner_trait&2) && (sd->class_&MAPID_BASEMASK) == MAPID_SUMMONER)) ? SZ_SMALL : SZ_MEDIUM;
 	if (battle_config.character_size && pc_isriding(sd)) { // [Lupus]
 		if (sd->class_&JOBL_BABY) {
 			if (battle_config.character_size&SZ_BIG)
@@ -3426,7 +3426,7 @@ int status_calc_pc_(struct map_session_data* sd, enum e_status_calc_opt opt)
 	}
 	base_status->aspd_rate = 1000;
 	base_status->ele_lv = 1;
-	base_status->race = ((sd->class_&MAPID_BASEMASK) == MAPID_SUMMONER) ? RC_BRUTE : RC_PLAYER;
+	base_status->race = ((battle_config.summoner_trait&1) && (sd->class_&MAPID_BASEMASK) == MAPID_SUMMONER) ? RC_BRUTE : RC_PLAYER;
 	base_status->class_ = CLASS_NORMAL;
 
 	// Zero up structures...