summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-29 11:16:21 +0000
committerLupus <Lupus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-29 11:16:21 +0000
commit35b1cc992905844a59757bed76512ef7fe769d5a (patch)
tree81a698a6a5b1a3f5d3ecc3102b5f79a40f0caae1 /src/map/pc.c
parent90c05f50a7ab6140cd1c95b005c4e5456fc42bf2 (diff)
downloadhercules-35b1cc992905844a59757bed76512ef7fe769d5a.tar.gz
hercules-35b1cc992905844a59757bed76512ef7fe769d5a.tar.bz2
hercules-35b1cc992905844a59757bed76512ef7fe769d5a.tar.xz
hercules-35b1cc992905844a59757bed76512ef7fe769d5a.zip
Updated STEAL skill (WIP), added a battle config option: 'skill_steal_max_tries' to set max number of stealing tries. It could help to fix stealing exploit on mobs with few drops
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6367 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 81a687f06..90f3fa001 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2928,11 +2928,12 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
md=(struct mob_data *)bl;
- if(md->state.steal_flag || 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;
skill = battle_config.skill_steal_type == 1
@@ -2942,24 +2943,21 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
if (skill < 1)
return 0;
- j = i = rand()%MAX_MOB_DROP; //Pick one mobs drop slot.
- do {
- //if it's empty, we check one by one, till find an item
- i--;
- if(i<0)
- i=MAX_MOB_DROP-1;
+ for(i = 0; i<MAX_MOB_DROP; i++)//Pick one mobs drop slot.
+ {
itemid = md->db->dropitem[i].nameid;
- //now try all 10 slots till success
- if(itemid <= 0 || (itemdb_type(itemid) == 6 && pc_checkskill(sd,TF_STEAL) <= 5))
- continue;
- } while (i != j &&
- rand() % 10000 > ((md->db->dropitem[i].p * skill) / 100 + sd->add_steal_rate)); //fixed rate. From Freya [Lupus]
- if (i == j)
+ 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))
+ break;
+ }
+ if (i == MAX_MOB_DROP)
return 0;
- md->state.steal_flag = 1;
-
+ if(md->state.steal_flag < battle_config.skill_steal_max_tries)
+ md->state.steal_flag++;
+
memset(&tmp_item,0,sizeof(tmp_item));
tmp_item.nameid = itemid;
tmp_item.amount = 1;