summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-15 14:58:04 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-15 14:58:04 +0000
commitee8093a79840edc7169291ca69ac3d256190fc83 (patch)
tree2a569814a328e229bfaa4f72ea38e5bc3b11c80f /src
parent98f7e84cd7692c8cc982ea15ce26c4d546e705b5 (diff)
downloadhercules-ee8093a79840edc7169291ca69ac3d256190fc83.tar.gz
hercules-ee8093a79840edc7169291ca69ac3d256190fc83.tar.bz2
hercules-ee8093a79840edc7169291ca69ac3d256190fc83.tar.xz
hercules-ee8093a79840edc7169291ca69ac3d256190fc83.zip
- Added battle config options item_rate_adddrop, item_drop_add_min and item_drop_add_max to control drop rate of card-acquired loot bonuses.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5610 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c6
-rw-r--r--src/map/battle.h5
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/mob.c7
-rw-r--r--src/map/pc.c130
5 files changed, 74 insertions, 76 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index ae0c1da54..94ce76a6b 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -3929,6 +3929,8 @@ static const struct battle_data_short {
{ "item_drop_heal_max", &battle_config.item_drop_heal_max },
{ "item_drop_use_min", &battle_config.item_drop_use_min },
{ "item_drop_use_max", &battle_config.item_drop_use_max },
+ { "item_drop_add_min", &battle_config.item_drop_adddrop_min },
+ { "item_drop_add_max", &battle_config.item_drop_adddrop_max },
{ "item_drop_treasure_min", &battle_config.item_drop_treasure_min },
{ "item_drop_treasure_max", &battle_config.item_drop_treasure_max },
{ "prevent_logout", &battle_config.prevent_logout }, // Added by RoVeRT
@@ -4054,6 +4056,7 @@ static const struct battle_data_int {
{ "item_rate_card", &battle_config.item_rate_card }, // End Addition
{ "item_rate_heal", &battle_config.item_rate_heal }, // Added by Valaris
{ "item_rate_use", &battle_config.item_rate_use }, // End
+ { "item_rate_adddrop", &battle_config.item_rate_adddrop }, // End
{ "item_rate_treasure", &battle_config.item_rate_treasure }, // End
{ "day_duration", &battle_config.day_duration }, // added by [Yor]
{ "night_duration", &battle_config.night_duration }, // added by [Yor]
@@ -4315,6 +4318,7 @@ void battle_set_defaults() {
battle_config.item_rate_card = 100;
battle_config.item_rate_heal = 100; // Added by Valaris
battle_config.item_rate_use = 100; // End
+ battle_config.item_rate_adddrop = 100;
battle_config.item_rate_treasure = 100;
battle_config.logarithmic_drops = 0;
battle_config.item_drop_common_min=1; // Added by TyrNemesis^
@@ -4329,6 +4333,8 @@ void battle_set_defaults() {
battle_config.item_drop_heal_max=10000;
battle_config.item_drop_use_min=1;
battle_config.item_drop_use_max=10000; // End
+ battle_config.item_drop_adddrop_min=1;
+ battle_config.item_drop_adddrop_max=10000;
battle_config.item_drop_treasure_min=1;
battle_config.item_drop_treasure_max=10000;
battle_config.prevent_logout = 10000; // Added by RoVeRT
diff --git a/src/map/battle.h b/src/map/battle.h
index 3746ea7b1..6ad232e37 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -284,7 +284,8 @@ extern struct Battle_Config {
unsigned short mob_ghostring_fix;
unsigned short pc_attack_attr_none;
int item_rate_mvp, item_rate_common,item_rate_card,item_rate_equip,
- item_rate_heal, item_rate_use, item_rate_treasure; // Added by RoVeRT, Additional Heal and Usable item rate by Val
+ item_rate_heal, item_rate_use, item_rate_treasure, // Added by RoVeRT, Additional Heal and Usable item rate by Val
+ item_rate_adddrop;
unsigned short logarithmic_drops;
unsigned short item_drop_common_min,item_drop_common_max; // Added by TyrNemesis^
@@ -294,7 +295,7 @@ extern struct Battle_Config {
unsigned short item_drop_heal_min,item_drop_heal_max; // Added by Valatris
unsigned short item_drop_use_min,item_drop_use_max; //End
unsigned short item_drop_treasure_min,item_drop_treasure_max; //by [Skotlex]
-
+ unsigned short item_drop_adddrop_min,item_drop_adddrop_max; //[Skotlex]
unsigned short prevent_logout; // Added by RoVeRT
unsigned short alchemist_summon_reward; // [Valaris]
diff --git a/src/map/map.h b/src/map/map.h
index 44c879c6e..cb82be8a8 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -591,7 +591,7 @@ struct map_session_data {
short class_, rate;
} add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS],
add_dmg[MAX_PC_BONUS], add_mdmg[MAX_PC_BONUS];
- struct {
+ struct s_add_drop {
short id, group;
int race, rate;
} add_drop[MAX_PC_BONUS];
diff --git a/src/map/mob.c b/src/map/mob.c
index 6813d760e..911841cb1 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -2712,10 +2712,15 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type)
sd->add_drop[i].race & 1<<(mode&MD_BOSS?10:11))
{
//check if the bonus item drop rate should be multiplied with mob level/10 [Lupus]
- if(sd->add_drop[i].rate<0)
+ if(sd->add_drop[i].rate<0) {
//it's negative, then it should be multiplied. e.g. for Mimic,Myst Case Cards, etc
// rate = base_rate * (mob_level/10) + 1
drop_rate = -sd->add_drop[i].rate*(md->level/10)+1;
+ if (drop_rate < battle_config.item_drop_adddrop_min)
+ drop_rate = battle_config.item_drop_adddrop_min;
+ else if (drop_rate > battle_config.item_drop_adddrop_max)
+ drop_rate = battle_config.item_drop_adddrop_max;
+ }
else
//it's positive, then it goes as it is
drop_rate = sd->add_drop[i].rate;
diff --git a/src/map/pc.c b/src/map/pc.c
index fe2783272..a467f3607 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1164,6 +1164,56 @@ static int pc_bonus_autospell(struct s_autospell *spell, int max, short id, shor
spell[i].card_id = card_id;
return 1;
}
+
+static int pc_bonus_item_drop(struct s_add_drop *drop, short *count, short id, short group, int race, int rate) {
+ int i;
+ //Apply config rate adjustment settings.
+ if (rate >= 0) { //Absolute drop.
+ if (battle_config.item_rate_adddrop != 100)
+ rate = rate*battle_config.item_rate_adddrop/100;
+ if (rate < battle_config.item_drop_adddrop_min)
+ rate = battle_config.item_drop_adddrop_min;
+ else if (rate > battle_config.item_drop_adddrop_max)
+ rate = battle_config.item_drop_adddrop_max;
+ } else { //Relative drop, max/min limits are applied at drop time.
+ if (battle_config.item_rate_adddrop != 100)
+ rate = rate*battle_config.item_rate_adddrop/100;
+ if (rate > -1)
+ rate = -1;
+ }
+ for(i = 0; i < *count; i++) {
+ if(
+ (id && drop[i].id == id) ||
+ (group && drop[i].group == group)
+ ) {
+ drop[i].race |= race;
+ if(drop[i].rate > 0 && rate > 0)
+ { //Both are absolute rates.
+ if (drop[i].rate < rate)
+ drop[i].rate = rate;
+ } else
+ if(drop[i].rate < 0 && rate < 0) {
+ //Both are relative rates.
+ if (drop[i].rate > rate)
+ drop[i].rate = rate;
+ } else if (rate < 0) //Give preference to relative rate.
+ drop[i].rate = rate;
+ return 1;
+ }
+ }
+ if(*count >= MAX_PC_BONUS) {
+ if (battle_config.error_log)
+ ShowWarning("pc_bonus: Reached max (%d) number of added drops per character!\n", MAX_PC_BONUS);
+ return 0;
+ }
+ drop[*count].id = id;
+ drop[*count].group = group;
+ drop[*count].race |= race;
+ drop[*count].rate = rate;
+ (*count)++;
+ return 1;
+}
+
/*==========================================
* ? 備品による能力等のボ?ナス設定
*------------------------------------------
@@ -2003,44 +2053,12 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
sd->sp_gain_race[type2]+=val;
break;
case SP_ADD_MONSTER_DROP_ITEM:
- if (sd->state.lr_flag != 2) {
- for(i = 0; i < sd->add_drop_count; i++) {
- if(sd->add_drop[i].id == type2) {
- sd->add_drop[i].race |= (1<<10)|(1<<11);
- if(sd->add_drop[i].rate < val)
- sd->add_drop[i].rate = val;
- break;
- }
- }
- if(i >= sd->add_drop_count && sd->add_drop_count < MAX_PC_BONUS) {
- sd->add_drop[sd->add_drop_count].id = type2;
- // all monsters, including boss and non boss monsters
- sd->add_drop[sd->add_drop_count].race |= (1<<10)|(1<<11);
- sd->add_drop[sd->add_drop_count].rate = val;
- sd->add_drop_count++;
- }
- }
+ if (sd->state.lr_flag != 2)
+ pc_bonus_item_drop(sd->add_drop, &sd->add_drop_count, type2, 0, (1<<10)|(1<<11), val);
break;
case SP_ADD_MONSTER_DROP_ITEMGROUP:
- if (sd->state.lr_flag != 2) {
- for(i = 0; i < sd->add_drop_count; i++) {
- if(sd->add_drop[i].group == type2) {
- sd->add_drop[i].id = 0;
- sd->add_drop[i].race |= (1<<10)|(1<<11);
- if(sd->add_drop[i].rate < val)
- sd->add_drop[i].rate = val;
- break;
- }
- }
- if(i >= sd->add_drop_count && sd->add_drop_count < MAX_PC_BONUS) {
- sd->add_drop[sd->add_drop_count].group = type2;
- sd->add_drop[sd->add_drop_count].id = 0;
- // all monsters, including boss and non boss monsters
- sd->add_drop[sd->add_drop_count].race |= (1<<10)|(1<<11);
- sd->add_drop[sd->add_drop_count].rate = val;
- sd->add_drop_count++;
- }
- }
+ if (sd->state.lr_flag != 2)
+ pc_bonus_item_drop(sd->add_drop, &sd->add_drop_count, 0, type2, (1<<10)|(1<<11), val);
break;
case SP_SP_LOSS_RATE:
if(sd->state.lr_flag != 2) {
@@ -2059,27 +2077,12 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
{
- int i;
nullpo_retr(0, sd);
switch(type){
case SP_ADD_MONSTER_DROP_ITEM:
- if(sd->state.lr_flag != 2) {
- for(i=0;i<sd->add_drop_count;i++) {
- if(sd->add_drop[i].id == type2) {
- sd->add_drop[i].race |= 1<<type3;
- if(sd->add_drop[i].rate < val)
- sd->add_drop[i].rate = val;
- break;
- }
- }
- if(i >= sd->add_drop_count && sd->add_drop_count < MAX_PC_BONUS) {
- sd->add_drop[sd->add_drop_count].id = type2;
- sd->add_drop[sd->add_drop_count].race |= 1<<type3;
- sd->add_drop[sd->add_drop_count].rate = val;
- sd->add_drop_count++;
- }
- }
+ if(sd->state.lr_flag != 2)
+ pc_bonus_item_drop(sd->add_drop, &sd->add_drop_count, type2, 0, 1<<type3, val);
break;
case SP_AUTOSPELL:
if(sd->state.lr_flag != 2)
@@ -2108,25 +2111,8 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
sd->sp_drain_type = val;
break;
case SP_ADD_MONSTER_DROP_ITEMGROUP:
- if (sd->state.lr_flag != 2) {
- for(i = 0; i < sd->add_drop_count; i++) {
- if(sd->add_drop[i].group == type2) {
- sd->add_drop[i].id = 0;
- sd->add_drop[i].race |= 1<<type3;
- if(sd->add_drop[i].rate < val)
- sd->add_drop[i].rate = val;
- break;
- }
- }
- if(i >= sd->add_drop_count && sd->add_drop_count < 10) {
- sd->add_drop[sd->add_drop_count].group = type2;
- sd->add_drop[sd->add_drop_count].id = 0;
- // all monsters, including boss and non boss monsters
- sd->add_drop[sd->add_drop_count].race |= 1<<type3;
- sd->add_drop[sd->add_drop_count].rate = val;
- sd->add_drop_count++;
- }
- }
+ if (sd->state.lr_flag != 2)
+ pc_bonus_item_drop(sd->add_drop, &sd->add_drop_count, 0, type2, 1<<type3, val);
break;
default: