diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-08-31 21:05:35 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-08-31 21:05:35 +0000 |
commit | 0c3fe037b7df653d91b03bc19526dbc8b7e641cb (patch) | |
tree | e1b4f575caec62050d264de5abdf28f078c7a192 /src | |
parent | 690ef2ae18deedd44bf4670eaf751c3888cb5a37 (diff) | |
download | hercules-0c3fe037b7df653d91b03bc19526dbc8b7e641cb.tar.gz hercules-0c3fe037b7df653d91b03bc19526dbc8b7e641cb.tar.bz2 hercules-0c3fe037b7df653d91b03bc19526dbc8b7e641cb.tar.xz hercules-0c3fe037b7df653d91b03bc19526dbc8b7e641cb.zip |
- Implemented script commands for mercenary items (mercenary_heal and mercenary_sc_start).
- Fixed a bug crashing server with mercenary.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13159 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/mercenary.c | 8 | ||||
-rw-r--r-- | src/map/mercenary.h | 1 | ||||
-rw-r--r-- | src/map/pc.c | 4 | ||||
-rw-r--r-- | src/map/script.c | 33 | ||||
-rw-r--r-- | src/map/status.c | 1 |
5 files changed, 45 insertions, 2 deletions
diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 740b8d85e..08a640275 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -218,6 +218,14 @@ void mercenary_damage(struct mercenary_data *md, struct block_list *src, int 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) { merc_delete(md, 1); diff --git a/src/map/mercenary.h b/src/map/mercenary.h index 93c894dda..0579cc2bf 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -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 mercenary_save(struct mercenary_data *md); 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 do_init_mercenary(void); int merc_delete(struct mercenary_data *md, int reply); diff --git a/src/map/pc.c b/src/map/pc.c index 5e4954eeb..d25fbeee5 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3602,8 +3602,8 @@ int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y if( sd->md ) { sd->md->bl.m = m; - sd->md->bl.x = sd->hd->ud.to_x = x; - sd->md->bl.y = sd->hd->ud.to_y = y; + sd->md->bl.x = sd->md->ud.to_x = x; + sd->md->bl.y = sd->md->ud.to_y = y; sd->md->ud.dir = sd->ud.dir; } diff --git a/src/map/script.c b/src/map/script.c index 05d7a0736..dd3a2cc15 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -12815,6 +12815,37 @@ BUILDIN_FUNC(createmercenary) 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 *******************/ @@ -13246,5 +13277,7 @@ struct script_function buildin_func[] = { BUILDIN_DEF(setwall,"siiiiis"), BUILDIN_DEF(delwall,"s"), BUILDIN_DEF(createmercenary,"ii"), + BUILDIN_DEF(mercenary_heal,"ii"), + BUILDIN_DEF(mercenary_sc_start,"iii"), {NULL,NULL,NULL}, }; diff --git a/src/map/status.c b/src/map/status.c index 5f05296cc..eb8e3b3f1 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -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_MOB: mob_heal((TBL_MOB*)bl,hp); 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; |