Jump to content
  • 0
Sign in to follow this  
utofaery

2. can it be use as script onPCLogin?? and does this one stop gaining exp from mvp too?

Question

#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 );
}

As Topic

 

 

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

yes it block exp from anything, including script commands *getexp

if you want to block from OnPCLoginEvent, just use player variable, don't use atcommand

-	script	BmapMobList	-1,{
OnPCLoginEvent:
	blockexp = true;
	dispbottom _( "You no longer gain experience." ), C_WHITE;
	end;
}

something like that

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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