From 9d02f1a1b111f882ca824583b1380a96fdeb556d Mon Sep 17 00:00:00 2001 From: celest Date: Sat, 20 Nov 2004 11:42:58 +0000 Subject: Added night_darkness_level git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@267 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 4 ++++ conf-tmpl/battle_athena.conf | 5 +++++ src/map/atcommand.c | 11 +++++++++-- src/map/battle.c | 5 +++++ src/map/battle.h | 1 + src/map/clif.c | 17 +++++++++++------ src/map/pc.c | 15 ++++++++++++--- src/map/skill.c | 6 ++++-- 8 files changed, 51 insertions(+), 13 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 5afa9598f..661058a21 100644 --- a/Changelog.txt +++ b/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] diff --git a/conf-tmpl/battle_athena.conf b/conf-tmpl/battle_athena.conf index ee7b4c01f..75434bbd3 100644 --- a/conf-tmpl/battle_athena.conf +++ b/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. // diff --git a/src/map/atcommand.c b/src/map/atcommand.c index bb2ce41c7..fedde3ad0 100644 --- a/src/map/atcommand.c +++ b/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. } } diff --git a/src/map/battle.c b/src/map/battle.c index ba4ab31a4..a23f8b510 100644 --- a/src/map/battle.c +++ b/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; } /*========================================== diff --git a/src/map/battle.h b/src/map/battle.h index 457a02554..df9446285 100644 --- a/src/map/battle.h +++ b/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] diff --git a/src/map/clif.c b/src/map/clif.c index c41e42294..aa74f4e87 100644 --- a/src/map/clif.c +++ b/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 diff --git a/src/map/pc.c b/src/map/pc.c index 6b9148119..029bddeff 100644 --- a/src/map/pc.c +++ b/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; } // ステ?タス初期計算など @@ -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); } } diff --git a/src/map/skill.c b/src/map/skill.c index a9fa326de..58b74f149 100644 --- a/src/map/skill.c +++ b/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) -- cgit v1.2.3-60-g2f50