summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt3
-rw-r--r--src/map/npc.c38
2 files changed, 38 insertions, 3 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 6b8b978c3..e720240d1 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/09
+ * [Improved]:
+ - npc_click interception on BL_MOB and BL_PC to let sd act accordingly.
+ [Lance]
* [Fixed]:
- Execution of sleep/sleep2 more than once will hang the script_state.
[Lance]
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;