Prevent Idle Leveling (via Homunculus)


Prevent Idle Leveling + more


Index: conf/battle/exp.conf
===================================================================
--- conf/battle/exp.conf (revision 16816)
+++ conf/battle/exp.conf (working copy)
@@ -89,3 +89,10 @@
 // If no, an equation will be used which preserves statpoints earned/lost
 // through external means (ie: stat point buyers/sellers)
 use_statpoint_table: yes
+
+// Should the master and/or the homunculus stop receiving exp when idle? (uses party.conf's idle_no_share setting to determine the time to be considered idle) [clydelion]
+// 0 = Off
+// 1 = Master only
+// 2 = Homunculus only
+// 3 = Both
+prevent_idle_exp: 3
\ No newline at end of file
Index: conf/battle/homunc.conf
===================================================================
--- conf/battle/homunc.conf (revision 16816)
+++ conf/battle/homunc.conf (working copy)
@@ -43,3 +43,6 @@

 // Max level for Homunculus S
 homunculus_S_max_level: 150
+
+// Does the master gain job exp when a monster is killed by homunculus only? [clydelion]
+homunculus_job_exp: yes
\ No newline at end of file
Index: src/map/battle.c
===================================================================
--- src/map/battle.c (revision 16816)
+++ src/map/battle.c (working copy)
@@ -5738,6 +5738,8 @@
 { "atcommand_mobinfo_type", &battle_config.atcommand_mobinfo_type, 0, 0, 1 },
 { "homunculus_max_level", &battle_config.hom_max_level, 99, 0, MAX_LEVEL, },
 { "homunculus_S_max_level", &battle_config.hom_S_max_level, 150, 0, MAX_LEVEL, },
+ { "homunculus_job_exp", &battle_config.homunculus_job_exp, 0, 0, 1, }, [clydelion]
+ { "prevent_idle_exp", &battle_config.prevent_idle_exp, 0, 0, 3, }, [clydelion]
 };
 #ifndef STATS_OPT_OUT
 /**
Index: src/map/battle.h
===================================================================
--- src/map/battle.h (revision 16816)
+++ src/map/battle.h (working copy)
@@ -480,6 +480,9 @@
 int atcommand_suggestions_enabled;
 int min_npc_vending_distance;
 int atcommand_mobinfo_type;
+
+ int homunculus_job_exp; [clydelion]
+ int prevent_idle_exp; [clydelion]
 } battle_config;

 void do_init_battle(void);
Index: src/map/homunculus.c
===================================================================
--- src/map/homunculus.c (revision 16816)
+++ src/map/homunculus.c (working copy)
@@ -435,6 +435,7 @@
 int merc_hom_gainexp(struct homun_data *hd,int exp)
 {
 int m_class;
+ TBL_PC * sd = hd->master; [clydelion]

 if(hd->homunculus.vaporize)
 return 1;
@@ -450,6 +451,8 @@
 hd->homunculus.exp = 0;
 return 0;
 }
+ if( battle_config.prevent_idle_exp > 1 && pc_isidle(sd) ) [clydelion]
+ return 0;

 hd->homunculus.exp += exp;

Index: src/map/mob.c
===================================================================
--- src/map/mob.c (revision 16816)
+++ src/map/mob.c (working copy)
@@ -2301,7 +2301,10 @@
 if(!md->db->mexp)
 party_renewal_exp_mod(&base_exp,&job_exp,tmpsd[i]->status.base_level,md->level);
 #endif
- pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp, false);
+ if(homkillonly && !battle_config.homunculus_job_exp) [clydelion]
+ pc_gainexp(tmpsd[i], &md->bl, base_exp, 0, false);
+ else
+ pc_gainexp(tmpsd[i], &md->bl, base_exp, job_exp, false);
 }
 }
 if(zeny) // zeny from mobs [Valaris]
Index: src/map/pc.c
===================================================================
--- src/map/pc.c (revision 16816)
+++ src/map/pc.c (working copy)
@@ -5557,7 +5557,7 @@
 if (sd->sc.data[SC_JEXPBOOST])
 bonus += sd->sc.data[SC_JEXPBOOST]->val1;

- *job_exp = (unsigned int) cap_value(*job_exp + (double)*job_exp * bonus/100., 1, UINT_MAX);
+ *job_exp = (unsigned int) cap_value(*job_exp + (double)*job_exp * bonus/100., 0, UINT_MAX); [clydelion]

 return;
 }
@@ -5575,7 +5575,8 @@

 if(!battle_config.pvp_exp && map[sd->bl.m].flag.pvp) // [MouseJstr]
 return 0; // no exp on pvp maps
-
+ if ( ( battle_config.prevent_idle_exp == 1 || battle_config.prevent_idle_exp == 3 ) && pc_isidle(sd) && !quest) [clydelion]
+ return 0;
 if(sd->status.guild_id>0)
 base_exp-=guild_payexp(sd,base_exp);