Kaynağa Gözat

fixed STEAL. now working

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6378 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lupus 19 yıl önce
ebeveyn
işleme
cdffe16fba
4 değiştirilmiş dosya ile 15 ekleme ve 18 silme
  1. 3 5
      conf-tmpl/battle/skill.conf
  2. 3 3
      src/map/battle.c
  3. 1 1
      src/map/map.h
  4. 8 9
      src/map/pc.c

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

@@ -206,11 +206,9 @@ backstab_bow_penalty: yes
 skill_steal_type: yes
 
 // How many times you could try to steal from a mob.
-// Note: It might help to close stealing exploit on monstewrs with few/rare items
-// 0 = you can't steal at all
-// 1..255 = exact numbel of tries
-// 256 = there's no stealing tries limit
-skill_steal_max_tries: 256
+// Note: It helps to avoid stealing exploit on monstewrs with few rare items
+// 0..254 = number of tries +1
+skill_steal_max_tries: 15
 
 // Can Rogues plagiarize advanced job skills           
 // 0 = no restriction

+ 3 - 3
src/map/battle.c

@@ -4227,7 +4227,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.skill_steal_max_tries = 256;
+	battle_config.skill_steal_max_tries = 15; //=16 tries
 //	battle_config.night_darkness_level = 9;
 	battle_config.motd_type = 0;
 	battle_config.allow_atcommand_when_mute = 0;
@@ -4491,8 +4491,8 @@ void battle_validate_conf() {
 	if (battle_config.sg_miracle_skill_ratio > 10000)
 		battle_config.sg_miracle_skill_ratio = 10000;
 
-	if (battle_config.skill_steal_max_tries > 256)
-		battle_config.skill_steal_max_tries = 256;	
+	if (battle_config.skill_steal_max_tries > 254)
+		battle_config.skill_steal_max_tries = 254;	
 
 #ifdef CELL_NOSTACK
 	if (battle_config.cell_stack_limit < 1)

+ 1 - 1
src/map/map.h

@@ -881,7 +881,7 @@ struct mob_data {
 	struct {
 		unsigned skillstate : 8;
 		unsigned aggressive : 1; //Signals whether the mob AI is in aggressive mode or reactive mode. [Skotlex]
-		unsigned steal_flag : 8; //number of steal tries (to prevent steal exploit on mobs with few items) [Lupus]
+		unsigned char steal_flag; //number of steal tries (to prevent steal exploit on mobs with few items) [Lupus]
 		unsigned steal_coin_flag : 1;
 		unsigned soul_change_flag : 1; // Celest
 		unsigned alchemist: 1;

+ 8 - 9
src/map/pc.c

@@ -2916,10 +2916,10 @@ int pc_show_steal(struct block_list *bl,va_list ap)
  *
  *------------------------------------------
  */
-//** pc.c: Small Steal Item fix by fritz
+//** pc.c:
 int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
 {
-	int i,skill,itemid,flag;
+	int i,j,skill,itemid,flag;
 	struct mob_data *md;
 	struct item tmp_item;
 
@@ -2928,17 +2928,13 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
 	
 	md=(struct mob_data *)bl;
 
-
-	if(1 || md->state.steal_flag>battle_config.skill_steal_max_tries || status_get_mode(bl)&MD_BOSS || md->master_id ||
+	if(md->state.steal_flag>battle_config.skill_steal_max_tries || status_get_mode(bl)&MD_BOSS || md->master_id ||
 		(md->class_>=1324 && md->class_<1364) || // prevent stealing from treasure boxes [Valaris]
 		map[md->bl.m].flag.nomobloot ||        // check noloot map flag [Lorky]
 		md->sc.data[SC_STONE].timer != -1 || md->sc.data[SC_FREEZE].timer != -1 //status change check
   	)
 		return 0;
 	
-	if(md->state.steal_flag < battle_config.skill_steal_max_tries)
-		md->state.steal_flag++;
-
 	skill = battle_config.skill_steal_type == 1
 		? (sd->paramc[4] - md->db->dex)/2 + pc_checkskill(sd,TF_STEAL)*6 + 10
 		: sd->paramc[4] - md->db->dex + pc_checkskill(sd,TF_STEAL)*3 + 10;
@@ -2946,10 +2942,12 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
 	if (skill < 1)
 		return 0;
 
+	if(md->state.steal_flag < battle_config.skill_steal_max_tries)
+		md->state.steal_flag++; //increase steal tries number
+
 	for(i = 0; i<MAX_MOB_DROP; i++)//Pick one mobs drop slot.
 	{
 		itemid = md->db->dropitem[i].nameid;
-
 		if(itemid <= 0 || (itemid>4000 && itemid<5000 && pc_checkskill(sd,TF_STEAL) <= 5))
 			continue;
 		if(rand() % 10000 > ((md->db->dropitem[i].p * skill) / 100 + sd->add_steal_rate))
@@ -2958,6 +2956,8 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
 	if (i == MAX_MOB_DROP)
 		return 0;
 
+	md->state.steal_flag = 255; //you can't steal from this mob any more
+	
 	memset(&tmp_item,0,sizeof(tmp_item));
 	tmp_item.nameid = itemid;
 	tmp_item.amount = 1;
@@ -2995,7 +2995,6 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
 	}
 	return 1;
 }
-
 /*==========================================
  *
  *------------------------------------------