Follow up to 58c2b77
* Fixed #484,Client Crashing 2014-10-22, thank you @gengstergile, @limitro * small fix script command
This commit is contained in:
parent
219a047ea7
commit
88cfff01e6
@ -5759,12 +5759,18 @@ void clif_displaymessage(const int fd, const char* mes)
|
|||||||
if (fd == 0)
|
if (fd == 0)
|
||||||
;
|
;
|
||||||
else {
|
else {
|
||||||
|
char *message, *line;
|
||||||
|
|
||||||
|
message = aStrdup(mes);
|
||||||
|
line = strtok(message, "\n");
|
||||||
|
|
||||||
#if PACKETVER == 20141022
|
#if PACKETVER == 20141022
|
||||||
/** for some reason game client crashes depending on message pattern (only for this packet) **/
|
/** for some reason game client crashes depending on message pattern (only for this packet) **/
|
||||||
/** so we redirect to ZC_NPC_CHAT **/
|
/** so we redirect to ZC_NPC_CHAT **/
|
||||||
//clif_colormes(fd, color_table[COLOR_DEFAULT], mes);
|
//clif_colormes(fd, color_table[COLOR_DEFAULT], mes);
|
||||||
|
while(line != NULL) {
|
||||||
unsigned long color = (color_table[COLOR_DEFAULT] & 0x0000FF) << 16 | (color_table[COLOR_DEFAULT] & 0x00FF00) | (color_table[COLOR_DEFAULT] & 0xFF0000) >> 16; // RGB to BGR
|
unsigned long color = (color_table[COLOR_DEFAULT] & 0x0000FF) << 16 | (color_table[COLOR_DEFAULT] & 0x00FF00) | (color_table[COLOR_DEFAULT] & 0xFF0000) >> 16; // RGB to BGR
|
||||||
unsigned short len = strnlen(mes, CHAT_SIZE_MAX);
|
unsigned short len = strnlen(line, CHAT_SIZE_MAX);
|
||||||
|
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
WFIFOHEAD(fd, 13 + len);
|
WFIFOHEAD(fd, 13 + len);
|
||||||
@ -5772,17 +5778,13 @@ void clif_displaymessage(const int fd, const char* mes)
|
|||||||
WFIFOW(fd, 2) = 13 + len;
|
WFIFOW(fd, 2) = 13 + len;
|
||||||
WFIFOL(fd, 4) = 0;
|
WFIFOL(fd, 4) = 0;
|
||||||
WFIFOL(fd, 8) = color;
|
WFIFOL(fd, 8) = color;
|
||||||
safestrncpy((char*)WFIFOP(fd, 12), mes, len+1);
|
safestrncpy((char*)WFIFOP(fd, 12), line, len + 1);
|
||||||
WFIFOSET(fd, WFIFOW(fd, 2));
|
WFIFOSET(fd, WFIFOW(fd, 2));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
char *message, *line;
|
|
||||||
|
|
||||||
message = aStrdup(mes);
|
|
||||||
line = strtok(message, "\n");
|
|
||||||
while(line != NULL) {
|
while(line != NULL) {
|
||||||
// Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client)
|
// Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client)
|
||||||
int len = strnlen(line, 255);
|
int len = strnlen(line, CHAT_SIZE_MAX);
|
||||||
|
|
||||||
if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line.
|
if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line.
|
||||||
WFIFOHEAD(fd, 5 + len);
|
WFIFOHEAD(fd, 5 + len);
|
||||||
@ -5791,10 +5793,10 @@ void clif_displaymessage(const int fd, const char* mes)
|
|||||||
safestrncpy((char *)WFIFOP(fd,4), line, len + 1);
|
safestrncpy((char *)WFIFOP(fd,4), line, len + 1);
|
||||||
WFIFOSET(fd, 5 + len);
|
WFIFOSET(fd, 5 + len);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
line = strtok(NULL, "\n");
|
line = strtok(NULL, "\n");
|
||||||
}
|
}
|
||||||
aFree(message);
|
aFree(message);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11113,7 +11113,7 @@ BUILDIN_FUNC(waitingroomkick)
|
|||||||
|
|
||||||
if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL )
|
if( nd != NULL && (cd=(struct chat_data *)map_id2bl(nd->chat_id)) != NULL )
|
||||||
chat_npckickchat(cd, kickusername);
|
chat_npckickchat(cd, kickusername);
|
||||||
return 0;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get Users in waiting room and stores gids in .@waitingroom_users[]
|
/// Get Users in waiting room and stores gids in .@waitingroom_users[]
|
||||||
@ -11139,7 +11139,7 @@ BUILDIN_FUNC(getwaitingroomusers)
|
|||||||
}
|
}
|
||||||
setd_sub(st, NULL, ".@waitingroom_usercount", 0, (void *)__64BPRTSIZE(j), NULL);
|
setd_sub(st, NULL, ".@waitingroom_usercount", 0, (void *)__64BPRTSIZE(j), NULL);
|
||||||
}
|
}
|
||||||
return 0;
|
return SCRIPT_CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Kicks all the players from the waiting room of the current or target npc.
|
/// Kicks all the players from the waiting room of the current or target npc.
|
||||||
@ -20338,7 +20338,7 @@ BUILDIN_FUNC(showscript) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!bl) {
|
if (!bl) {
|
||||||
ShowError("buildin_showscript: Script not attached. (id=%, rid=%d, oid=%d)\n", id, st->rid, st->oid);
|
ShowError("buildin_showscript: Script not attached. (id=%d, rid=%d, oid=%d)\n", id, st->rid, st->oid);
|
||||||
script_pushint(st,0);
|
script_pushint(st,0);
|
||||||
return SCRIPT_CMD_FAILURE;
|
return SCRIPT_CMD_FAILURE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user