summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h1
-rw-r--r--src/map/clif.c59
3 files changed, 52 insertions, 9 deletions
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);