// アカウント変数送信 static void mapif_account_reg(int fd) { size_t len = RFIFOW(fd, 2); uint8_t buf[len]; RFIFO_BUF_CLONE(fd, buf, len); WBUFW(buf, 0) = 0x3804; mapif_sendallwos(fd, buf, WBUFW(buf, 2)); }
int mapif_account_reg(int fd,unsigned char *src) { // unsigned char buf[WBUFW(src,2)]; <- Hey, can this really be done? [Skotlex] unsigned char *buf = aCalloc(1,WBUFW(src,2)); // [Lance] - Skot... Dynamic allocation is better :D memcpy(WBUFP(buf,0),src,WBUFW(src,2)); WBUFW(buf, 0)=0x3804; mapif_sendallwos(fd, buf, WBUFW(buf,2)); aFree(buf); return 0; }
//-------------------------------- // Transmission of a party message //-------------------------------- void mapif_parse_PartyMessage(int fd, int party_id, int account_id, char *mes, int len) { WPACKETW(0) = 0x3827; WPACKETW(2) = len + 12; WPACKETL(4) = party_id; WPACKETL(8) = account_id; strncpy(WPACKETP(12), mes, len); mapif_sendallwos(fd, len + 12); return; }
// パーティ内発言 int mapif_party_message(int party_id,int account_id,char *mes,int len, int sfd) { unsigned char buf[512]; WBUFW(buf,0)=0x3827; WBUFW(buf,2)=len+12; WBUFL(buf,4)=party_id; WBUFL(buf,8)=account_id; memcpy(WBUFP(buf,12),mes,len); mapif_sendallwos(sfd, buf,len+12); return 0; }
// GM message sending int mapif_GMmessage(unsigned char *mes, int len, unsigned long color, int sfd) { unsigned char buf[2048]; if (len > 2048) len = 2047; //Make it fit to avoid crashes. [Skotlex] WBUFW(buf, 0) = 0x3800; WBUFW(buf, 2) = len; WBUFL(buf, 4) = color; memcpy(WBUFP(buf, 8), mes, len-8); mapif_sendallwos(sfd, buf, len); return 0; }
// ギルド内発言 int mapif_guild_message(int guild_id, int account_id, char *mes, int len, int sfd) { unsigned char buf[2048]; WBUFW(buf,0) = 0x3837; WBUFW(buf,2) = len + 12; WBUFL(buf,4) = guild_id; WBUFL(buf,8) = account_id; memcpy(WBUFP(buf,12), mes, len); mapif_sendallwos(sfd, buf, len + 12); return 0; }
// GM message sending int mapif_GMmessage(unsigned char *mes, int len, unsigned long color, int sfd) { unsigned char buf[2048]; if (len > 2048) len = 2047; //Make it fit to avoid crashes. [Skotlex] WBUFW(buf, 0) = 0x3800; WBUFW(buf, 2) = len; WBUFL(buf, 4) = color; memcpy(WBUFP(buf, 8), mes, len-8); mapif_sendallwos(sfd, buf, len); // ShowNotice("\033[1;34m inter server: GM[len:%d] - '%s' \033[0m\n", len, mes); return 0; }
// broadcast sending int mapif_broadcast(unsigned char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, int sfd) { unsigned char *buf = (unsigned char*)aMalloc((len)*sizeof(unsigned char)); WBUFW(buf,0) = 0x3800; WBUFW(buf,2) = len; WBUFL(buf,4) = fontColor; WBUFW(buf,8) = fontType; WBUFW(buf,10) = fontSize; WBUFW(buf,12) = fontAlign; WBUFW(buf,14) = fontY; memcpy(WBUFP(buf,16), mes, len - 16); mapif_sendallwos(sfd, buf, len); if (buf) aFree(buf); return 0; }
// Account registry transfer to map-server static void mapif_account_reg(int fd, unsigned char *src) { WBUFW(src,0)=0x3804; //NOTE: writing to RFIFO mapif_sendallwos(fd, src, WBUFW(src,2)); }