diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-01-10 10:16:06 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-01-10 10:16:06 +0000 |
commit | 7536331ae203d5576166cd50a3243b735cd30f75 (patch) | |
tree | 2cf87c8b716d5ce273c5d21de1320c2509124124 /src | |
parent | 31840066c4795124a887cd12996cf7dc13fcef25 (diff) | |
download | hercules-7536331ae203d5576166cd50a3243b735cd30f75.tar.gz hercules-7536331ae203d5576166cd50a3243b735cd30f75.tar.bz2 hercules-7536331ae203d5576166cd50a3243b735cd30f75.tar.xz hercules-7536331ae203d5576166cd50a3243b735cd30f75.zip |
* Fixed some typos and exploits in the Blacksmith and Hunter job quest
* Modified 'wedding' script command to work with "OnTimer" scripts
* Added 'attachnpctimer' and 'detachnpctimer' script command
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@944 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/npc.c | 3 | ||||
-rw-r--r-- | src/map/pc.c | 5 | ||||
-rw-r--r-- | src/map/script.c | 53 |
4 files changed, 56 insertions, 7 deletions
diff --git a/src/map/map.h b/src/map/map.h index 99e4b5285..15de79d01 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -376,7 +376,7 @@ struct npc_data { char *script; short xs,ys; int guild_id; - int timer,timerid,timeramount,nexttimer; + int timer,timerid,timeramount,nexttimer,timerrid; unsigned int timertick; struct npc_timerevent_list *timer_event; int label_list_num; diff --git a/src/map/npc.c b/src/map/npc.c index 4ef38ff52..d2379e5a8 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -589,7 +589,7 @@ int npc_timerevent(int tid,unsigned int tick,int id,int data) nd->u.scr.timerid = add_timer(tick+next,npc_timerevent,id,next); } - run_script(nd->u.scr.script,te->pos,0,nd->bl.id); + run_script(nd->u.scr.script,te->pos,nd->u.scr.timerrid,nd->bl.id); return 0; } /*========================================== @@ -612,6 +612,7 @@ int npc_timerevent_start(struct npc_data *nd) } nd->u.scr.nexttimer=j; nd->u.scr.timertick=gettick(); + nd->u.scr.timerrid=0; // no players attached by default [celest] if(j>=n) return 0; diff --git a/src/map/pc.c b/src/map/pc.c index 417ca0272..4aa2e7342 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -1048,9 +1048,10 @@ int pc_calc_skilltree(struct map_session_data *sd) for(j=0;j<5;j++) { if( skill_tree[s][c][i].need[j].id && pc_checkskill(sd,skill_tree[s][c][i].need[j].id) < - skill_tree[s][c][i].need[j].lv) + skill_tree[s][c][i].need[j].lv) { f=0; - break; + break; + } } } if(f && sd->status.skill[id].id==0 ){ diff --git a/src/map/script.c b/src/map/script.c index 31c10d809..c2369d024 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -193,6 +193,8 @@ int buildin_stopnpctimer(struct script_state *st); int buildin_startnpctimer(struct script_state *st); int buildin_setnpctimer(struct script_state *st); int buildin_getnpctimer(struct script_state *st); +int buildin_attachnpctimer(struct script_state *st); // [celest] +int buildin_detachnpctimer(struct script_state *st); // [celest] int buildin_announce(struct script_state *st); int buildin_mapannounce(struct script_state *st); int buildin_areaannounce(struct script_state *st); @@ -414,6 +416,8 @@ struct { {buildin_startnpctimer,"startnpctimer","*"}, {buildin_setnpctimer,"setnpctimer","*"}, {buildin_getnpctimer,"getnpctimer","i*"}, + {buildin_attachnpctimer,"attachnpctimer","*"}, // attached the player id to the npc timer [Celest] + {buildin_detachnpctimer,"detachnpctimer","*"}, // detached the player id from the npc timer [Celest] {buildin_announce,"announce","si"}, {buildin_mapannounce,"mapannounce","ssi"}, {buildin_areaannounce,"areaannounce","siiiisi"}, @@ -3968,6 +3972,46 @@ int buildin_setnpctimer(struct script_state *st) } /*========================================== + * attaches the player rid to the timer [Celest] + *------------------------------------------ + */ +int buildin_attachnpctimer(struct script_state *st) +{ + struct map_session_data *sd; + struct npc_data *nd; + + nd=(struct npc_data *)map_id2bl(st->oid); + if( st->end > st->start+2 ) { + char *name = conv_str(st,& (st->stack->stack_data[st->start+2])); + sd=map_nick2sd(name); + } else { + sd = script_rid2sd(st); + } + + if (sd==NULL) + return 0; + + nd->u.scr.timerrid = sd->bl.id; + return 0; +} + +/*========================================== + * detaches a player rid from the timer [Celest] + *------------------------------------------ + */ +int buildin_detachnpctimer(struct script_state *st) +{ + struct npc_data *nd; + if( st->end > st->start+2 ) + nd=npc_name2id(conv_str(st,& (st->stack->stack_data[st->start+2]))); + else + nd=(struct npc_data *)map_id2bl(st->oid); + + nd->u.scr.timerrid = 0; + return 0; +} + +/*========================================== * 天の声アナウンス *------------------------------------------ */ @@ -5445,10 +5489,13 @@ int buildin_marriage(struct script_state *st) int buildin_wedding_effect(struct script_state *st) { struct map_session_data *sd=script_rid2sd(st); + struct block_list *bl; - if(sd==NULL) - return 0; - clif_wedding_effect(&sd->bl); + if(sd==NULL) { + bl=map_id2bl(st->oid); + } else + bl=&sd->bl; + clif_wedding_effect(bl); return 0; } int buildin_divorce(struct script_state *st) |