浏览代码

- Added battle config option pk_level_range for specifying valid level ranges to engage in PK
- Added battle config allow_es_magic_player to enable SL_S* skills to work on non-mobs.


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5290 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 年之前
父节点
当前提交
2d461432b8
共有 6 个文件被更改,包括 37 次插入12 次删除
  1. 4 0
      Changelog-Trunk.txt
  2. 4 0
      conf-tmpl/battle/misc.conf
  3. 3 0
      conf-tmpl/battle/skill.conf
  4. 19 8
      src/map/battle.c
  5. 3 0
      src/map/battle.h
  6. 4 4
      src/map/skill.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.  EVERYTHING ELSE
 GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
 2006/02/15
+	* Added battle config option pk_level_range for specifying valid level
+	  ranges to engage in PK (battle/misc.conf) [Skotlex]
+	* Added battle config allow_es_magic_player to enable SL_S* skills to work
+	  on non-mobs. (battle/skill.conf) [Skotlex]
 	* Fixed the char servers to store correctly exp as uints. They are also
 	  capped to LONG_MAX before being sent to the client. [Skotlex]
 	* TK_DODGE now dodges all ranged attacks, when used with SPURT, dodges

+ 4 - 0
conf-tmpl/battle/misc.conf

@@ -39,6 +39,10 @@ manner_system: yes
 // For PK Server Mode. Change this to define the minimum level players can start PK-ing
 pk_min_level: 55
 
+// For PK Server Mode. It specifies the maximum level difference between
+// players to let them attack each other. 0 disables said limit.
+pk_level_range: 0
+
 // Allow muting of players?
 muting_players: yes
 

+ 3 - 0
conf-tmpl/battle/skill.conf

@@ -215,3 +215,6 @@ skip_teleport_lv1_menu: no
 
 // Allow use of SG skills without proper day (Sun/Moon/Star) ?
 allow_skill_without_day: no
+
+// Allow use of ES-type magic on players?
+allow_es_magic_player: no

+ 19 - 8
src/map/battle.c

@@ -3463,15 +3463,22 @@ int battle_check_target( struct block_list *src, struct block_list *target,int f
 			else
 				state |= BCT_ENEMY;
 		}
-		if (state&BCT_ENEMY && battle_config.pk_mode && !map_flag_gvg(m) && s_bl->type == BL_PC && t_bl->type == BL_PC)
+		if (state&BCT_ENEMY && battle_config.pk_mode && !map_flag_gvg(m) &&
+			s_bl->type == BL_PC && t_bl->type == BL_PC)
 		{	//Prevent novice engagement on pk_mode (feature by Valaris)
-			struct map_session_data* sd;
-			if ((sd = (struct map_session_data*)s_bl) &&
-				((sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE || sd->status.base_level < battle_config.pk_min_level))
-				state&=~BCT_ENEMY;
-			else
-			if ((sd = (struct map_session_data*)t_bl) &&
-				((sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE || sd->status.base_level < battle_config.pk_min_level))
+			struct map_session_data* sd = (struct map_session_data*)s_bl,
+			  	*sd2 = (struct map_session_data*)t_bl;
+			if (
+				(sd->class_&MAPID_UPPERMASK) == MAPID_NOVICE ||
+				(sd2->class_&MAPID_UPPERMASK) == MAPID_NOVICE ||
+				sd->status.base_level < battle_config.pk_min_level ||
+			  	sd2->status.base_level < battle_config.pk_min_level ||
+				(battle_config.pk_level_range && (
+					sd->status.base_level > sd2->status.base_level ?
+					sd->status.base_level - sd2->status.base_level :
+					sd2->status.base_level - sd->status.base_level )
+			  		> battle_config.pk_level_range)
+			)
 				state&=~BCT_ENEMY;
 		}
 	} else { //Non pvp/gvg, check party/guild settings.
@@ -3753,6 +3760,7 @@ static const struct battle_data_short {
 	{ "equip_self_break_rate",             &battle_config.equip_self_break_rate	},
 	{ "equip_skill_break_rate",            &battle_config.equip_skill_break_rate	},
 	{ "pk_mode",                           &battle_config.pk_mode			},  	// [Valaris]
+	{ "pk_level_range",                    &battle_config.pk_level_range	},
 	{ "manner_system",                     &battle_config.manner_system		},  	// [Komurka]
 	{ "pet_equip_required",                &battle_config.pet_equip_required	},	// [Valaris]
 	{ "multi_level_up",                    &battle_config.multi_level_up		}, // [Valaris]
@@ -3827,6 +3835,7 @@ static const struct battle_data_short {
 	
 	{ "skip_teleport_lv1_menu",			&battle_config.skip_teleport_lv1_menu}, // [LuzZza]
 	{ "allow_skill_without_day",			&battle_config.allow_skill_without_day}, // [Komurka]
+	{ "allow_es_magic_player",				&battle_config.allow_es_magic_pc },
 	{ "skill_caster_check",					&battle_config.skill_caster_check },
 	{ "status_cast_cancel",					&battle_config.sc_castcancel },
 	{ "pc_status_def_rate",					&battle_config.pc_sc_def_rate },
@@ -4145,6 +4154,7 @@ void battle_set_defaults() {
 	battle_config.equip_self_break_rate = 100; // [Valaris], adapted by [Skotlex]
 	battle_config.equip_skill_break_rate = 100; // [Valaris], adapted by [Skotlex]
 	battle_config.pk_mode = 0; // [Valaris]
+	battle_config.pk_level_range = 0; // [Skotlex]
 	battle_config.manner_system = 1; // [Valaris]
 	battle_config.pet_equip_required = 0; // [Valaris]
 	battle_config.multi_level_up = 0; // [Valaris]
@@ -4219,6 +4229,7 @@ void battle_set_defaults() {
 	
 	battle_config.skip_teleport_lv1_menu = 0;
 	battle_config.allow_skill_without_day = 0;
+	battle_config.allow_es_magic_pc = 0;
 
 	battle_config.skill_caster_check = 1;
 	battle_config.sc_castcancel = 0;

+ 3 - 0
src/map/battle.h

@@ -303,6 +303,8 @@ extern struct Battle_Config {
 	unsigned short multi_level_up;
 	unsigned short max_exp_gain_rate; //Max amount of exp bar % you can get in one go.
 	unsigned short pk_mode;
+	unsigned short pk_level_range;
+
 	unsigned short manner_system;
 	unsigned short show_mob_hp;  // end additions [Valaris]
 
@@ -415,6 +417,7 @@ extern struct Battle_Config {
 	unsigned short skip_teleport_lv1_menu; // possibility to disable (skip) Teleport Lv1 menu, that have only two lines `Random` and `Cancel` [LuzZza]
 
 	unsigned short allow_skill_without_day; // [Komurka]
+	unsigned short allow_es_magic_pc; // [Skotlex]
 	unsigned short skill_wall_check; // [Skotlex]
 	unsigned short cell_stack_limit; // [Skotlex]
 	unsigned short skill_caster_check; // [Skotlex]

+ 4 - 4
src/map/skill.c

@@ -2974,7 +2974,7 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl,int s
 	case SL_STIN:
 	case SL_STUN:
 	case SL_SMA:
-		if (sd && bl->type != BL_MOB) {
+		if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) {
 			status_change_start(src,SC_STUN,100,skilllv,0,0,0,3000,8);
 			clif_skill_fail(sd,skillid,0,0);
 			break;
@@ -5436,7 +5436,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 		break;
 
 	case SL_SKA: // [marquis007]
-		if (sd && bl->type != BL_MOB) {
+		if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) {
 			status_change_start(src,SC_STUN,100,skilllv,0,0,0,3000,8);
 			clif_skill_fail(sd,skillid,0,0);
 			break;
@@ -5451,7 +5451,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 		}
 		break;
 	case SL_SWOO:
-		if (sd && bl->type != BL_MOB) {
+		if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) {
 			status_change_start(src,SC_STUN,100,skilllv,0,0,0,3000,8);
 			clif_skill_fail(sd,skillid,0,0);
 			break;
@@ -5462,7 +5462,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
 		break;
 
 	case SL_SKE:
-		if (sd && bl->type != BL_MOB) {
+		if (sd && !battle_config.allow_es_magic_pc && bl->type != BL_MOB) {
 			status_change_start(src,SC_STUN,100,skilllv,0,0,0,3000,8);
 			clif_skill_fail(sd,skillid,0,0);
 			break;