- Implemented script commands for mercenary items (mercenary_heal and mercenary_sc_start).

- Fixed a bug crashing server with mercenary.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13159 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
zephyrus 2008-08-31 21:05:35 +00:00
parent 908c3d2e86
commit f0439c9f56
5 changed files with 45 additions and 2 deletions

View File

@ -218,6 +218,14 @@ void mercenary_damage(struct mercenary_data *md, struct block_list *src, int hp,
clif_mercenary_updatestatus(md->master, SP_HP); clif_mercenary_updatestatus(md->master, SP_HP);
} }
void mercenary_heal(struct mercenary_data *md, int hp, int sp)
{
if( hp )
clif_mercenary_updatestatus(md->master, SP_HP);
if( sp )
clif_mercenary_updatestatus(md->master, SP_SP);
}
int mercenary_dead(struct mercenary_data *md, struct block_list *src) int mercenary_dead(struct mercenary_data *md, struct block_list *src)
{ {
merc_delete(md, 1); merc_delete(md, 1);

View File

@ -42,6 +42,7 @@ int merc_create(struct map_session_data *sd, int class_, unsigned int lifetime);
int merc_data_received(struct s_mercenary *merc, bool flag); int merc_data_received(struct s_mercenary *merc, bool flag);
int mercenary_save(struct mercenary_data *md); int mercenary_save(struct mercenary_data *md);
void mercenary_damage(struct mercenary_data *md, struct block_list *src, int hp, int sp); void mercenary_damage(struct mercenary_data *md, struct block_list *src, int hp, int sp);
void mercenary_heal(struct mercenary_data *md, int hp, int sp);
int mercenary_dead(struct mercenary_data *md, struct block_list *src); int mercenary_dead(struct mercenary_data *md, struct block_list *src);
int do_init_mercenary(void); int do_init_mercenary(void);
int merc_delete(struct mercenary_data *md, int reply); int merc_delete(struct mercenary_data *md, int reply);

View File

@ -3602,8 +3602,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y
if( sd->md ) if( sd->md )
{ {
sd->md->bl.m = m; sd->md->bl.m = m;
sd->md->bl.x = sd->hd->ud.to_x = x; sd->md->bl.x = sd->md->ud.to_x = x;
sd->md->bl.y = sd->hd->ud.to_y = y; sd->md->bl.y = sd->md->ud.to_y = y;
sd->md->ud.dir = sd->ud.dir; sd->md->ud.dir = sd->ud.dir;
} }

View File

@ -12815,6 +12815,37 @@ BUILDIN_FUNC(createmercenary)
return 0; return 0;
} }
BUILDIN_FUNC(mercenary_heal)
{
struct map_session_data *sd = script_rid2sd(st);
int hp, sp;
if( sd == NULL || sd->md == NULL )
return 0;
hp = script_getnum(st,2);
sp = script_getnum(st,3);
status_heal(&sd->md->bl, hp, sp, 0);
return 0;
}
BUILDIN_FUNC(mercenary_sc_start)
{
struct map_session_data *sd = script_rid2sd(st);
enum sc_type type;
int tick, val1;
if( sd == NULL || sd->md == NULL )
return 0;
type = (sc_type)script_getnum(st,2);
tick = script_getnum(st,3);
val1 = script_getnum(st,4);
status_change_start(&sd->md->bl, type, 10000, val1, 0, 0, 0, tick, 2);
return 0;
}
/****************** /******************
Questlog script commands Questlog script commands
*******************/ *******************/
@ -13246,5 +13277,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(setwall,"siiiiis"), BUILDIN_DEF(setwall,"siiiiis"),
BUILDIN_DEF(delwall,"s"), BUILDIN_DEF(delwall,"s"),
BUILDIN_DEF(createmercenary,"ii"), BUILDIN_DEF(createmercenary,"ii"),
BUILDIN_DEF(mercenary_heal,"ii"),
BUILDIN_DEF(mercenary_sc_start,"iii"),
{NULL,NULL,NULL}, {NULL,NULL,NULL},
}; };

View File

@ -836,6 +836,7 @@ int status_heal(struct block_list *bl,int hp,int sp, int flag)
case BL_PC: pc_heal((TBL_PC*)bl,hp,sp,flag&2?1:0); break; case BL_PC: pc_heal((TBL_PC*)bl,hp,sp,flag&2?1:0); break;
case BL_MOB: mob_heal((TBL_MOB*)bl,hp); break; case BL_MOB: mob_heal((TBL_MOB*)bl,hp); break;
case BL_HOM: merc_hom_heal((TBL_HOM*)bl,hp,sp); break; case BL_HOM: merc_hom_heal((TBL_HOM*)bl,hp,sp); break;
case BL_MER: mercenary_heal((TBL_MER*)bl,hp,sp); break;
} }
return hp+sp; return hp+sp;