From 67466ae983ea6e2568b3e017c5d1976850308a2a Mon Sep 17 00:00:00 2001 From: ai4rei Date: Sun, 21 Aug 2011 23:24:50 +0000 Subject: * Fixed monsters above Lv99 displaying a Lv99 aura (bugreport:3986). - The server no longer caps the level sent to the client by default. - Servers that require the aura to be displayed at a level different from lv99, either have to alter the client or adjust the 'client_limit_unit_lv' setting. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14938 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 4 ++++ conf/Changelog.txt | 2 ++ conf/battle/client.conf | 8 +++++++ src/map/battle.c | 1 + src/map/battle.h | 1 + src/map/clif.c | 59 +++++++++++++++++++++++++++++++++++++++++-------- 6 files changed, 66 insertions(+), 9 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 552652cf9..a51c29745 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,5 +1,9 @@ Date Added +2011/08/21 + * Fixed monsters above Lv99 displaying a Lv99 aura (bugreport:3986). [Ai4rei] + - The server no longer caps the level sent to the client by default. + - Servers that require the aura to be displayed at a level different from lv99, either have to alter the client or adjust the 'client_limit_unit_lv' setting. 2011/08/20 * Added quick validation of guild emblems' bitmap format to prevent forged emblems, that cause the client to crash, from being accepted (thx to sinya for a sample). [Ai4rei] 2011/08/16 diff --git a/conf/Changelog.txt b/conf/Changelog.txt index 1b4b45f05..b6c726451 100644 --- a/conf/Changelog.txt +++ b/conf/Changelog.txt @@ -1,5 +1,7 @@ Date Added +2011/08/21 + * Rev. 14938 Added setting 'client_limit_unit_lv' to control the unit types which are affected by 'max_lv' and 'aura_lv' settings. [Ai4rei] 2011/07/09 * Rev. 14892 Removed 'msg_athena.conf' messages 619 and 620 (duplicates to 572 and 573) (since r5506). [Ai4rei] 2011/05/13 diff --git a/conf/battle/client.conf b/conf/battle/client.conf index 6a6c58d13..7194c23bf 100644 --- a/conf/battle/client.conf +++ b/conf/battle/client.conf @@ -17,6 +17,8 @@ //-------------------------------------------------------------- // Note 1: Value is a config switch (on/off, yes/no or 1/0) // Note 2: Value is in percents (100 means 100%) +// Note 3: Value is a bit field. If no description is given, +// assume unit types (1: Pc, 2: Mob, 4: Pet, 8: Homun, 16: Mercenary) //-------------------------------------------------------------- // Set here which client version do you accept. Add all values of clients: @@ -86,6 +88,12 @@ max_lv: 99 // 150 or more will be reported as having level 99 and show an aura. aura_lv: 99 +// Units types affected by max_lv and aura_lv settings. (Note 3) +// Note: If an unit type, which normally does not show an aura, is +// set it will obtain an aura when it meets the level requirement. +// Default: 0 (none) +client_limit_unit_lv: 0 + // Will tuxedo and wedding dresses be shown when worn? (Note 1) wedding_modifydisplay: no diff --git a/src/map/battle.c b/src/map/battle.c index 47a2d70be..b9a408a84 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4014,6 +4014,7 @@ static const struct _battle_data { { "display_party_name", &battle_config.display_party_name, 0, 0, 1, }, { "cashshop_show_points", &battle_config.cashshop_show_points, 0, 0, 1, }, { "mail_show_status", &battle_config.mail_show_status, 0, 0, 2, }, + { "client_limit_unit_lv", &battle_config.client_limit_unit_lv, 0, 0, BL_ALL, }, // BattleGround Settings { "bg_update_interval", &battle_config.bg_update_interval, 1000, 100, INT_MAX, }, { "bg_short_attack_damage_rate", &battle_config.bg_short_damage_rate, 80, 0, INT_MAX, }, diff --git a/src/map/battle.h b/src/map/battle.h index f67f2b8c6..007499afe 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -487,6 +487,7 @@ extern struct Battle_Config int display_party_name; int cashshop_show_points; int mail_show_status; + int client_limit_unit_lv; // [BattleGround Settings] int bg_update_interval; diff --git a/src/map/clif.c b/src/map/clif.c index d45c941ba..5d4d20933 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -756,13 +756,54 @@ void clif_get_weapon_view(struct map_session_data* sd, unsigned short *rhand, un } //To make the assignation of the level based on limits clearer/easier. [Skotlex] -static int clif_setlevel(int lv) +static int clif_setlevel_sub(int lv) { - if( lv < battle_config.max_lv ) - return lv; - if( lv < battle_config.aura_lv ) - return battle_config.max_lv - 1; - return battle_config.max_lv; + if( lv < battle_config.max_lv ) + { + ; + } + else if( lv < battle_config.aura_lv ) + { + lv = battle_config.max_lv - 1; + } + else + { + lv = battle_config.max_lv; + } + + return lv; +} + +static int clif_setlevel(struct block_list* bl) +{ + int lv = status_get_lv(bl); + + switch( bl->type ) + { + case BL_PC: + case BL_HOM: + case BL_MOB: + case BL_MER: + if( battle_config.client_limit_unit_lv&bl->type ) + { + lv = clif_setlevel_sub(lv); + } + break; + case BL_NPC: + case BL_PET: + if( battle_config.client_limit_unit_lv&bl->type ) + { + lv = clif_setlevel_sub(lv); + break; + } + // npcs and pets do not have level + return 0; + default: + ShowWarning("clif_setlevel: Unhandled bl type %d.\n", bl->type); + break; + } + + return lv; } /*========================================== @@ -916,7 +957,7 @@ static int clif_set_unit_idle(struct block_list* bl, unsigned char* buffer, bool offset++; buf = WBUFP(buffer,offset); } - WBUFW(buf,51) = clif_setlevel(status_get_lv(bl)); + WBUFW(buf,51) = clif_setlevel(bl); #if PACKETVER < 20091103 if (type) //End for non-player packet return packet_len(WBUFW(buffer,0)); @@ -1027,7 +1068,7 @@ static int clif_set_unit_walking(struct block_list* bl, struct unit_data* ud, un WBUFPOS2(buf,50,bl->x,bl->y,ud->to_x,ud->to_y,8,8); WBUFB(buf,56) = (sd)? 5 : 0; WBUFB(buf,57) = (sd)? 5 : 0; - WBUFW(buf,58) = clif_setlevel(status_get_lv(bl)); + WBUFW(buf,58) = clif_setlevel(bl); #if PACKETVER >= 20080102 WBUFW(buf,60) = sd?sd->user_font:0; #endif @@ -3102,7 +3143,7 @@ int clif_changeoption2(struct block_list* bl) WBUFW(buf,0) = 0x28a; WBUFL(buf,2) = bl->id; WBUFL(buf,6) = sc->option; - WBUFL(buf,10) = clif_setlevel(status_get_lv(bl)); + WBUFL(buf,10) = clif_setlevel(bl); WBUFL(buf,14) = sc->opt3; if(disguised(bl)) { clif_send(buf,packet_len(0x28a),bl,AREA_WOS); -- cgit v1.2.3-70-g09d2