本文整理汇总了C++中RFIFOP函数的典型用法代码示例。如果您正苦于以下问题:C++ RFIFOP函数的具体用法?C++ RFIFOP怎么用?C++ RFIFOP使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了RFIFOP函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: intif_parse_WisMessage
// Wisp/Page reception
static
int intif_parse_WisMessage (int fd)
{ // rewritten by [Yor]
struct map_session_data *sd;
int i;
if (battle_config.etc_log)
printf
("intif_parse_wismessage: id: %d, from: %s, to: %s, message: '%s'\n",
RFIFOL (fd, 4), RFIFOP (fd, 8), RFIFOP (fd, 32), RFIFOP (fd,
56));
sd = map_nick2sd ((const char *)RFIFOP (fd, 32)); // Searching destination player
if (sd != NULL && strcmp (sd->status.name, (const char *)RFIFOP (fd, 32)) == 0)
{ // exactly same name (inter-server have checked the name before)
// if player ignore all
if (sd->ignoreAll == 1)
intif_wis_replay (RFIFOL (fd, 4), 2); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
else
{
const char *wisp_source = (const char *)RFIFOP (fd, 8); // speed up
// if player ignore the source character
for (i = 0; i < (sizeof (sd->ignore) / sizeof (sd->ignore[0]));
i++)
if (strcmp (sd->ignore[i].name, wisp_source) == 0)
{
intif_wis_replay (RFIFOL (fd, 4), 2); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
break;
}
// if source player not found in ignore list
if (i == (sizeof (sd->ignore) / sizeof (sd->ignore[0])))
{
clif_wis_message (sd->fd, (const char *)RFIFOP (fd, 8), (const char *)RFIFOP (fd, 56),
RFIFOW (fd, 2) - 56);
intif_wis_replay (RFIFOL (fd, 4), 0); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
}
}
}
else
intif_wis_replay (RFIFOL (fd, 4), 1); // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
return 0;
}
示例2: inter_party_parse_frommap
// map server からの通信
// ・1パケットのみ解析すること
// ・パケット長データはinter.cにセットしておくこと
// ・パケット長チェックや、RFIFOSKIPは呼び出し元で行われるので行ってはならない
// ・エラーなら0(false)、そうでないなら1(true)をかえさなければならない
int inter_party_parse_frommap(int fd)
{
switch(RFIFOW(fd,0)){
case 0x3020: mapif_parse_CreateParty(fd,RFIFOL(fd,2),(char*)RFIFOP(fd,6),(char*)RFIFOP(fd,30),(char*)RFIFOP(fd,54),RFIFOW(fd,70), RFIFOB(fd,72), RFIFOB(fd,73)); break;
case 0x3021: mapif_parse_PartyInfo(fd,RFIFOL(fd,2)); break;
case 0x3022: mapif_parse_PartyAddMember(fd,RFIFOL(fd,2),RFIFOL(fd,6),(char*)RFIFOP(fd,10),(char*)RFIFOP(fd,34),RFIFOW(fd,50)); break;
case 0x3023: mapif_parse_PartyChangeOption(fd,RFIFOL(fd,2),RFIFOL(fd,6),RFIFOW(fd,10),RFIFOW(fd,12)); break;
case 0x3024: mapif_parse_PartyLeave(fd,RFIFOL(fd,2),RFIFOL(fd,6)); break;
case 0x3025: mapif_parse_PartyChangeMap(fd,RFIFOL(fd,2),RFIFOL(fd,6),(char*)RFIFOP(fd,10),RFIFOB(fd,26),RFIFOW(fd,27)); break;
case 0x3026: mapif_parse_BreakParty(fd,RFIFOL(fd,2)); break;
case 0x3027: mapif_parse_PartyMessage(fd,RFIFOL(fd,4),RFIFOL(fd,8),(char*)RFIFOP(fd,12),RFIFOW(fd,2)-12); break;
case 0x3028: mapif_parse_PartyCheck(fd,RFIFOL(fd,2),RFIFOL(fd,6),(char*)RFIFOP(fd,10)); break;
default:
return 0;
}
return 1;
}
示例3: mapif_parse_SaveGuildStorage
int mapif_parse_SaveGuildStorage(int fd)
{
int guild_exist=1;
int guild_id;
int len;
RFIFOHEAD(fd);
guild_id=RFIFOL(fd,8);
len=RFIFOW(fd,2);
if(sizeof(struct guild_storage)!=len-12) {
ShowError("inter storage: data size error %d %d\n",sizeof(struct guild_storage),len-12);
}
else {
#if 0 // Again, innodb key checks make the check pointless
// Check if guild exists, I may write a function for this later, coz I use it several times.
//printf("- Check if guild %d exists\n",g->guild_id);
sprintf(tmp_sql, "SELECT count(*) FROM `%s` WHERE `guild_id`='%d'",guild_db, guild_id);
if(mysql_query(&mysql_handle, tmp_sql) ) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
sql_res = mysql_store_result(&mysql_handle) ;
if (sql_res!=NULL && mysql_num_rows(sql_res)>0) {
sql_row = mysql_fetch_row(sql_res);
guild_exist = atoi (sql_row[0]);
//printf("- Check if guild %d exists : %s\n",g->guild_id,((guild_exist==0)?"No":"Yes"));
}
mysql_free_result(sql_res) ; //resource free
#endif
if(guild_exist==1) {
memcpy(guild_storage_pt,RFIFOP(fd,12),sizeof(struct guild_storage));
guild_storage_tosql(guild_id,guild_storage_pt);
mapif_save_guild_storage_ack(fd,RFIFOL(fd,4),guild_id,0);
}
else
mapif_save_guild_storage_ack(fd,RFIFOL(fd,4),guild_id,1);
}
return 0;
}
示例4: intif_parse_GuildMemberInfoChanged
// ギルドメンバ情報変更通知
static
int intif_parse_GuildMemberInfoChanged (int fd)
{
int type = RFIFOW (fd, 16), guild_id = RFIFOL (fd, 4);
int account_id = RFIFOL (fd, 8), char_id = RFIFOL (fd, 12);
void *data = RFIFOP (fd, 18);
struct guild *g = guild_search (guild_id);
int idx, dd = *((int *) data);
if (g == NULL)
return 0;
idx = guild_getindex (g, account_id, char_id);
switch (type)
{
case GMI_POSITION:
g->member[idx].position = dd;
guild_memberposition_changed (g, idx, dd);
break;
case GMI_EXP:
g->member[idx].exp = dd;
break;
}
return 0;
}
示例5: mapif_parse_Mail_receiver_check
static void mapif_parse_Mail_receiver_check(int fd) {
char name[NAME_LENGTH], esc_name[NAME_LENGTH * 2 + 1];
uint32 char_id = 0;
uint16 class_ = 0, base_level = 0;
safestrncpy(name, (char *)RFIFOP(fd,6), NAME_LENGTH);
// Try to find the Dest Char by Name
Sql_EscapeStringLen(sql_handle, esc_name, name, strnlen(name, NAME_LENGTH));
if( SQL_ERROR == Sql_Query(sql_handle, "SELECT `char_id`,`class`,`base_level` FROM `%s` WHERE `name` = '%s'", char_db, esc_name) )
Sql_ShowDebug(sql_handle);
else if( SQL_SUCCESS == Sql_NextRow(sql_handle) ) {
char *data;
Sql_GetData(sql_handle, 0, &data, NULL); char_id = atoi(data);
Sql_GetData(sql_handle, 1, &data, NULL); class_ = atoi(data);
Sql_GetData(sql_handle, 2, &data, NULL); base_level = atoi(data);
}
Sql_FreeResult(sql_handle);
mapif_Mail_receiver_send(fd, RFIFOL(fd,2), char_id, class_, base_level, name);
}
示例6: intif_parse_GuildInfo
// ギルド情報
static
int intif_parse_GuildInfo (int fd)
{
if (RFIFOW (fd, 2) == 8)
{
if (battle_config.error_log)
printf ("intif: guild noinfo %d\n", RFIFOL (fd, 4));
guild_recv_noinfo (RFIFOL (fd, 4));
return 0;
}
// if(battle_config.etc_log)
// printf("intif: guild info %d\n",RFIFOL(fd,4));
if (RFIFOW (fd, 2) != sizeof (struct guild) + 4)
{
if (battle_config.error_log)
printf ("intif: guild info : data size error\n %d %d %d",
RFIFOL (fd, 4), RFIFOW (fd, 2),
sizeof (struct guild) + 4);
}
guild_recv_info ((struct guild *) RFIFOP (fd, 4));
return 0;
}
示例7: mapif_parse_Mail_send
static void mapif_parse_Mail_send(int fd)
{
struct mail_message msg;
char esc_name[NAME_LENGTH*2+1];
int account_id = 0;
if(RFIFOW(fd,2) != 8 + sizeof(struct mail_message))
return;
account_id = RFIFOL(fd,4);
memcpy(&msg, RFIFOP(fd,8), sizeof(struct mail_message));
// Try to find the Dest Char by Name
SQL->EscapeStringLen(sql_handle, esc_name, msg.dest_name, strnlen(msg.dest_name, NAME_LENGTH));
if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`, `char_id` FROM `%s` WHERE `name` = '%s'", char_db, esc_name) )
Sql_ShowDebug(sql_handle);
else
if ( SQL_SUCCESS == SQL->NextRow(sql_handle) )
{
char *data;
SQL->GetData(sql_handle, 0, &data, NULL);
if (atoi(data) != account_id)
{ // Cannot send mail to char in the same account
SQL->GetData(sql_handle, 1, &data, NULL);
msg.dest_id = atoi(data);
}
}
SQL->FreeResult(sql_handle);
msg.status = MAIL_NEW;
if( msg.dest_id > 0 )
msg.id = mail_savemessage(&msg);
mapif_Mail_send(fd, &msg); // notify sender
mapif_Mail_new(&msg); // notify recipient
}
示例8: intif_parse_GuildBasicInfoChanged
// ギルド基本情報変更通知
static
int intif_parse_GuildBasicInfoChanged (int fd)
{
int type = RFIFOW (fd, 8), guild_id = RFIFOL (fd, 4);
void *data = RFIFOP (fd, 10);
struct guild *g = guild_search (guild_id);
short dw = *((short *) data);
int dd = *((int *) data);
if (g == NULL)
return 0;
switch (type)
{
case GBI_EXP:
g->exp = dd;
break;
case GBI_GUILDLV:
g->guild_lv = dw;
break;
case GBI_SKILLPOINT:
g->skill_point = dd;
break;
}
return 0;
}
示例9: intif_parse_GuildCastleAllDataLoad
// ギルド城データ一括受信(初期化時)
static
int intif_parse_GuildCastleAllDataLoad (int fd)
{
return guild_castlealldataload (RFIFOW (fd, 2),
(struct guild_castle *) RFIFOP (fd, 4));
}
示例10: intif_parse_GuildNotice
// ギルド告知変更通知
static
int intif_parse_GuildNotice (int fd)
{
guild_notice_changed (RFIFOL (fd, 2), (const char *)RFIFOP (fd, 6), (const char *)RFIFOP (fd, 66));
return 0;
}
示例11: inter_homunculus_parse_frommap
/*==========================================
* Inter Packets
*------------------------------------------*/
int inter_homunculus_parse_frommap(int fd)
{
unsigned short cmd = RFIFOW(fd,0);
switch( cmd )
{
case 0x3090: mapif_parse_homunculus_create(fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,8)); break;
case 0x3091: mapif_parse_homunculus_load (fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6)); break;
case 0x3092: mapif_parse_homunculus_save (fd, (int)RFIFOW(fd,2), (int)RFIFOL(fd,4), (struct s_homunculus*)RFIFOP(fd,8)); break;
case 0x3093: mapif_parse_homunculus_delete(fd, (int)RFIFOL(fd,2)); break;
case 0x3094: mapif_parse_homunculus_rename(fd, (int)RFIFOL(fd,2), (int)RFIFOL(fd,6), (char*)RFIFOP(fd,10)); break;
default:
return 0;
}
return 1;
}
示例12: mapif_parse_accinfo
/* [Dekamaster/Nightroad] */
void mapif_parse_accinfo(int fd) {
int u_fd = RFIFOL(fd,2), aid = RFIFOL(fd,6), castergroup = RFIFOL(fd,10);
char query[NAME_LENGTH], query_esq[NAME_LENGTH*2+1];
int account_id;
char *data;
safestrncpy(query, (char*) RFIFOP(fd,14), NAME_LENGTH);
SQL->EscapeString(sql_handle, query_esq, query);
account_id = atoi(query);
if (account_id < START_ACCOUNT_NUM) { // is string
if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `account_id`,`name`,`class`,`base_level`,`job_level`,`online` FROM `%s` WHERE `name` LIKE '%s' LIMIT 10", char_db, query_esq)
|| SQL->NumRows(sql_handle) == 0 ) {
if( SQL->NumRows(sql_handle) == 0 ) {
inter_msg_to_fd(fd, u_fd, aid, "No matches were found for your criteria, '%s'",query);
} else {
Sql_ShowDebug(sql_handle);
inter_msg_to_fd(fd, u_fd, aid, "An error occured, bother your admin about it.");
}
SQL->FreeResult(sql_handle);
return;
} else {
if( SQL->NumRows(sql_handle) == 1 ) {//we found a perfect match
SQL->NextRow(sql_handle);
SQL->GetData(sql_handle, 0, &data, NULL); account_id = atoi(data);
SQL->FreeResult(sql_handle);
} else {// more than one, listing... [Dekamaster/Nightroad]
inter_msg_to_fd(fd, u_fd, aid, "Your query returned the following %d results, please be more specific...",(int)SQL->NumRows(sql_handle));
while ( SQL_SUCCESS == SQL->NextRow(sql_handle) ) {
int class_;
short base_level, job_level, online;
char name[NAME_LENGTH];
SQL->GetData(sql_handle, 0, &data, NULL); account_id = atoi(data);
SQL->GetData(sql_handle, 1, &data, NULL); safestrncpy(name, data, sizeof(name));
SQL->GetData(sql_handle, 2, &data, NULL); class_ = atoi(data);
SQL->GetData(sql_handle, 3, &data, NULL); base_level = atoi(data);
SQL->GetData(sql_handle, 4, &data, NULL); job_level = atoi(data);
SQL->GetData(sql_handle, 5, &data, NULL); online = atoi(data);
inter_msg_to_fd(fd, u_fd, aid, "[AID: %d] %s | %s | Level: %d/%d | %s", account_id, name, job_name(class_), base_level, job_level, online?"Online":"Offline");
}
SQL->FreeResult(sql_handle);
return;
}
}
}
/* it will only get here if we have a single match */
if( account_id ) {
char userid[NAME_LENGTH], user_pass[NAME_LENGTH], email[40], last_ip[20], lastlogin[30], pin_code[5], birthdate[11];
short level = -1;
int logincount = 0,state = 0;
// FIXME: No, this doesn't really look right. We can't, and shouldn't, access the login table from the char server.
if ( SQL_ERROR == SQL->Query(sql_handle, "SELECT `userid`, `user_pass`, `email`, `last_ip`, `group_id`, `lastlogin`, `logincount`, `state`,`pincode`,`birthdate` FROM `login` WHERE `account_id` = '%d' LIMIT 1", account_id)
|| SQL->NumRows(sql_handle) == 0 ) {
if( SQL->NumRows(sql_handle) == 0 ) {
inter_msg_to_fd(fd, u_fd, aid, "No account with ID '%d' was found.", account_id );
} else {
inter_msg_to_fd(fd, u_fd, aid, "An error occured, bother your admin about it.");
Sql_ShowDebug(sql_handle);
}
} else {
SQL->NextRow(sql_handle);
SQL->GetData(sql_handle, 0, &data, NULL); safestrncpy(userid, data, sizeof(userid));
SQL->GetData(sql_handle, 1, &data, NULL); safestrncpy(user_pass, data, sizeof(user_pass));
SQL->GetData(sql_handle, 2, &data, NULL); safestrncpy(email, data, sizeof(email));
SQL->GetData(sql_handle, 3, &data, NULL); safestrncpy(last_ip, data, sizeof(last_ip));
SQL->GetData(sql_handle, 4, &data, NULL); level = atoi(data);
SQL->GetData(sql_handle, 5, &data, NULL); safestrncpy(lastlogin, data, sizeof(lastlogin));
SQL->GetData(sql_handle, 6, &data, NULL); logincount = atoi(data);
SQL->GetData(sql_handle, 7, &data, NULL); state = atoi(data);
SQL->GetData(sql_handle, 8, &data, NULL); safestrncpy(pin_code, data, sizeof(pin_code));
SQL->GetData(sql_handle, 9, &data, NULL); safestrncpy(birthdate, data, sizeof(birthdate));
}
SQL->FreeResult(sql_handle);
if (level == -1)
return;
inter_msg_to_fd(fd, u_fd, aid, "-- Account %d --", account_id );
inter_msg_to_fd(fd, u_fd, aid, "User: %s | GM Group: %d | State: %d", userid, level, state );
if (level < castergroup) { /* only show pass if your gm level is greater than the one you're searching for */
if( strlen(pin_code) )
inter_msg_to_fd(fd, u_fd, aid, "Password: %s (PIN:%s)", user_pass, pin_code );
else
inter_msg_to_fd(fd, u_fd, aid, "Password: %s", user_pass );
}
inter_msg_to_fd(fd, u_fd, aid, "Account e-mail: %s | Birthdate: %s", email, birthdate);
inter_msg_to_fd(fd, u_fd, aid, "Last IP: %s (%s)", last_ip, geoip_getcountry(str2ip(last_ip)) );
inter_msg_to_fd(fd, u_fd, aid, "This user has logged %d times, the last time were at %s", logincount, lastlogin );
inter_msg_to_fd(fd, u_fd, aid, "-- Character Details --" );
//.........这里部分代码省略.........
示例13: mapif_parse_WisRequest
// Wisp/page request to send
int mapif_parse_WisRequest(int fd)
{
struct WisData* wd;
static int wisid = 0;
char name[NAME_LENGTH];
char esc_name[NAME_LENGTH*2+1];// escaped name
char* data;
size_t len;
if ( fd <= 0 ) {return 0;} // check if we have a valid fd
if (RFIFOW(fd,2)-52 >= sizeof(wd->msg)) {
ShowWarning("inter: Wis message size too long.\n");
return 0;
} else if (RFIFOW(fd,2)-52 <= 0) { // normaly, impossible, but who knows...
ShowError("inter: Wis message doesn't exist.\n");
return 0;
}
safestrncpy(name, (char*)RFIFOP(fd,28), NAME_LENGTH); //Received name may be too large and not contain \0! [Skotlex]
SQL->EscapeStringLen(sql_handle, esc_name, name, strnlen(name, NAME_LENGTH));
if( SQL_ERROR == SQL->Query(sql_handle, "SELECT `name` FROM `%s` WHERE `name`='%s'", char_db, esc_name) )
Sql_ShowDebug(sql_handle);
// search if character exists before to ask all map-servers
if( SQL_SUCCESS != SQL->NextRow(sql_handle) )
{
unsigned char buf[27];
WBUFW(buf, 0) = 0x3802;
memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), NAME_LENGTH);
WBUFB(buf,26) = 1; // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
mapif_send(fd, buf, 27);
}
else
{// Character exists. So, ask all map-servers
// to be sure of the correct name, rewrite it
SQL->GetData(sql_handle, 0, &data, &len);
memset(name, 0, NAME_LENGTH);
memcpy(name, data, min(len, NAME_LENGTH));
// if source is destination, don't ask other servers.
if( strncmp((const char*)RFIFOP(fd,4), name, NAME_LENGTH) == 0 )
{
uint8 buf[27];
WBUFW(buf, 0) = 0x3802;
memcpy(WBUFP(buf, 2), RFIFOP(fd, 4), NAME_LENGTH);
WBUFB(buf,26) = 1; // flag: 0: success to send wisper, 1: target character is not loged in?, 2: ignored by target
mapif_send(fd, buf, 27);
}
else
{
CREATE(wd, struct WisData, 1);
// Whether the failure of previous wisp/page transmission (timeout)
check_ttl_wisdata();
wd->id = ++wisid;
wd->fd = fd;
wd->len= RFIFOW(fd,2)-52;
memcpy(wd->src, RFIFOP(fd, 4), NAME_LENGTH);
memcpy(wd->dst, RFIFOP(fd,28), NAME_LENGTH);
memcpy(wd->msg, RFIFOP(fd,52), wd->len);
wd->tick = timer->gettick();
idb_put(wis_db, wd->id, wd);
mapif_wis_message(wd);
}
}
SQL->FreeResult(sql_handle);
return 0;
}
示例14: mapif_parse_SavePet
int mapif_parse_SavePet(int fd)
{
RFIFOHEAD(fd);
mapif->save_pet(fd, RFIFOL(fd, 4), RFIFOP(fd, 8));
return 0;
}
示例15: intif_parse_LoadGuildStorage
static
int intif_parse_LoadGuildStorage (int fd)
{
struct guild_storage *gstor;
struct map_session_data *sd;
int guild_id;
guild_id = RFIFOL (fd, 8);
if (guild_id > 0)
{
gstor = guild2storage (guild_id);
if (!gstor)
{
if (battle_config.error_log)
printf
("intif_parse_LoadGuildStorage: error guild_id %d not exist\n",
guild_id);
return 1;
}
if (RFIFOW (fd, 2) - 12 != sizeof (struct guild_storage))
{
gstor->storage_status = 0;
if (battle_config.error_log)
printf
("intif_parse_LoadGuildStorage: data size error %d %d\n",
RFIFOW (fd, 2) - 12, sizeof (struct guild_storage));
return 1;
}
sd = map_id2sd (RFIFOL (fd, 4));
if (sd == NULL)
{
if (battle_config.error_log)
printf ("intif_parse_LoadGuildStorage: user not found %d\n",
RFIFOL (fd, 4));
return 1;
}
if (gstor->storage_status == 1)
{ // Already open.. lets ignore this update
if (battle_config.error_log)
printf
("intif_parse_LoadGuildStorage: storage received for a client already open (User %d:%d)\n",
sd->status.account_id, sd->status.char_id);
return 1;
}
if (gstor->dirty)
{ // Already have storage, and it has been modified and not saved yet! Exploit! [Skotlex]
if (battle_config.error_log)
printf
("intif_parse_LoadGuildStorage: received storage for an already modified non-saved storage! (User %d:%d)\n",
sd->status.account_id, sd->status.char_id);
return 1;
}
if (battle_config.save_log)
printf ("intif_open_guild_storage: %d\n", RFIFOL (fd, 4));
memcpy (gstor, RFIFOP (fd, 12), sizeof (struct guild_storage));
gstor->storage_status = 1;
sd->state.storage_flag = 2;
clif_guildstorageitemlist (sd, gstor);
clif_guildstorageequiplist (sd, gstor);
clif_updateguildstorageamount (sd, gstor);
}
return 0;
}