summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-04 00:03:58 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-01-04 00:03:58 +0000
commitfd34899afa1d00bcfd740e5802c534d282054fbb (patch)
tree965f44cb85ea804a4cd9105087e1958c219f0fcf /src/map/mob.c
parent5f3d3713bc5c916f6d36416680a0da22b3beb26f (diff)
downloadhercules-fd34899afa1d00bcfd740e5802c534d282054fbb.tar.gz
hercules-fd34899afa1d00bcfd740e5802c534d282054fbb.tar.bz2
hercules-fd34899afa1d00bcfd740e5802c534d282054fbb.tar.xz
hercules-fd34899afa1d00bcfd740e5802c534d282054fbb.zip
Mobs may now drop pet eggs, bugreport:2968
Also did a small performance improvement at lupus' rare drop announce thing which happened to be just near where i was editing. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15373 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index fc8aaec56..b6e8ea697 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2185,6 +2185,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
{ // Item Drop
struct item_drop_list *dlist = ers_alloc(item_drop_list_ers, struct item_drop_list);
struct item_drop *ditem;
+ struct item_data* it = NULL;
int drop_rate;
#if REMODE
int drop_modifier = mvp_sd ? party_renewal_drop_mod(mvp_sd->status.base_level - md->level) :
@@ -2203,7 +2204,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
{
if (md->db->dropitem[i].nameid <= 0)
continue;
- if (!itemdb_exists(md->db->dropitem[i].nameid))
+ if ( !(it = itemdb_exists(md->db->dropitem[i].nameid)) )
continue;
drop_rate = md->db->dropitem[i].p;
if (drop_rate <= 0) {
@@ -2240,15 +2241,17 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
if (rand() % 10000 >= drop_rate)
continue;
+ if( mvp_sd && it->type == IT_PETEGG ) {
+ pet_create_egg(mvp_sd, md->db->dropitem[i].nameid);
+ continue;
+ }
+
ditem = mob_setdropitem(md->db->dropitem[i].nameid, 1);
//A Rare Drop Global Announce by Lupus
- if( mvp_sd && drop_rate <= battle_config.rare_drop_announce )
- {
- struct item_data *i_data;
+ if( mvp_sd && drop_rate <= battle_config.rare_drop_announce ) {
char message[128];
- i_data = itemdb_search(ditem->item_data.nameid);
- sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, i_data->jname, (float)drop_rate/100);
+ sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, it->jname, (float)drop_rate/100);
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
intif_broadcast(message,strlen(message)+1,0);
}