summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-09-26 22:21:14 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-09-26 22:21:14 +0000
commit5f27a7bab8da0b9257ada110662fdda3d520e135 (patch)
tree9a17986545882c256d3ad8f94650af3cc46e37a3 /src/map
parentbaba5683c591c05219e339e0e82c50aaa83cac96 (diff)
downloadhercules-5f27a7bab8da0b9257ada110662fdda3d520e135.tar.gz
hercules-5f27a7bab8da0b9257ada110662fdda3d520e135.tar.bz2
hercules-5f27a7bab8da0b9257ada110662fdda3d520e135.tar.xz
hercules-5f27a7bab8da0b9257ada110662fdda3d520e135.zip
Fixed bugreport:6544 when mvp drops are at 100% drop rate it'll no longer always drop the first.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16804 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/mob.c89
1 files changed, 52 insertions, 37 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index ca4da158b..c7918ce93 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2467,8 +2467,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
add_timer(tick + (!battle_config.delay_battle_damage?500:0), mob_delay_item_drop, 0, (intptr_t)dlist);
}
- if(mvp_sd && md->db->mexp > 0 && !md->special_state.ai)
- {
+ if(mvp_sd && md->db->mexp > 0 && !md->special_state.ai) {
int log_mvp[2] = {0};
unsigned int mexp;
struct item item;
@@ -2489,46 +2488,62 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
clif_mvp_exp(mvp_sd,mexp);
pc_gainexp(mvp_sd, &md->bl, mexp,0, false);
log_mvp[1] = mexp;
- if(map[m].flag.nomvploot || type&1)
- ; //No drops.
- else
- for(i = 0; i < MAX_MVP_DROP; i++)
- {
- if(md->db->mvpitem[i].nameid <= 0)
- continue;
- if(!itemdb_exists(md->db->mvpitem[i].nameid))
- continue;
+
+ if( !(map[m].flag.nomvploot || type&1) ) {
+ /* pose them randomly in the list -- so on 100% drop servers it wont always drop the same item */
+ int mdrop_id[MAX_MVP_DROP];
+ int mdrop_p[MAX_MVP_DROP];
- temp = md->db->mvpitem[i].p;
- if(temp <= 0 && !battle_config.drop_rate0item)
- temp = 1;
- if(temp <= rnd()%10000+1) //if ==0, then it doesn't drop
- continue;
-
- memset(&item,0,sizeof(item));
- item.nameid=md->db->mvpitem[i].nameid;
- item.identify= itemdb_isidentified(item.nameid);
- clif_mvp_item(mvp_sd,item.nameid);
- log_mvp[0] = item.nameid;
+ memset(&mdrop_id,0,MAX_MVP_DROP*sizeof(int));
- //A Rare MVP Drop Global Announce by Lupus
- if(temp<=battle_config.rare_drop_announce) {
- struct item_data *i_data;
- char message[128];
- i_data = itemdb_exists(item.nameid);
- sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, i_data->jname, temp/100.);
- //MSG: "'%s' won %s's %s (chance: %0.02f%%)"
- intif_broadcast(message,strlen(message)+1,0);
+ for(i = 0; i < MAX_MVP_DROP; i++) {
+ while( 1 ) {
+ int va = rand()%MAX_MVP_DROP;
+ if( !mdrop_id[va] || !md->db->mvpitem[i].nameid ) {
+ mdrop_id[va] = md->db->mvpitem[i].nameid;
+ mdrop_p[va] = md->db->mvpitem[i].p;
+ break;
+ }
+ }
}
+
+ for(i = 0; i < MAX_MVP_DROP; i++) {
+ if(mdrop_id[i] <= 0)
+ continue;
+ if(!itemdb_exists(mdrop_id[i]))
+ continue;
+
+ temp = mdrop_p[i];
+ if(temp <= 0 && !battle_config.drop_rate0item)
+ temp = 1;
+ if(temp <= rnd()%10000+1) //if ==0, then it doesn't drop
+ continue;
- if((temp = pc_additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
- clif_additem(mvp_sd,0,0,temp);
- map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
+ memset(&item,0,sizeof(item));
+ item.nameid=mdrop_id[i];
+ item.identify= itemdb_isidentified(item.nameid);
+ clif_mvp_item(mvp_sd,item.nameid);
+ log_mvp[0] = item.nameid;
+
+ //A Rare MVP Drop Global Announce by Lupus
+ if(temp<=battle_config.rare_drop_announce) {
+ struct item_data *i_data;
+ char message[128];
+ i_data = itemdb_exists(item.nameid);
+ sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, i_data->jname, temp/100.);
+ //MSG: "'%s' won %s's %s (chance: %0.02f%%)"
+ intif_broadcast(message,strlen(message)+1,0);
+ }
+
+ if((temp = pc_additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
+ clif_additem(mvp_sd,0,0,temp);
+ map_addflooritem(&item,1,mvp_sd->bl.m,mvp_sd->bl.x,mvp_sd->bl.y,mvp_sd->status.char_id,(second_sd?second_sd->status.char_id:0),(third_sd?third_sd->status.char_id:0),1);
+ }
+
+ //Logs items, MVP prizes [Lupus]
+ log_pick_mob(md, LOG_TYPE_MVP, -1, &item);
+ break;
}
-
- //Logs items, MVP prizes [Lupus]
- log_pick_mob(md, LOG_TYPE_MVP, -1, &item);
- break;
}
log_mvpdrop(mvp_sd, md->class_, log_mvp);