Jump to content
  • 0

@pvpmode bonus exp.


Scofield

Question


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

Hello community,

I have a modification in my emulator called pvpmode. When I use it, the character enters PK mode, and in this system, it is possible to configure it to receive experience bonuses. I would like to implement the feature of receiving drop bonuses while the PK mode is active. Does anyone know how I could achieve this?

Here is the part of the source code (src) that seems to be related to the experience bonus system.

 

 


pc.c
/*==========================================
 * Alters experienced based on self bonuses that do not get even shared to the party.
 *------------------------------------------*/
static void pc_calcexp(struct map_session_data *sd, unsigned int *base_exp, unsigned int *job_exp, struct block_list *src)
{
	int bonus = 0;
	struct status_data *status = status_get_status_data(src);
	struct region_data* rd;
	unsigned int ebonus = 0, jbonus = 0;

	if (sd->expaddrace[status->race])
		bonus += sd->expaddrace[status->race];	
	bonus += sd->expaddrace[status->mode&MD_BOSS?RC_BOSS:RC_NONBOSS];

	if (battle_config.pk_mode && 
		(int)(status_get_lv(src) - sd->status.base_level) >= 20)
		bonus += 15; // pk_mode additional exp if monster >20 levels [Valaris]	

	if (sd->sc.data[SC_EXPBOOST])
		bonus += sd->sc.data[SC_EXPBOOST]->val1;

	if( sd->status.iprank )
		bonus += (sd->status.iprank * 2);

	if( pc_isPremium(sd) && battle_config.premium_bonusexp )
		bonus += battle_config.premium_bonusexp;

	if( sd->state.pvpmode && battle_config.pvpmode_expbonus )
	{
		int rank;
		if( (rank = pc_pvpfamerank(sd->status.char_id)) && rand()%100 < ((MAX_FAME_LIST + 1 - rank) * 4) )
			bonus += battle_config.pvpmode_expbonus;
	}

	if (sd->sc.data[SC_JEXPBOOST])
		jbonus += sd->sc.data[SC_JEXPBOOST]->val1;

	if( sd->status.guild_id && (rd = region_search(map[sd->bl.m].region_id)) != NULL && sd->status.guild_id == rd->guild_id )
	{
		ebonus += rd->bonus_bexp;
		jbonus += rd->bonus_jexp;
	}

	if( !bonus && !ebonus && !jbonus )
	  	return;
	
	*base_exp = (unsigned int) cap_value(*base_exp + (double)*base_exp * (bonus + ebonus)/100., 1, UINT_MAX);
	*job_exp = (unsigned int) cap_value(*job_exp + (double)*job_exp * (bonus + jbonus)/100., 1, UINT_MAX);

	return;
}

battle.c

{ "pvpmode_onlypc",                     &battle_config.pvpmode_onlypc,                  1,      0,      1,              },
	{ "pvpmode_gvgreductions",              &battle_config.pvpmode_gvgreductions,           0,      0,      1,              },
	{ "pvpmode_expbonus",                   &battle_config.pvpmode_expbonus,                0,      0,      100,            },
	{ "pvpmode_nowarp_cmd",                 &battle_config.pvpmode_nowarp_cmd,              0,      0,      1,              },
	{ "pvpmode_enable_delay",               &battle_config.pvpmode_enable_delay,          120,      0,      INT_MAX,        },
	{ "pvpmode_disable_delay",              &battle_config.pvpmode_disable_delay,          60,      0,      INT_MAX,        },

battle.h

int pvpmode_onlypc;
	int pvpmode_gvgreductions;
	int pvpmode_expbonus;
	int pvpmode_nowarp_cmd;
	int pvpmode_enable_delay;
	int pvpmode_disable_delay;

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

On 1/28/2024 at 9:59 PM, Scofield said:

I would like to implement the feature of receiving drop bonuses while the PK mode is active

find these line in mob.cpp

	// Cap it to 100%
	drop_rate = min( drop_rate, 10000 );

change to

	if (sd->state.pvpmode)
		drop_rate += 100; // final drop rate increment by 1.00%
	
	// Cap it to 100%
	drop_rate = min( drop_rate, 10000 );

 

  • MVP 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   1
  • Joined:  08/22/18
  • Last Seen:  

You can do it via script.

*setbattleflag "<battle flag>",<value>{,<reload>};
*getbattleflag("<battle flag>")

https://github.com/rathena/rathena/blob/e965e2794b96dc2fdd4364e457ef85ea5be6557e/doc/script_commands.txt#L7768-L7769

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.03
  • Content Count:  265
  • Reputation:   11
  • Joined:  01/11/13
  • Last Seen:  

Tranx...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...