Browse Source

Added night_darkness_level

git-svn-id: https://svn.code.sf.net/p/rathena/svn/athena@267 54d463be-8e91-2dee-dedb-b68131a5f0ec
celest 20 years ago
parent
commit
72c341d10a
8 changed files with 51 additions and 13 deletions
  1. 4 0
      Changelog.txt
  2. 5 0
      conf-tmpl/battle_athena.conf
  3. 9 2
      src/map/atcommand.c
  4. 5 0
      src/map/battle.c
  5. 1 0
      src/map/battle.h
  6. 11 6
      src/map/clif.c
  7. 12 3
      src/map/pc.c
  8. 4 2
      src/map/skill.c

+ 4 - 0
Changelog.txt

@@ -3,6 +3,10 @@ Date	Added
           - Napalm vulcan, Enchant Deadly Poison, Slow Poison (based on jAthena 1066)
           - Create Deadly Poison, thanks to DracoRPG!
           - Added effect for Meteor Assault
+        * Added night_darkness_level to battle_athena.conf. [celest]
+          Use this to set 'how dark' it'll become during night time. Use 0 for default,
+          or between 1-10. (Yeah, i know lots of people hated the original night! xP)
+          Warning: It may cause errors with old exe's!
 
 11/19
 	* Re-added check for empty bottle when using aqua benedicta. [Valaris]

+ 5 - 0
conf-tmpl/battle_athena.conf

@@ -671,6 +671,11 @@ day_duration: 7200000
 // Except 0, minimum is 60000 (1 minute).
 night_duration: 1800000
 
+// Set how dark it will become during night time
+// Range: 1-5, 0 for default
+// Warning: might not work with old exe's
+night_darkness_level: 0
+
 // Will display a mob's hp/maxhp when the mouse cursor is over them. (Note 1)
 // Will not display guardian or emperium hp.
 //

+ 9 - 2
src/map/atcommand.c

@@ -4503,8 +4503,15 @@ int atcommand_night(
 		night_flag = 1; // 0=day, 1=night [Yor]
 		for(i = 0; i < fd_max; i++) {
 			if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth && !map[sd->bl.m].flag.indoors) {
-				pl_sd->opt2 |= STATE_BLIND;
-				clif_changeoption(&pl_sd->bl);
+				//pl_sd->opt2 |= STATE_BLIND;
+				//clif_changeoption(&pl_sd->bl);
+				if (battle_config.night_darkness_level > 0)
+					clif_specialeffect(&pl_sd->bl, 474 + battle_config.night_darkness_level, 0);
+				else {
+					//clif_specialeffect(&pl_sd->bl, 483, 0); // default darkness level
+					pl_sd->opt2 |= STATE_BLIND;
+					clif_changeoption(&pl_sd->bl);
+				}
 				clif_displaymessage(pl_sd->fd, msg_table[59]); // Night has fallen.
 			}
 		}

+ 5 - 0
src/map/battle.c

@@ -5132,6 +5132,7 @@ static const struct {
 	{ "pk_min_level",           &battle_config.pk_min_level}, // [celest]
 	{ "skill_steal_type",       &battle_config.skill_steal_type}, // [celest]
 	{ "skill_steal_rate",       &battle_config.skill_steal_rate}, // [celest]
+	{ "night_darkness_level",   &battle_config.night_darkness_level}, // [celest]
 
 //SQL-only options start
 #ifndef TXT_ONLY 
@@ -5357,6 +5358,7 @@ void battle_set_defaults() {
 	battle_config.pk_min_level = 55;
 	battle_config.skill_steal_type = 1;
 	battle_config.skill_steal_rate = 100;
+	battle_config.night_darkness_level = 9;
 
 	battle_config.castrate_dex_scale = 150;
 
@@ -5476,6 +5478,9 @@ void battle_validate_conf() {
 	// at least 1 client must be accepted
 	if ((battle_config.packet_ver_flag & 63) == 0) // added by [Yor]
 		battle_config.packet_ver_flag = 63; // accept all clients
+	
+	if (battle_config.night_darkness_level > 10) // Celest
+		battle_config.night_darkness_level = 10;
 }
 
 /*==========================================

+ 1 - 0
src/map/battle.h

@@ -336,6 +336,7 @@ extern struct Battle_Config {
 	int pk_min_level; // [celest]
 	int skill_steal_type; // [celest]
 	int skill_steal_rate; // [celest]
+	int night_darkness_level; // [celest]
 
 #ifndef TXT_ONLY /* SQL-only options */
 	int mail_system; // [Valaris]

+ 11 - 6
src/map/clif.c

@@ -7299,12 +7299,17 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 		skill_status_change_start(&sd->bl,SC_NOCHAT,0,0,0,0,0,0);
 
 	if (night_flag) {
-		// night - when changing from indoors to outdoors - celest
-		if (!map[sd->bl.m].flag.indoors && sd->opt2 != STATE_BLIND)
-			sd->opt2 |= STATE_BLIND;
-		// changing from outdoors to indoors
-		else if (map[sd->bl.m].flag.indoors && sd->opt2 == STATE_BLIND)
-			sd->opt2 &= ~STATE_BLIND;					
+		if (battle_config.night_darkness_level > 0 && !map[sd->bl.m].flag.indoors)
+			clif_specialeffect(&sd->bl, 474 + battle_config.night_darkness_level, 0);
+		else {
+			//clif_specialeffect(&sd->bl, 483, 0); // default darkness level
+			// night - when changing from indoors to outdoors - celest
+			if (!map[sd->bl.m].flag.indoors && sd->opt2 != STATE_BLIND)
+				sd->opt2 |= STATE_BLIND;
+			// changing from outdoors to indoors
+			else if (map[sd->bl.m].flag.indoors && sd->opt2 == STATE_BLIND)
+				sd->opt2 &= ~STATE_BLIND;
+		}
 	}
 
 	// option

+ 12 - 3
src/map/pc.c

@@ -803,7 +803,11 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, struct mmo_chars
 		char tmpstr[1024];
 		strcpy(tmpstr, msg_txt(500)); // Actually, it's the night...
 		clif_wis_message(sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1);
-		sd->opt2 |= STATE_BLIND;
+		if (battle_config.night_darkness_level > 0)
+			clif_specialeffect(&sd->bl, 474 + battle_config.night_darkness_level, 0);
+		else
+			//clif_specialeffect(&sd->bl, 483, 0); // default darkness level
+			sd->opt2 |= STATE_BLIND;
 	}
 
 	// ƒXƒe?ƒ^ƒX�‰ŠúŒvŽZ‚È‚Ç
@@ -7227,8 +7231,13 @@ int map_night_timer(int tid, unsigned int tick, int id, int data) { // by [yor]
 			night_flag = 1; // 0=day, 1=night [Yor]
 			for(i = 0; i < fd_max; i++) {
 				if (session[i] && (pl_sd = session[i]->session_data) && pl_sd->state.auth  && !map[pl_sd->bl.m].flag.indoors) {
-					pl_sd->opt2 |= STATE_BLIND;
-					clif_changeoption(&pl_sd->bl);
+					if (battle_config.night_darkness_level > 0)
+						clif_specialeffect(&pl_sd->bl, 474 + battle_config.night_darkness_level, 0);
+					else {
+						//clif_specialeffect(&pl_sd->bl, 483, 0); // default darkness level
+						pl_sd->opt2 |= STATE_BLIND;
+						clif_changeoption(&pl_sd->bl);
+					}
 					clif_wis_message(pl_sd->fd, wisp_server_name, tmpstr, strlen(tmpstr)+1);
 				}
 			}

+ 4 - 2
src/map/skill.c

@@ -8094,7 +8094,8 @@ int skill_status_change_end(struct block_list* bl, int type, int tid)
 			break;
 		}
 
-		if (night_flag == 1 && (*opt2 & STATE_BLIND) == 0 && bl->type == BL_PC && !map[bl->m].flag.indoors) { // by [Yor]
+		if (night_flag == 1 && (*opt2 & STATE_BLIND) == 0 && bl->type == BL_PC && // by [Yor]
+			!map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) { // [celest]
 			*opt2 |= STATE_BLIND;
 			opt_flag = 1;
 		}
@@ -9369,7 +9370,8 @@ int skill_status_change_clear(struct block_list *bl, int type)
 	*opt3 = 0;
 	*option &= OPTION_MASK;
 
-	if (night_flag == 1 && type == BL_PC && !map[bl->m].flag.indoors) // by [Yor]
+	if (night_flag == 1 && type == BL_PC && !map[bl->m].flag.indoors && // by [Yor]
+		!map[bl->m].flag.indoors && battle_config.night_darkness_level <= 0) // [celest]
 		*opt2 |= STATE_BLIND;
 
 	if(!type || type&2)