diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 548369d5d..8e468515d 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -618,6 +618,47 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type) { return 0;
}
+//For use in the @send command.
+int clif_send_debug(struct map_session_data *sd, int cmd, int* args, int args_num)
+{
+ int fd = sd->fd;
+ int len;
+ if (cmd < 0 || cmd >= MAX_PACKET_DB)
+ return 0;
+
+ len = packet_db[sd->packet_ver][cmd].len;
+
+ if (!fd || !len || len == -1) //len -1, variable width, not supported!
+ return 0;
+
+ switch (cmd)
+ {
+ case 0x209:
+ {
+ WFIFOHEAD(fd, len);
+ WFIFOW(fd,0) = 0x209;
+ WFIFOW(fd,2) = 2;
+ memcpy(WFIFOP(fd, 12), sd->status.name, NAME_LENGTH);
+ WFIFOSET(fd, len);
+ break;
+ }
+ default:
+ {
+ int i;
+ WFIFOHEAD(fd, len);
+ memset(WFIFOP(fd,0), 0, len);
+ WFIFOW(fd,0) = cmd;
+ //Packet can only have len/2 arguments. Since each arg is a Word
+ if (args_num > len/2 -2)
+ args_num = len/2 -2;
+ for(i=0; i<args_num; i++)
+ WFIFOW(fd,i+1) = args[i];
+ WFIFOSET(fd, len);
+ break;
+ }
+ }
+ return 1;
+}
//
// パケット作って送信
//
@@ -4234,7 +4275,7 @@ int clif_01ac(struct block_list *bl) sd=va_arg(ap,struct map_session_data*);
- if (sd == NULL || session[sd->fd] == NULL)
+ if (sd == NULL || !sd->fd || session[sd->fd] == NULL)
return 0;
switch(bl->type){
|