Jump to content
  • 0
Legend

Show error item on pc_bonus2

Question

I don't know if this Is this possible, but i would like to request for
a plugin that would show the item prompt as error (sample warning: [Warning]: pc_bonus2 unknown type 2061 16 30) on itemdb...

it would show it like this: [Warning]: pc_bonus2: unknown type 0 10! Item ID: 5013.

Hard for me to determine what item is causing the error that's why i would like to request for this :)
Thanks in advance!

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

@@Dastgir

I also noticed we can't add custom bonuses for a plugin

are you interest in doing this?

 

EDIT: ... hmm...

maybe its possible with using addHookPre, and then hookStop() ...

but seriously, this should be official instead of plugin

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

honestly, status_calc_pc should have split into multiple functions ...

if we have follow the Linux Kernel Coding Style

in my opinion, status_calc_pc_additional function shouldn't even exist ...

parse equipment, should has its own function, parse card, its own function

so we can just post-hook to that function, instead of having a function doing nothing out in the middle of it =/

 

ok let me try code this bAddMaxWeight, that has been in our repo and turn it as a plugin

#include "common/hercules.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include "map/pc.h"#include "map/map.h"#include "common/nullpo.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo = {	"baddweight",	SERVER_TYPE_MAP,	">.<",	HPM_VERSION,};int SP_ADDWEIGHT = 0;int pc_bonus_pre( struct map_session_data *sd, int *type, int *val ) {	nullpo_ret(sd);	if ( *type == SP_ADDWEIGHT ) {		if ( sd->state.lr_flag != 2 ) {			sd->max_weight += *val;			hookStop();		}	}	return 0;}HPExport void plugin_init (void) {	SP_ADDWEIGHT = map->get_new_bonus_id();	script->set_constant( "baddweight", SP_ADDWEIGHT, false );	addHookPre( "pc->bonus", pc_bonus_pre );}
-	script	dfbskfh	-1,{OnPCStatCalcEvent:	bonus baddweight, 10000000;}
hmmm ... totally possible,

I just noticed there is a map->get_new_bonus_id() in our repo, somebody must have use this stuff before already

so don't have to add whatever function anymore

.


.

and for the topic,

I rather say there are 2 problems with it

 

1. bonus bAddMaxWaight, 1000;

I think the bonus command, the 1st field should always be a constant

this kind of typo makes the script engine read the bAddMaxWaight as a player variable

and currently our script engine 'i' type cannot differentiate integer, constant or player variable

maybe we can add a 'c' type, to enforce a check that field only accept constant

BUILDIN_DEF(bonus,"cv"),
however, this is still a run-time check, our script engine still sux

but the script->report_data function will able to print the variable name out

I can pull request this soon

 

2. and to actually having to print where the error come from, item ? pet ? combo ?

perhaps the run_script function should have an optional field 'flag' and 'line',

so the 'pc_bonus' and 'status_change_start' function can tell where the error come from

this kind of stuffs should be done in the new script engine update though

I kinda lost interest in this, better left this to Haru

Edited by AnnieRuru

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...

×
×
  • Create New...

Important Information

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