From 35c7324f5f2f1a5f1dc4fa690020fcbd0c18d891 Mon Sep 17 00:00:00 2001 From: Lupus Date: Tue, 15 Feb 2005 19:30:58 +0000 Subject: fixed spawn of treasure boxes fixed present_log Mobs drops: expanded 8 slots into 10 (except READING info from TXT / SQL dbs. But added a plug - to make eA work with old DBs) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1115 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/atcommand.c | 2 +- src/map/log.c | 1 + src/map/mob.c | 35 ++++++++++++++++++++++++++--------- src/map/mob.h | 2 +- src/map/pc.c | 4 ++-- src/map/script.c | 10 +++++----- 6 files changed, 36 insertions(+), 18 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 90db2f5c3..12e6c2306 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -8994,7 +8994,7 @@ int atcommand_mobinfo( } strcpy(output," Drops:"); j=0; - for (i=0; i<8; i++) { + for (i=0; i<10; i++) { // 8 -> 10 Lupus if ( mob_db[mob_id].dropitem[i].nameid<=0 || mob_db[mob_id].dropitem[i].p<=0) continue; if( (item_data = itemdb_search(mob_db[mob_id].dropitem[i].nameid)) == NULL) diff --git a/src/map/log.c b/src/map/log.c index 440dc40f8..5b0ff78de 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -48,6 +48,7 @@ int log_drop(struct map_session_data *sd, int monster_id, int *log_drop) #ifndef TXT_ONLY if(log_config.sql_logs > 0) { + //TODO: Expand 8 slots into 10 sprintf(tmp_sql, "INSERT DELAYED INTO `%s` (`drop_date`, `kill_char_id`, `monster_id`, `item1`, `item2`, `item3`, `item4`, `item5`, `item6`, `item7`, `item8`, `map`) VALUES (NOW(), '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%s') ", log_config.log_drop_db, sd->status.char_id, monster_id, log_drop[0], log_drop[1], log_drop[2], log_drop[3], log_drop[4], log_drop[5], log_drop[6], log_drop[7], sd->mapname); if(mysql_query(&mmysql_handle, tmp_sql)) printf("DB server Error - %s\n",mysql_error(&mmysql_handle)); diff --git a/src/map/mob.c b/src/map/mob.c index f0a3edd63..15f06f940 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2531,9 +2531,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) // item drop if(!(type&1)) { - int log_item[8] = {0}; + int log_item[10] = {0}; //8 -> 10 Lupus int drop_ore = -1,drop_items=0; //slot N for DROP LOG, number of dropped items - for(i=0;i<8;i++){ + for(i=0;i<10;i++){ // 8 -> 10 Lupus struct delay_item_drop *ditem; int drop_rate; @@ -2552,7 +2552,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) drop_ore = i; //we rmember an empty slot to put there ORE DISCOVERY drop later. continue; } - drop_items++; + drop_items++; //we cound if there were any drops ditem=(struct delay_item_drop *)aCalloc(1,sizeof(struct delay_item_drop)); ditem->nameid = mob_db[md->class_].dropitem[i].nameid; @@ -2573,8 +2573,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) int itemid[17] = { 714, 756, 757, 969, 984, 985, 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, 1002 }; ditem=(struct delay_item_drop *)aCalloc(1,sizeof(struct delay_item_drop)); ditem->nameid = itemid[rand()%17]; //should return from 0 to 16 - if (drop_ore<0) i=7; //we have only 8 slots in LOG, there's a check to not overflow + if (drop_ore<0) i=7; //we have only 10 slots in LOG, there's a check to not overflow <- TODO: change 7 to 9 log_item[i] = ditem->nameid; //it's for logging only + drop_items++; //we cound if there were any drops ditem->amount = 1; ditem->m = md->bl.m; ditem->x = md->bl.x; @@ -3836,9 +3837,9 @@ static int mob_makedummymobdb(int class_) mob_db[class_].adelay=1000; mob_db[class_].amotion=500; mob_db[class_].dmotion=500; - mob_db[class_].dropitem[0].nameid=909; // Jellopy - mob_db[class_].dropitem[0].p=1000; - for(i=1;i<8;i++){ + //mob_db[class_].dropitem[0].nameid=909; // Jellopy + //mob_db[class_].dropitem[0].p=1000; + for(i=1;i<10;i++){ // 8-> 10 Lupus mob_db[class_].dropitem[i].nameid=0; mob_db[class_].dropitem[i].p=0; } @@ -3942,7 +3943,7 @@ static int mob_readdb(void) mob_db[class_].amotion=atoi(str[27]); mob_db[class_].dmotion=atoi(str[28]); - for(i=0;i<8;i++){ + for(i=0;i<8;i++){ // TODO: 8 -> 10 Lupus int rate = 0,type,ratemin,ratemax; mob_db[class_].dropitem[i].nameid=atoi(str[29+i*2]); type = itemdb_type(mob_db[class_].dropitem[i].nameid); @@ -4014,6 +4015,15 @@ static int mob_readdb(void) rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate; mob_db[class_].dropitem[i].p = rate; } + //TEMP PLUG till we expand TXT DB and SQL DBs [Lupus] + for(i=8;i<10;i++){ //TODO: 8 -> 10 Lupus + //we fill 9th and 10th DROP slots with 0 + mob_db[class_].dropitem[i].nameid = mob_db[class_].dropitem[i].p = 0; + } + //END of temp plug + + //TODO: Shift columns (after adding 2 drops (4 coulmns)) Lupus + // Item1,Item2 mob_db[class_].mexp=atoi(str[45])*battle_config.mvp_exp_rate/100; mob_db[class_].mexpper=atoi(str[46]); @@ -4409,7 +4419,7 @@ static int mob_read_sqldb(void) mob_db[class_].amotion=atoi(str[27]); mob_db[class_].dmotion=atoi(str[28]); - for(i=0;i<8;i++){ + for(i=0;i<8;i++){ //TODO: 8 -> 10 Lupus int rate = 0,type,ratemin,ratemax; mob_db[class_].dropitem[i].nameid=atoi(str[29+i*2]); type = itemdb_type(mob_db[class_].dropitem[i].nameid); @@ -4442,7 +4452,14 @@ static int mob_read_sqldb(void) rate = (rate < ratemin)? ratemin: (rate > ratemax)? ratemax: rate; mob_db[class_].dropitem[i].p = rate; } + //TEMP PLUG till we expand TXT DB and SQL DBs [Lupus] + for(i=8;i<10;i++){ //TODO: 8 -> 10 Lupus + //we fill 9th and 10th DROP slots with 0 + mob_db[class_].dropitem[i].nameid = mob_db[class_].dropitem[i].p = 0; + } + //END of temp plug + //TODO: Shift columns (after adding 2 drops (4 coulmns)) Lupus mob_db[class_].mexp=atoi(str[45])*battle_config.mvp_exp_rate/100; mob_db[class_].mexpper=atoi(str[46]); for(i=0;i<3;i++){ diff --git a/src/map/mob.h b/src/map/mob.h index 0f65b1404..103335365 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -28,7 +28,7 @@ struct mob_db { int size,race,element,mode; int speed,adelay,amotion,dmotion; int mexp,mexpper; - struct { int nameid,p; } dropitem[8]; + struct { int nameid,p; } dropitem[10]; //8 -> 10 Lupus struct { int nameid,p; } mvpitem[3]; int view_class,sex; short hair,hair_color,weapon,shield,head_top,head_mid,head_buttom,option,clothes_color; // [Valaris] diff --git a/src/map/pc.c b/src/map/pc.c index 80d15187d..8cfebbaf2 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2614,9 +2614,9 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl) if(0 < skill) { - for(count = 8; count <= 8 && count != 0; count--) + for(count = 10; count <= 10 && count != 0; count--) //8 -> 10 Lupus { - i = rand()%8; + i = rand()%10; //8 -> 10 Lupus itemid = mob_db[md->class_].dropitem[i].nameid; if(itemid > 0 && itemdb_type(itemid) != 6) diff --git a/src/map/script.c b/src/map/script.c index da7891924..6daa1340a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -2302,7 +2302,7 @@ int buildin_checkweight(struct script_state *st) */ int buildin_getitem(struct script_state *st) { - int nameid,amount,flag = 0; + int nameid,nameidsrc,amount,flag = 0; struct item item_tmp; struct map_session_data *sd; struct script_data *data; @@ -2324,12 +2324,12 @@ int buildin_getitem(struct script_state *st) return 0; //return if amount <=0, skip the useles iteration } //Violet Box, Blue Box, etc - random item pick - if(nameid<0) { // ƒ‰ƒ“ƒ_ƒ€ + if((nameidsrc = nameid)<0) { // Save real ID of the source Box [Lupus] nameid=itemdb_searchrandomid(-nameid); - #ifndef TXT_ONLY + if(log_config.present > 0) - log_present(sd, -nameid, nameid); - #endif //USE_SQL + log_present(sd, -nameidsrc, nameid); //fixed missing ID by Lupus + flag = 1; } -- cgit v1.2.3-70-g09d2