- Added constant MAX_MOB_DROP to specify the amount of normal drops a mob has. The mob_db reading code will automatically parse the file according to the number of drops expected (the Mexp/Mper and MVP item rewards must still be after the normal drops). Set to 10 currently.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@6347 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
skotlex 2006-04-28 15:53:03 +00:00
parent 1b38364cab
commit f8db64c952
5 changed files with 29 additions and 19 deletions

View File

@ -3,6 +3,10 @@ Date Added
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/04/28
* Added constant MAX_MOB_DROP to specify the amount of normal drops a mob
has. The mob_db reading code will automatically parse the file according to
the number of drops expected (the Mexp/Mper and MVP item rewards must still
be after the normal drops). Set to 10 currently. [Skotlex]
* Mobinfo's drop list will use jName rather than Name for drop names.
[Skotlex]
* Some cleaning of the ASC_BREAKER code in skill_attack [Skotlex]

View File

@ -9370,7 +9370,7 @@ int atcommand_mobinfo(
clif_displaymessage(fd, " Drops:");
strcpy(atcmd_output, " ");
j = 0;
for (i = 0; i < 10; i++) {
for (i = 0; i < MAX_MOB_DROP; i++) {
if (mob->dropitem[i].nameid <= 0 || (item_data = itemdb_search(mob->dropitem[i].nameid)) == NULL)
continue;
if (mob->dropitem[i].p > 0) {

View File

@ -1940,7 +1940,7 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
)))
; //No normal loot.
else
for (i = 0; i < 10; i++) { // 8 -> 10 Lupus
for (i = 0; i < MAX_MOB_DROP; i++) {
if (md->db->dropitem[i].nameid <= 0)
continue;
drop_rate = md->db->dropitem[i].p;
@ -3171,18 +3171,19 @@ static int mob_readdb(void)
mob_db_data[class_]->amotion=atoi(str[28]);
mob_db_data[class_]->dmotion=atoi(str[29]);
for(i=0;i<10;i++){ // 8 -> 10 Lupus
for(i=0;i<MAX_MOB_DROP;i++){
int rate = 0,rate_adjust,type;
unsigned short ratemin,ratemax;
struct item_data *id;
mob_db_data[class_]->dropitem[i].nameid=atoi(str[30+i*2]);
k=30+i*2;
mob_db_data[class_]->dropitem[i].nameid=atoi(str[k]);
if (!mob_db_data[class_]->dropitem[i].nameid) {
//No drop.
mob_db_data[class_]->dropitem[i].p = 0;
continue;
}
type = itemdb_type(mob_db_data[class_]->dropitem[i].nameid);
rate = atoi(str[31+i*2]);
rate = atoi(str[k+1]);
if (class_ >= 1324 && class_ <= 1363)
{ //Treasure box drop rates [Skotlex]
rate_adjust = battle_config.item_rate_treasure;
@ -3240,9 +3241,11 @@ static int mob_readdb(void)
id->mob[k].id = class_;
}
}
//Since MAX_MOB_DROP can change, we use k as base for the rest of fields. [Skotlex]
k=30+i*2;
// MVP EXP Bonus, Chance: MEXP,ExpPer
mob_db_data[class_]->mexp=atoi(str[50])*battle_config.mvp_exp_rate/100;
mob_db_data[class_]->mexpper=atoi(str[51]);
mob_db_data[class_]->mexp=atoi(str[k])*battle_config.mvp_exp_rate/100;
mob_db_data[class_]->mexpper=atoi(str[k+1]);
//Now that we know if it is an mvp or not,
//apply battle_config modifiers [Skotlex]
maxhp = (double)mob_db_data[class_]->max_hp;
@ -3259,13 +3262,13 @@ static int mob_readdb(void)
// MVP Drops: MVP1id,MVP1per,MVP2id,MVP2per,MVP3id,MVP3per
for(i=0;i<3;i++){
struct item_data *id;
mob_db_data[class_]->mvpitem[i].nameid=atoi(str[52+i*2]);
mob_db_data[class_]->mvpitem[i].nameid=atoi(str[k+2+i*2]);
if (!mob_db_data[class_]->mvpitem[i].nameid) {
//No item....
mob_db_data[class_]->mvpitem[i].p = 0;
continue;
}
mob_db_data[class_]->mvpitem[i].p= mob_drop_adjust(atoi(str[53+i*2]), battle_config.item_rate_mvp,
mob_db_data[class_]->mvpitem[i].p= mob_drop_adjust(atoi(str[k+3+i*2]), battle_config.item_rate_mvp,
battle_config.item_drop_mvp_min, battle_config.item_drop_mvp_max);
//calculate and store Max available drop chance of the MVP item
@ -3798,18 +3801,19 @@ static int mob_read_sqldb(void)
mob_db_data[class_]->amotion = TO_INT(28);
mob_db_data[class_]->dmotion = TO_INT(29);
for (i = 0; i < 10; i++){ // 8 -> 10 Lupus
for (i = 0; i < MAX_MOB_DROP; i++){ // 8 -> 10 Lupus
int rate = 0, rate_adjust, type;
unsigned short ratemin, ratemax;
struct item_data *id;
mob_db_data[class_]->dropitem[i].nameid=TO_INT(30+i*2);
k=30+i*2;
mob_db_data[class_]->dropitem[i].nameid=TO_INT(k);
if (!mob_db_data[class_]->dropitem[i].nameid) {
//No drop.
mob_db_data[class_]->dropitem[i].p = 0;
continue;
}
type = itemdb_type(mob_db_data[class_]->dropitem[i].nameid);
rate = TO_INT(31+i*2);
rate = TO_INT(k+1);
if (class_ >= 1324 && class_ <= 1363)
{ //Treasure box drop rates [Skotlex]
rate_adjust = battle_config.item_rate_treasure;
@ -3867,9 +3871,10 @@ static int mob_read_sqldb(void)
id->mob[k].id = class_;
}
}
k=30+i*2;
// MVP EXP Bonus, Chance: MEXP,ExpPer
mob_db_data[class_]->mexp = TO_INT(50) * battle_config.mvp_exp_rate / 100;
mob_db_data[class_]->mexpper = TO_INT(51);
mob_db_data[class_]->mexp = TO_INT(k) * battle_config.mvp_exp_rate / 100;
mob_db_data[class_]->mexpper = TO_INT(k+1);
//Now that we know if it is an mvp or not,
//apply battle_config modifiers [Skotlex]
maxhp = (double)mob_db_data[class_]->max_hp;
@ -3886,13 +3891,13 @@ static int mob_read_sqldb(void)
// MVP Drops: MVP1id,MVP1per,MVP2id,MVP2per,MVP3id,MVP3per
for (i=0; i<3; i++) {
struct item_data *id;
mob_db_data[class_]->mvpitem[i].nameid = TO_INT(52+i*2);
mob_db_data[class_]->mvpitem[i].nameid = TO_INT(k+2+i*2);
if (!mob_db_data[class_]->mvpitem[i].nameid) {
//No item....
mob_db_data[class_]->mvpitem[i].p = 0;
continue;
}
mob_db_data[class_]->mvpitem[i].p = mob_drop_adjust(TO_INT(53+i*2),
mob_db_data[class_]->mvpitem[i].p = mob_drop_adjust(TO_INT(k+3+i*2),
battle_config.item_rate_mvp, battle_config.item_drop_mvp_min, battle_config.item_drop_mvp_max);
//calculate and store Max available drop chance of the MVP item

View File

@ -10,6 +10,7 @@
#define MAX_RANDOMMONSTER 3
#define MAX_MOB_RACE_DB 6
#define MAX_MOB_DB 10000
#define MAX_MOB_DROP 10
/* Change this to increase the table size in your mob_db to accomodate
a larger mob database. Be sure to note that IDs 4001 to 4048 are reserved for advanced/baby/expanded classes.
*/
@ -46,7 +47,7 @@ struct mob_db {
short race2; // celest
int speed,adelay,amotion,dmotion;
int mexp,mexpper;
struct { int nameid,p; } dropitem[10]; //8 -> 10 Lupus
struct { int nameid,p; } dropitem[MAX_MOB_DROP];
struct { int nameid,p; } mvpitem[3];
struct view_data vd;
short option;

View File

@ -2938,12 +2938,12 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
if (skill < 1)
return 0;
j = i = rand()%10; //Pick one mobs drop slot.
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=9; //9th slot
i=MAX_MOB_DROP-1;
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))