diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-10 02:19:19 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-06-10 02:19:19 +0000 |
commit | 2494b69c92ab49c8680d0533af2c90b7a9fc5613 (patch) | |
tree | f7678a116115eb3ff2ed1e332c58f3325bc9aa44 /src/map/npc.c | |
parent | 136b8ade90c19a9ae843447ad04cba8c2eefc18a (diff) | |
download | hercules-2494b69c92ab49c8680d0533af2c90b7a9fc5613.tar.gz hercules-2494b69c92ab49c8680d0533af2c90b7a9fc5613.tar.bz2 hercules-2494b69c92ab49c8680d0533af2c90b7a9fc5613.tar.xz hercules-2494b69c92ab49c8680d0533af2c90b7a9fc5613.zip |
* [Improved]:
- npc_click interception on BL_MOB and BL_PC to let sd act accordingly.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7079 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r-- | src/map/npc.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index e9ddb3e53..aca127546 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1062,7 +1062,9 @@ int npc_globalmessage(const char *name,char *mes) */
int npc_click(struct map_session_data *sd,int id)
{
- struct npc_data *nd;
+ struct npc_data *nd = NULL;
+ TBL_MOB *md = NULL;
+ int tick = 0;
nullpo_retr(1, sd);
@@ -1072,12 +1074,42 @@ int npc_click(struct map_session_data *sd,int id) return 1;
}
+ if(id < 0){
+ id = -id;
+ }
+
+ nd=(struct npc_data *)map_id2bl(id);
+
+ switch(nd->bl.type){
+ case BL_MOB:
+ md = ((TBL_MOB *)nd);
+ if(md->nd){
+ if(sd->bl.m == md->bl.m && distance_bl(&sd->bl, &md->bl) <= AREA_SIZE)
+ sd->npc_pos = run_script(md->nd->u.scr.script,0,sd->bl.id,id);
+ return 0;
+ }
+ case BL_PC:
+ tick = gettick();
+ if (sd->sc.option&OPTION_HIDE || sd->sc.option&OPTION_WEDDING || sd->vd.class_ == JOB_XMAS)
+ return 0;
+
+ if (!battle_config.sdelay_attack_enable && pc_checkskill(sd, SA_FREECAST) <= 0) {
+ if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
+ clif_skill_fail(sd, 1, 4, 0);
+ return 0;
+ }
+ }
+ if (sd->invincible_timer != -1)
+ pc_delinvincibletimer(sd);
+
+ sd->idletime = tick;
+ unit_attack(&sd->bl, id, 1);
+ return 0;
+ }
if (npc_checknear(sd,id))
return 1;
- nd=(struct npc_data *)map_id2bl(id);
-
//Hidden/Disabled npc.
if (nd->class_ < 0 || nd->sc.option&OPTION_INVISIBLE)
return 1;
|