From 6e4d98865963ef3e85df488716e9a97bfcacc98b Mon Sep 17 00:00:00 2001 From: Lance Date: Thu, 16 Mar 2006 16:08:01 +0000 Subject: * mob_chat_sub fix. Added buildin_pcblockmove. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5628 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 1 + src/map/clif.c | 8 ++++++-- src/map/map.h | 1 + src/map/mob.c | 4 ++-- src/map/npc_chat.c | 22 ++++++++-------------- src/map/script.c | 20 ++++++++++++++++++++ 6 files changed, 38 insertions(+), 18 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 3c7e8db1c..57be3cbaa 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -5,6 +5,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS 2006/03/15 + * mob_chat_sub fix. Added buildin_pcblockmove. [Lance] * BL_PC and BL_MOB control script commands (experimental) [Lance] * Made an adjustment to addspiritball() to allow Gunslingers to summon up to 10 spheres [reddozen] * Fixed Tarot Card of Fate using time instead of time2 which is the one diff --git a/src/map/clif.c b/src/map/clif.c index 040644127..13e936f18 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8874,8 +8874,9 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { return; } - if (pc_issit(sd)) //No walking when you are sit! - return; + // Redundancy, used in pc_can_move already + //if (pc_issit(sd)) //No walking when you are sit! + // return; if (clif_cant_act(sd)) return; @@ -8886,6 +8887,9 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { if (!pc_can_move(sd)) return; + if(sd->state.blockedmove) + return; + if(sd->sc.count && sd->sc.data[SC_RUN].timer != -1) return; diff --git a/src/map/map.h b/src/map/map.h index bc79073b5..cfedf527b 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -450,6 +450,7 @@ struct map_session_data { unsigned size :2; // for tiny/large types unsigned night :1; //Holds whether or not the player currently has the SI_NIGHT effect on. [Skotlex] unsigned finalsave :1; //Signals whether the final save for the char was done or not yet. Meant to prevent exploits and the like. [Skotlex] + unsigned blockedmove :1; unsigned short autoloot; struct guild *gmaster_flag; } state; diff --git a/src/map/mob.c b/src/map/mob.c index e239ce836..ba4bb5083 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -2291,9 +2291,9 @@ int mob_damage(struct block_list *src,struct mob_data *md,int damage,int type) if(src){ if(md->nd){ sprintf(buffer, "$@%d_attacker", md->bl.id); - set_var(NULL, buffer, src->id); + set_var(NULL, buffer, (void *)src->id); sprintf(buffer, "$@%d_attacktype", md->bl.id); - set_var(NULL, buffer, src->type); + set_var(NULL, buffer, (void *)src->type); sprintf(buffer, "%s::OnDamage", md->nd->exname); npc_event_do(buffer); return 0; diff --git a/src/map/npc_chat.c b/src/map/npc_chat.c index 7d8e0e21f..eaab82aff 100644 --- a/src/map/npc_chat.c +++ b/src/map/npc_chat.c @@ -372,20 +372,6 @@ void npc_chat_finalize(struct npc_data *nd) aFree(npcParse); } -int mob_chat_sub(struct block_list *bl, va_list ap){ - int len; - unsigned char *msg = NULL; - struct map_session_data *sd = NULL; - struct mob_data *md = (struct mob_data *)bl; - if(md->nd){ - msg = va_arg(ap,unsigned char*); - len = va_arg(ap,int); - sd = va_arg(ap,struct map_session_data *); - npc_chat_sub(&md->nd->bl, msg, len, sd); - } - return 0; -} - /** * Handler called whenever a global message is spoken in a NPC's area */ @@ -491,6 +477,14 @@ int npc_chat_sub(struct block_list *bl, va_list ap) return 0; } +int mob_chat_sub(struct block_list *bl, va_list ap){ + struct mob_data *md = (struct mob_data *)bl; + if(md->nd){ + npc_chat_sub(&md->nd->bl, ap); + } + return 0; +} + // Various script builtins used to support these functions int buildin_defpattern(struct script_state *st) { diff --git a/src/map/script.c b/src/map/script.c index 2de03d940..9b4690ca7 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -410,6 +410,7 @@ int buildin_pctalk(struct script_state *st); int buildin_pcemote(struct script_state *st); int buildin_pcfollow(struct script_state *st); int buildin_pcstopfollow(struct script_state *st); +int buildin_pcblockmove(struct script_state *st); // <--- [zBuffer] List of player cont commands // [zBuffer] List of mob control commands ---> int buildin_spawnmob(struct script_state *st); @@ -737,6 +738,7 @@ struct { {buildin_pcemote,"pcemote","ii"}, {buildin_pcfollow,"pcfollow","ii"}, {buildin_pcstopfollow,"pcstopfollow","i"}, + {buildin_pcblockmove,"pcblockmove","ii"}, // <--- [zBuffer] List of player cont commands // [zBuffer] List of mob control commands ---> {buildin_spawnmob,"spawnmob","*"}, @@ -9847,6 +9849,24 @@ int buildin_pcwalkxy(struct script_state *st){ return 0; } +int buildin_pcblockmove(struct script_state *st){ + int id, flag; + struct map_session_data *sd = NULL; + + id = conv_num(st, & (st->stack->stack_data[st->start + 2])); + flag = conv_num(st, & (st->stack->stack_data[st->start + 3])); + + if(id) + sd = map_id2sd(id); + else + sd = script_rid2sd(st); + + if(sd) + sd->state.blockedmove = flag > 0; + + return 0; +} + int buildin_pctalk(struct script_state *st){ int id; char *str; -- cgit v1.2.3-70-g09d2