summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emap/clif.c81
-rw-r--r--src/emap/clif.h3
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/send.c11
-rw-r--r--src/emap/send.h3
5 files changed, 97 insertions, 2 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c
index 2faf394..d211a83 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -14,7 +14,6 @@
#include "common/socket.h"
#include "common/strlib.h"
#include "common/cbasetypes.h"
-//#include "common/utils.h"
#include "common/random.h"
#include "common/timer.h"
#include "map/guild.h"
@@ -39,6 +38,39 @@
extern bool isInit;
+static inline void RBUFPOS(const uint8 *p,
+ unsigned short pos,
+ short *x,
+ short *y,
+ unsigned char *dir)
+{
+ p += pos;
+
+ if (x)
+ {
+ x[0] = ((p[0] & 0xff) << 2) | (p[1] >> 6);
+ }
+
+ if (y)
+ {
+ y[0] = ((p[1] & 0x3f) << 4) | (p[2] >> 4);
+ }
+
+ if (dir)
+ {
+ dir[0] = (p[2] & 0x0f);
+ }
+}
+
+static inline void RFIFOPOS(int fd,
+ unsigned short pos,
+ short *x,
+ short *y,
+ unsigned char *dir)
+{
+ RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir);
+}
+
void eclif_quest_send_list_pre(TBL_PC **sdPtr)
{
TBL_PC *sd = *sdPtr;
@@ -1651,3 +1683,50 @@ void eclif_skillinfo_pre(struct map_session_data **sdPtr,
WFIFOB(fd, 20) = 0;
WFIFOSET(fd, sz);
}
+
+void eclif_parse_WalkToXY(int fd,
+ struct map_session_data *sd)
+{
+ short x, y;
+
+ if (pc_isdead(sd))
+ {
+ clif->clearunit_area(&sd->bl, CLR_DEAD);
+ return;
+ }
+
+ if (sd->sc.opt1 && (sd->sc.opt1 == OPT1_STONEWAIT || sd->sc.opt1 == OPT1_BURNING))
+ ; //You CAN walk on this OPT1 value.
+ /*else if( sd->progressbar.npc_id )
+ clif->progressbar_abort(sd);*/
+ else if (pc_cant_act(sd))
+ return;
+
+ if(sd->sc.data[SC_RUN] || sd->sc.data[SC_WUGDASH])
+ return;
+
+ pc->delinvincibletimer(sd);
+
+ RFIFOPOS(fd, 2, &x, &y, NULL);
+
+ //Set last idle time... [Skotlex]
+ pc->update_idle_time(sd, BCIDLE_WALK);
+
+ if (sd->ud.state.change_walk_target == 0)
+ {
+ if (unit->walktoxy(&sd->bl, x, y, 4) &&
+ sd->ud.state.change_walk_target == 1)
+ {
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data)
+ return;
+ if (data->clientVersion < 18)
+ return;
+ send_walk_fail(sd->fd, x, y);
+ }
+ }
+ else
+ {
+ unit->walktoxy(&sd->bl, x, y, 4);
+ }
+}
diff --git a/src/emap/clif.h b/src/emap/clif.h
index 9605e7c..5786e52 100644
--- a/src/emap/clif.h
+++ b/src/emap/clif.h
@@ -99,5 +99,6 @@ void eclif_addskill_pre(struct map_session_data **sdPtr,
void eclif_skillinfo_pre(struct map_session_data **sdPtr,
int *skill_idPtr,
int *infPtr);
-
+void eclif_parse_WalkToXY(int fd,
+ struct map_session_data *sd) __attribute__((nonnull (2)));
#endif // EVOL_MAP_CLIF
diff --git a/src/emap/init.c b/src/emap/init.c
index 9a1234b..4ac951d 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -312,6 +312,7 @@ HPExport void plugin_init (void)
skill->castend_pos2_unknown = eskill_castend_pos2_unknown;
skill->validate_additional_fields = eskill_validate_additional_fields;
clif->useskill = eclif_useskill;
+ clif->pWalkToXY = eclif_parse_WalkToXY;
langScriptId = script->add_str("Lang");
mountScriptId = script->add_str("mount");
diff --git a/src/emap/send.c b/src/emap/send.c
index 36e05e9..2d22363 100644
--- a/src/emap/send.c
+++ b/src/emap/send.c
@@ -12,6 +12,7 @@
#include "common/mmo.h"
#include "common/socket.h"
#include "common/strlib.h"
+#include "common/timer.h"
#include "map/clif.h"
#include "map/mob.h"
#include "map/npc.h"
@@ -482,3 +483,13 @@ void send_pc_killed(int fd, struct block_list* bl)
WFIFOL(fd, 2) = 0;
WFIFOSET(fd, 6);
}
+
+void send_walk_fail(int fd, int x, int y)
+{
+ WFIFOHEAD(fd, 10);
+ WFIFOW(fd,0) = 0xb21;
+ WFIFOL(fd, 2) = (unsigned int)timer->gettick();
+ WFIFOW(fd, 6) = x;
+ WFIFOW(fd, 8) = y;
+ WFIFOSET(fd, 10);
+}
diff --git a/src/emap/send.h b/src/emap/send.h
index 8ebb7d1..d2d6397 100644
--- a/src/emap/send.h
+++ b/src/emap/send.h
@@ -50,5 +50,8 @@ void send_pc_skin(int fd,
const char *const skin);
void send_pc_killed(int fd,
struct block_list* bl);
+void send_walk_fail(int fd,
+ int x,
+ int y);
#endif // EVOL_MAP_SEND