Added conf option for homunculus idle no share (#4548)

* Added conf option to make characters stop receiving exp/drop from homunculi when they are idle
This commit is contained in:
Daegaladh
2020-01-22 18:55:59 +01:00
committed by GitHub
parent a4c75d4771
commit 921b3e2c3e
6 changed files with 24 additions and 10 deletions

View File

@@ -61,3 +61,12 @@ homunculus_S_growth_level: 99
// Send auto-feed notice even if OFF (Note 1) // Send auto-feed notice even if OFF (Note 1)
// Official: yes // Official: yes
homunculus_autofeed_always: yes homunculus_autofeed_always: yes
// Is getting exp/item from the homunculus disabled when you're idle?
// Set to no, or the amount of seconds (NOT milliseconds) that need to pass before considering
// a character idle.
// Characters in a chat/vending are always considered idle.
// A character's idle status is reset upon item use/skill use/attack (auto attack counts too)/movement.
// You will only receive items if 'homunculus_autoloot' is activated,
// otherwise they will be dropped on the ground as usual.
hom_idle_no_share: no

View File

@@ -8553,6 +8553,7 @@ static const struct _battle_data {
{ "mob_nopc_move_rate", &battle_config.mob_nopc_move_rate, 100, 0, 100, }, { "mob_nopc_move_rate", &battle_config.mob_nopc_move_rate, 100, 0, 100, },
{ "boss_nopc_idleskill_rate", &battle_config.boss_nopc_idleskill_rate, 100, 0, 100, }, { "boss_nopc_idleskill_rate", &battle_config.boss_nopc_idleskill_rate, 100, 0, 100, },
{ "boss_nopc_move_rate", &battle_config.boss_nopc_move_rate, 100, 0, 100, }, { "boss_nopc_move_rate", &battle_config.boss_nopc_move_rate, 100, 0, 100, },
{ "hom_idle_no_share", &battle_config.hom_idle_no_share, 0, 0, INT_MAX, },
#include "../custom/battle_config_init.inc" #include "../custom/battle_config_init.inc"
}; };

View File

@@ -663,6 +663,7 @@ struct Battle_Config
int mob_nopc_move_rate; int mob_nopc_move_rate;
int boss_nopc_idleskill_rate; int boss_nopc_idleskill_rate;
int boss_nopc_move_rate; int boss_nopc_move_rate;
int hom_idle_no_share;
#include "../custom/battle_config_struct.inc" #include "../custom/battle_config_struct.inc"
}; };

View File

@@ -2187,7 +2187,7 @@ static void mob_item_drop(struct mob_data *md, struct item_drop_list *dlist, str
test_autoloot = sd test_autoloot = sd
&& (drop_rate <= sd->state.autoloot || pc_isautolooting(sd, ditem->item_data.nameid)) && (drop_rate <= sd->state.autoloot || pc_isautolooting(sd, ditem->item_data.nameid))
&& (battle_config.idle_no_autoloot == 0 || DIFF_TICK(last_tick, sd->idletime) < battle_config.idle_no_autoloot) && (battle_config.idle_no_autoloot == 0 || DIFF_TICK(last_tick, sd->idletime) < battle_config.idle_no_autoloot)
&& (battle_config.homunculus_autoloot?1:!flag); && (battle_config.homunculus_autoloot?(battle_config.hom_idle_no_share == 0 || !pc_isidle_hom(sd)):!flag);
#ifdef AUTOLOOT_DISTANCE #ifdef AUTOLOOT_DISTANCE
test_autoloot = test_autoloot && sd->bl.m == md->bl.m test_autoloot = test_autoloot && sd->bl.m == md->bl.m
&& check_distance_blxy(&sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE); && check_distance_blxy(&sd->bl, dlist->x, dlist->y, AUTOLOOT_DISTANCE);
@@ -2654,7 +2654,8 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
job_exp = (unsigned int)cap_value(apply_rate(job_exp, rate), 1, UINT_MAX); job_exp = (unsigned int)cap_value(apply_rate(job_exp, rate), 1, UINT_MAX);
} }
#endif #endif
pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp, 0); if (!(homkillonly && battle_config.hom_idle_no_share && pc_isidle_hom(tmpsd[i])))
pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp, 0);
} }
} }
if(zeny) // zeny from mobs [Valaris] if(zeny) // zeny from mobs [Valaris]
@@ -2665,8 +2666,9 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type)
pc_damage_log_clear(tmpsd[i],md->bl.id); pc_damage_log_clear(tmpsd[i],md->bl.id);
} }
for( i = 0; i < pnum; i++ ) //Party share. if (!(homkillonly && battle_config.hom_idle_no_share && pc_isidle_hom(map_charid2sd(md->dmglog[0].id))))
party_exp_share(pt[i].p, &md->bl, pt[i].base_exp,pt[i].job_exp,pt[i].zeny); for( i = 0; i < pnum; i++ ) //Party share.
party_exp_share(pt[i].p, &md->bl, pt[i].base_exp,pt[i].job_exp,pt[i].zeny);
} //End EXP giving. } //End EXP giving.

View File

@@ -1089,7 +1089,7 @@ void party_exp_share(struct party_data* p, struct block_list* src, unsigned int
// count the number of players eligible for exp sharing // count the number of players eligible for exp sharing
for (i = c = 0; i < MAX_PARTY; i++) { for (i = c = 0; i < MAX_PARTY; i++) {
if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle(sd[c])) ) if( (sd[c] = p->data[i].sd) == NULL || sd[c]->bl.m != src->m || pc_isdead(sd[c]) || (battle_config.idle_no_share && pc_isidle_party(sd[c])) )
continue; continue;
c++; c++;
} }
@@ -1151,7 +1151,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
if (i >= MAX_PARTY) if (i >= MAX_PARTY)
i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc" i = 0; // reset counter to 1st person in party so it'll stop when it reaches "itemc"
if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle(psd)) ) if( (psd = p->data[i].sd) == NULL || sd->bl.m != psd->bl.m || pc_isdead(psd) || (battle_config.idle_no_share && pc_isidle_party(psd)) )
continue; continue;
if (pc_additem(psd,item,item->amount,LOG_TYPE_PICKDROP_PLAYER)) if (pc_additem(psd,item,item->amount,LOG_TYPE_PICKDROP_PLAYER))
@@ -1168,7 +1168,7 @@ int party_share_loot(struct party_data* p, struct map_session_data* sd, struct i
//Collect pick candidates //Collect pick candidates
for (i = 0; i < MAX_PARTY; i++) { for (i = 0; i < MAX_PARTY; i++) {
if( (psd[count] = p->data[i].sd) == NULL || psd[count]->bl.m != sd->bl.m || pc_isdead(psd[count]) || (battle_config.idle_no_share && pc_isidle(psd[count])) ) if( (psd[count] = p->data[i].sd) == NULL || psd[count]->bl.m != sd->bl.m || pc_isdead(psd[count]) || (battle_config.idle_no_share && pc_isidle_party(psd[count])) )
continue; continue;
count++; count++;
@@ -1222,7 +1222,7 @@ int party_sub_count(struct block_list *bl, va_list ap)
if (sd->state.autotrade) if (sd->state.autotrade)
return 0; return 0;
if (battle_config.idle_no_share && pc_isidle(sd)) if (battle_config.idle_no_share && pc_isidle_party(sd))
return 0; return 0;
return 1; return 1;
@@ -1263,7 +1263,7 @@ int party_sub_count_banding(struct block_list *bl, va_list ap)
if (sd->state.autotrade) if (sd->state.autotrade)
return 0; return 0;
if (battle_config.idle_no_share && pc_isidle(sd)) if (battle_config.idle_no_share && pc_isidle_party(sd))
return 0; return 0;
if ((sd->class_&MAPID_THIRDMASK) != MAPID_ROYAL_GUARD) if ((sd->class_&MAPID_THIRDMASK) != MAPID_ROYAL_GUARD)

View File

@@ -894,7 +894,8 @@ extern struct s_job_info job_info[CLASS_COUNT];
#define pc_setsit(sd) { pc_stop_walking((sd), 1|4); pc_stop_attack((sd)); (sd)->state.dead_sit = (sd)->vd.dead_sit = 2; } #define pc_setsit(sd) { pc_stop_walking((sd), 1|4); pc_stop_attack((sd)); (sd)->state.dead_sit = (sd)->vd.dead_sit = 2; }
#define pc_isdead(sd) ( (sd)->state.dead_sit == 1 ) #define pc_isdead(sd) ( (sd)->state.dead_sit == 1 )
#define pc_issit(sd) ( (sd)->vd.dead_sit == 2 ) #define pc_issit(sd) ( (sd)->vd.dead_sit == 2 )
#define pc_isidle(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share ) #define pc_isidle_party(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.idle_no_share )
#define pc_isidle_hom(sd) ( (sd)->hd && ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(last_tick, (sd)->idletime) >= battle_config.hom_idle_no_share ) )
#define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading ) #define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
#define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend ) #define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )