本文整理汇总了C++中ConsoleList::SendChannelMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ ConsoleList::SendChannelMessage方法的具体用法?C++ ConsoleList::SendChannelMessage怎么用?C++ ConsoleList::SendChannelMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConsoleList
的用法示例。
在下文中一共展示了ConsoleList::SendChannelMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendChannelMessageRaw
void ZSList::SendChannelMessageRaw(const char* from, const char* to, uint8 chan_num, uint8 language, const char* message) {
if (!message)
return;
ServerPacket* pack = new ServerPacket;
pack->opcode = ServerOP_ChannelMessage;
pack->size = sizeof(ServerChannelMessage_Struct)+strlen(message)+1;
pack->pBuffer = new uchar[pack->size];
memset(pack->pBuffer, 0, pack->size);
ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer;
if (from == 0) {
strcpy(scm->from, "WServer");
scm->noreply = true;
}
else if (from[0] == 0) {
strcpy(scm->from, "WServer");
scm->noreply = true;
}
else
strcpy(scm->from, from);
if (to != 0) {
strcpy((char *) scm->to, to);
strcpy((char *) scm->deliverto, to);
}
else {
scm->to[0] = 0;
scm->deliverto[0] = 0;
}
scm->language = language;
scm->chan_num = chan_num;
strcpy(&scm->message[0], message);
if (scm->chan_num == 5 || scm->chan_num == 6 || scm->chan_num == 11) {
console_list.SendChannelMessage(scm);
}
pack->Deflate();
SendPacket(pack);
delete pack;
}
示例2: Process
//.........这里部分代码省略.........
break;
zoneserver_list.SendPacket(pack);
break;
}
case ServerOP_SpawnCondition: {
if(pack->size != sizeof(ServerSpawnCondition_Struct))
break;
//bounce the packet to the correct zone server, if its up
ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*)pack->pBuffer;
zoneserver_list.SendPacket(ssc->zoneID, ssc->instanceID, pack);
break;
}
case ServerOP_SpawnEvent: {
if(pack->size != sizeof(ServerSpawnEvent_Struct))
break;
//bounce the packet to the correct zone server, if its up
ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*)pack->pBuffer;
zoneserver_list.SendPacket(sse->zoneID, 0, pack);
break;
}
case ServerOP_ChannelMessage: {
ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer;
if(scm->chan_num == 20)
{
UCSLink.SendMessage(scm->from, scm->message);
break;
}
if (scm->chan_num == 7 || scm->chan_num == 14) {
if (scm->deliverto[0] == '*') {
Console* con = 0;
con = console_list.FindByAccountName(&scm->deliverto[1]);
if (((!con) || (!con->SendChannelMessage(scm))) && (!scm->noreply))
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
break;
}
ClientListEntry* cle = client_list.FindCharacter(scm->deliverto);
if (cle == 0 || cle->Online() < CLE_Status_Zoning || (cle->TellsOff() && ((cle->Anon() == 1 && scm->fromadmin < cle->Admin()) || scm->fromadmin < 80))) {
if (!scm->noreply)
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
}
else if (cle->Online() == CLE_Status_Zoning) {
if (!scm->noreply) {
char errbuf[MYSQL_ERRMSG_SIZE];
char *query = 0;
MYSQL_RES *result;
//MYSQL_ROW row; Trumpcard - commenting. Currently unused.
time_t rawtime;
struct tm * timeinfo;
time ( &rawtime );
timeinfo = localtime ( &rawtime );
char *telldate=asctime(timeinfo);
if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT name from character_ where name='%s'",scm->deliverto), errbuf, &result)) {
safe_delete(query);
if (result!=0) {
if (database.RunQuery(query, MakeAnyLenString(&query, "INSERT INTO tellque (Date,Receiver,Sender,Message) values('%s','%s','%s','%s')",telldate,scm->deliverto,scm->from,scm->message), errbuf, &result))
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "Your message has been added to the %s's que.", scm->to);
else
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
safe_delete(query);
}
else
zoneserver_list.SendEmoteMessage(scm->from, 0, 0, 0, "You told %s, '%s is not online at this time'", scm->to, scm->to);
mysql_free_result(result);
}