Show error item on pc_bonus2

Legend

New member
Messages
375
Points
0
Age
30
Location
Heaven ♥
Github
Legend95
Emulator
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
default_smile.png

Thanks in advance!

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

 
Last edited by a moderator:
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 );}
Code:
-	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 suxbut 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

 
Last edited by a moderator:
Back
Top