Jump to content
  • 0
Sign in to follow this  
Random756

@blockexp

Question

First of all thanks for your plugin.

 

There's something i don't understand though, the plugin as i quote you

Quote

 

"- stop BaseExp/JobExp gain after certain level"

But is there anyway to use it as a "toggle on/off" option ? Like, i'm lvl 200, i don't want to up lvl 201 so i use @blockexp to toggle the blockexp on. But i still have the possibility to toggle it off by re using @blockexp ?

Edited by AnnieRuru
split topic from http://herc.ws/board/topic/11587-maxlvexpgain/

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0
#include "common/hercules.h"
#include "map/pc.h"
#include "common/nullpo.h"
#include "plugins/HPMHooking.h"
#include "common/HPMDataCheck.h"

HPExport struct hplugin_info pinfo = {
	"blockexp",
	SERVER_TYPE_MAP,
	"0.1",
	HPM_VERSION,
};

bool pc_authok_post( bool retVal, struct map_session_data *sd, int login_id2, time_t expiration_time, int group_id, const struct mmo_charstatus *st, bool changing_mapservers ) {
	if ( retVal == false )
		return false;
	if ( pc_readglobalreg( sd, script->add_variable("blockexp") ) == true )
		clif->message( sd->fd, "@blockexp turn ON." );
	return true;
}

bool pc_gainexp_pre( struct map_session_data **sd, struct block_list **src, uint64 *base_exp, uint64 *job_exp, bool *is_quest ) {
	nullpo_ret(*sd);
	if ( *src == NULL && pc_readglobalreg( *sd, script->add_variable("blockexp") ) == true )
		*base_exp = 0;
	return true;
}

void pc_calcexp_post( struct map_session_data *sd, uint64 *base_exp, uint64 *job_exp, struct block_list *src ) {
	if ( pc_readglobalreg( sd, script->add_variable("blockexp") ) == true )
		*base_exp = 0;
	return;
}

ACMD(blockexp) {
	if ( pc_readglobalreg( sd, script->add_variable("blockexp") ) ) {
		clif->message( sd->fd, "@blockexp turn OFF." );
		pc_setglobalreg( sd, script->add_variable("blockexp"), false );
	}
	else {
		clif->message( sd->fd, "@blockexp turn ON." );
		pc_setglobalreg( sd, script->add_variable("blockexp"), true );
	}
	return true;
}

HPExport void plugin_init(void) {
	addHookPre( pc, gainexp, pc_gainexp_pre );
	addHookPost( pc, calcexp, pc_calcexp_post );
	addAtcommand( "blockexp", blockexp );
}

//= the reason of using a script variable instead of creating a new SQL table,
//= so server owner can also block exp gain for players from a script
//= so just comment out the addAtcommand line ...

@Crousti @kftof

 

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.