summaryrefslogtreecommitdiff
path: root/src/map/mob.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-08 16:03:28 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-08 16:03:28 +0000
commitfdc56c485b839f78ae7d777f8a6e745825a8bc3d (patch)
treed5ce890bfabcc8e116fe058fc74e8bd017ef88f5 /src/map/mob.c
parent9ee5081a5ef7b8aa20cfdd992cad280665b5ed7f (diff)
downloadhercules-fdc56c485b839f78ae7d777f8a6e745825a8bc3d.tar.gz
hercules-fdc56c485b839f78ae7d777f8a6e745825a8bc3d.tar.bz2
hercules-fdc56c485b839f78ae7d777f8a6e745825a8bc3d.tar.xz
hercules-fdc56c485b839f78ae7d777f8a6e745825a8bc3d.zip
- Items now store the top MAX_SEARCH drops from mobs and lists them through the new atcommand @whodrops. All merged from my server, of course =D
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5515 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r--src/map/mob.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index c17079add..3995eba31 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -4296,7 +4296,7 @@ static int mob_readdb(void)
FILE *fp;
char line[1024];
char *filename[]={ "mob_db.txt","mob_db2.txt" };
- int class_, i, fi;
+ int class_, i, fi, k;
for(fi=0;fi<2;fi++){
sprintf(line, "%s/%s", db_path, filename[fi]);
@@ -4433,12 +4433,22 @@ static int mob_readdb(void)
mob_db_data[class_]->dropitem[i].p = mob_drop_adjust(rate, rate_adjust, ratemin, ratemax);
//calculate and store Max available drop chance of the item
- id = itemdb_search(mob_db_data[class_]->dropitem[i].nameid);
if (mob_db_data[class_]->dropitem[i].p) {
+ id = itemdb_search(mob_db_data[class_]->dropitem[i].nameid);
if (id->maxchance==10000 || (id->maxchance < mob_db_data[class_]->dropitem[i].p) ) {
//item has bigger drop chance or sold in shops
id->maxchance = mob_db_data[class_]->dropitem[i].p;
- }
+ }
+ for (k = 0; k< MAX_SEARCH; k++) {
+ if (id->mob[k].chance < mob_db_data[class_]->dropitem[i].p && id->mob[k].id != class_)
+ break;
+ }
+ if (k == MAX_SEARCH)
+ continue;
+
+ memmove(&id->mob[k+1], &id->mob[k], (MAX_SEARCH-k-1)*sizeof(id->mob[0]));
+ id->mob[k].chance = mob_db_data[class_]->dropitem[i].p;
+ id->mob[k].id = class_;
}
}
// MVP EXP Bonus, Chance: MEXP,ExpPer
@@ -4470,8 +4480,8 @@ static int mob_readdb(void)
battle_config.item_drop_mvp_min, battle_config.item_drop_mvp_max);
//calculate and store Max available drop chance of the MVP item
- id = itemdb_search(mob_db_data[class_]->mvpitem[i].nameid);
if (mob_db_data[class_]->mvpitem[i].p) {
+ id = itemdb_search(mob_db_data[class_]->mvpitem[i].nameid);
if (id->maxchance==10000 || (id->maxchance < mob_db_data[class_]->mvpitem[i].p/10+1) ) {
//item has bigger drop chance or sold in shops
id->maxchance = mob_db_data[class_]->mvpitem[i].p/10+1; //reduce MVP drop info to not spoil common drop rate
@@ -4910,7 +4920,7 @@ static int mob_readdb_race(void)
static int mob_read_sqldb(void)
{
const char unknown_str[NAME_LENGTH] ="unknown";
- int i, fi, class_;
+ int i, fi, class_, k;
double exp, maxhp;
long unsigned int ln = 0;
char *mob_db_name[] = { mob_db_db, mob_db2_db };
@@ -5039,12 +5049,22 @@ static int mob_read_sqldb(void)
mob_db_data[class_]->dropitem[i].p = mob_drop_adjust(rate, rate_adjust, ratemin, ratemax);
//calculate and store Max available drop chance of the item
- id = itemdb_search(mob_db_data[class_]->dropitem[i].nameid);
if (mob_db_data[class_]->dropitem[i].p) {
+ id = itemdb_search(mob_db_data[class_]->dropitem[i].nameid);
if (id->maxchance==10000 || (id->maxchance < mob_db_data[class_]->dropitem[i].p) ) {
//item has bigger drop chance or sold in shops
id->maxchance = mob_db_data[class_]->dropitem[i].p;
}
+ for (k = 0; k< MAX_SEARCH; k++) {
+ if (id->mob[k].chance < mob_db_data[class_]->dropitem[i].p && id->mob[k].id != class_)
+ break;
+ }
+ if (k == MAX_SEARCH)
+ continue;
+
+ memmove(&id->mob[k+1], &id->mob[k], (MAX_SEARCH-k-1)*sizeof(id->mob[0]));
+ id->mob[k].chance = mob_db_data[class_]->dropitem[i].p;
+ id->mob[k].id = class_;
}
}
// MVP EXP Bonus, Chance: MEXP,ExpPer