当前位置: 首页>>代码示例>>C++>>正文


C++ WBUFL函数代码示例

本文整理汇总了C++中WBUFL函数的典型用法代码示例。如果您正苦于以下问题:C++ WBUFL函数的具体用法?C++ WBUFL怎么用?C++ WBUFL使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了WBUFL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WBUFW

int32 CTCPRequestPacket::SendToSocket(uint8* data, uint32 length)
{
    int32 iResult;

    WBUFW(data,(0x00)) = length;          // packet size
    WBUFL(data,(0x04)) = 0x46465849;      // "XIFF"

    md5((uint8*)(key), blowfish.hash, 24);

	blowfish_init((int8*)blowfish.hash,16, blowfish.P, blowfish.S[0]);

	md5(data+8, data+length-0x18+0x04, length-0x18-0x04);

	uint8 tmp = (length-12)/4;
	tmp -= tmp%2;

	for(uint8 i = 0; i < tmp; i += 2) 
    {
		blowfish_encipher((uint32*)data+i+2, (uint32*)data+i+3, blowfish.P, blowfish.S[0]);
	}

	memcpy(&data[length]-0x04, key+16, 4);

    iResult = send(*m_socket, (const int8*)data, length, 0);
    if (iResult == SOCKET_ERROR) 
    {
        ShowError("send failed with error: %d\n", WSAGetLastError());
        return 0;
    }
    return ReceiveFromSocket();
}
开发者ID:fedaykinofdune,项目名称:ffxinfinity,代码行数:31,代码来源:tcp_request.cpp

示例2: mapif_party_membermoved

//Party map update notification
int mapif_party_membermoved(struct party *p, int idx)
{
	unsigned char buf[20];

	nullpo_ret(p);
	Assert_ret(idx >= 0 && idx < MAX_PARTY);
	WBUFW(buf,0) = 0x3825;
	WBUFL(buf,2) = p->party_id;
	WBUFL(buf,6) = p->member[idx].account_id;
	WBUFL(buf,10) = p->member[idx].char_id;
	WBUFW(buf,14) = p->member[idx].map;
	WBUFB(buf,16) = p->member[idx].online;
	WBUFW(buf,17) = p->member[idx].lv;
	mapif->sendall(buf, 19);
	return 0;
}
开发者ID:AramisSA,项目名称:brAthena,代码行数:17,代码来源:int_party.c

示例3: mapif_party_optionchanged

// Party setting change notification
int mapif_party_optionchanged(int fd, struct party *p, int account_id, int flag)
{
	unsigned char buf[16];
	nullpo_ret(p);
	WBUFW(buf,0)=0x3823;
	WBUFL(buf,2)=p->party_id;
	WBUFL(buf,6)=account_id;
	WBUFW(buf,10)=p->exp;
	WBUFW(buf,12)=p->item;
	WBUFB(buf,14)=flag;
	if(flag==0)
		mapif->sendall(buf,15);
	else
		mapif->send(fd,buf,15);
	return 0;
}
开发者ID:AramisSA,项目名称:brAthena,代码行数:17,代码来源:int_party.c

示例4: WBUFL

CFadeOutPacket::CFadeOutPacket(CBaseEntity * PEntity)
{
	this->type = 0x38;
	this->size = 0x0A;

	WBUFL(data,(0x04)-4) = PEntity->id;
	WBUFL(data,(0x08)-4) = PEntity->id;
	
	WBUFB(data,(0x0C)-4) = 0x6b;
	WBUFB(data,(0x0D)-4) = 0x65;
	WBUFB(data,(0x0E)-4) = 0x73;
	WBUFB(data,(0x0F)-4) = 0x75;

	WBUFW(data,(0x10)-4) = PEntity->targid;
	WBUFW(data,(0x12)-4) = PEntity->targid;
}
开发者ID:fedaykinofdune,项目名称:ffxinfinity,代码行数:16,代码来源:fade_out.cpp

示例5: recv

int32 CTCPRequestPacket::ReceiveFromSocket()
{
	int8 recvbuf[DEFAULT_BUFLEN];

	m_size = recv(*m_socket, recvbuf, DEFAULT_BUFLEN, 0);
	if (m_size == -1) 
	{
		ShowError(CL_RED"recv failed with error: %d\n" CL_RESET, WSAGetLastError());
		return 0;
	}
    if (m_size == 0) 
	{
		//ShowError("TCP Connection closing...\n");
		return 0;
	}
	if (m_size != RBUFW(recvbuf,(0x00)) || m_size < 28) 
	{
		ShowError(CL_RED"Search packetsize wrong. Size %d should be %d.\n" CL_RESET, m_size, RBUFW(recvbuf,(0x00)));
		return 0;
	}
    delete[] m_data; 
    m_data = new uint8[m_size];

    memcpy(&m_data[0], &recvbuf[0], m_size);
	WBUFL(key,(16)) = RBUFL(m_data,(m_size-4));

	return decipher();
}
开发者ID:fedaykinofdune,项目名称:ffxinfinity,代码行数:28,代码来源:tcp_request.cpp

示例6: WBUFB

void CQuestMissionLogPacket::generateCurrentMissionPacket(CCharEntity * PChar)
{
    uint16 add_on_scenarios = 0;
    
    add_on_scenarios += PChar->m_missionLog[MISSION_ACP].current;
    add_on_scenarios += PChar->m_missionLog[MISSION_AMK].current << 0x04;
    add_on_scenarios += PChar->m_missionLog[MISSION_ASA].current << 0x08;
    // Not perfect, but they display and missions DO progress. Can fix properly later. There is a delay before when the menu updates. Zoning will force it.

    uint32 chains = 0;
    chains = PChar->m_missionLog[MISSION_COP].current + 1;
    chains = ((chains * 0x08) + 0x60);

    uint32 soa = (PChar->m_missionLog[MISSION_SOA].current * 2) + 0x6E;
    uint32 rov = PChar->m_missionLog[MISSION_ROV].current + 0x6C;

    // While current National Missions + Zilart Mission are updated in this packet, completed missions are sent in a separate one.
    WBUFB(data, (0x04)) = PChar->profile.nation;                                // Nation
    WBUFW(data, (0x08)) = PChar->m_missionLog[PChar->profile.nation].current;   // National Missions
    WBUFW(data, (0x0C)) = PChar->m_missionLog[MISSION_ZILART].current;          // Rise of the Zilart

    // But for COP, Add-On Scenarios, SOA, and ROV, sending the current mission will also update that log's completed missions.
    WBUFL(data, (0x10)) = chains;												// Chains of Promathia Missions
    //WBUFB(data,(0x16)) = 0x30;                                                // назначение неизвестно
    WBUFW(data, (0x18)) = add_on_scenarios;                                     // A Crystalline Prophecy, A Moogle Kupo d'Etat, A Shantotto Ascension
    WBUFW(data, (0x1C)) = soa;                                                  // Seekers of Adoulin
    WBUFW(data, (0x20)) = rov;                                                  // Rhapsodies of Vana'diel
}
开发者ID:Darkstorm87,项目名称:darkstar,代码行数:28,代码来源:quest_mission_log.cpp

示例7: Sql_Query

void CParty::AddMember(uint32 id)
{
	if (m_PartyType == PARTY_PCS)
	{
        uint32 allianceid = 0;
        if (m_PAlliance)
        {
            allianceid = m_PAlliance->m_AllianceID;
        }
		Sql_Query(SqlHandle, "INSERT INTO accounts_parties (charid, partyid, allianceid, partyflag) VALUES (%u, %u, %u, %u);", id, m_PartyID, allianceid, 0);
		uint8 data[4];
		WBUFL(data, 0) = m_PartyID;
        message::send(MSG_PT_RELOAD, data, sizeof data, nullptr);

		/*if (PChar->nameflags.flags & FLAG_INVITE)
		{
			PChar->nameflags.flags ^= FLAG_INVITE;
            PChar->updatemask |= UPDATE_HP;

			charutils::SaveCharStats(PChar);

			PChar->status = STATUS_UPDATE;
			PChar->pushPacket(new CMenuConfigPacket(PChar));
			PChar->pushPacket(new CCharUpdatePacket(PChar));
			PChar->pushPacket(new CCharSyncPacket(PChar));
		}
		PChar->PTreasurePool->UpdatePool(PChar);*/
	}
}
开发者ID:Anthiam,项目名称:darkstar,代码行数:29,代码来源:party.cpp

示例8: chmapif_sendall_playercount

/**
 * Send to map-servers the users count on this char-serv, (meaning the total of all mapserv)
 * @param users: number of players on this char-serv
 */
void chmapif_sendall_playercount(int users){
	uint8 buf[6];
	// send number of players to all map-servers
	WBUFW(buf,0) = 0x2b00;
	WBUFL(buf,2) = users;
	chmapif_sendall(buf,6);
}
开发者ID:jespirit,项目名称:rathena,代码行数:11,代码来源:char_mapif.c

示例9: WBUFL

CTreasureFindItemPacket::CTreasureFindItemPacket(TreasurePoolItem* PItem , CBaseEntity* PMob) 
{
	this->type = 0xD2;
	this->size = 0x1E;

	WBUFL(data,(0x04)-4) = 1;                   // ItemQuantity, а вожможен размер, отличный от единицы, исключая gil ???
	WBUFW(data,(0x10)-4) = PItem->ID;           // ItemID
	WBUFB(data,(0x14)-4) = PItem->SlotID;       // TreasurePool slotID
	WBUFL(data,(0x18)-4) = PItem->TimeStamp;    // TimeStamp

	if (PMob != nullptr)
	{
		WBUFL(data,(0x08)-4) = PMob->id; 		// ID монстра	
		WBUFW(data,(0x12)-4) = PMob->targid; 	// TargID монстра
	}
}
开发者ID:Ex0r,项目名称:darkstar,代码行数:16,代码来源:treasure_find_item.cpp

示例10: chlogif_broadcast_user_count

int chlogif_broadcast_user_count(int tid, unsigned int tick, int id, intptr_t data)
{
	uint8 buf[6];
	int users = char_count_users();

	// only send an update when needed
	static int prev_users = 0;
	if( prev_users == users )
		return 0;
	prev_users = users;

	if( chlogif_isconnected() )
	{
		// send number of user to login server
		WFIFOHEAD(login_fd,6);
		WFIFOW(login_fd,0) = 0x2714;
		WFIFOL(login_fd,2) = users;
		WFIFOSET(login_fd,6);
	}

	// send number of players to all map-servers
	WBUFW(buf,0) = 0x2b00;
	WBUFL(buf,2) = users;
	chmapif_sendall(buf,6);

	return 0;
}
开发者ID:2serv,项目名称:rathena,代码行数:27,代码来源:char_logif.c

示例11: chmapif_parse_getmapname

/**
 * This function is called when the map-serv initialise is chrif interface.
 * Map-serv sent us his map indexes so we can transfert a player from a map-serv to another when necessary
 * We reply by sending back the char_serv_wisp_name  fame list and
 * @param fd: wich fd to parse from
 * @param id: wich map_serv id
 * @return : 0 not enough data received, 1 success
 */
int chmapif_parse_getmapname(int fd, int id){
	int j = 0, i = 0;
	if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
		return 0;

	//Retain what map-index that map-serv contains
	memset(map_server[id].map, 0, sizeof(map_server[id].map));
	for(i = 4; i < RFIFOW(fd,2); i += 4) {
		map_server[id].map[j] = RFIFOW(fd,i);
		j++;
	}

	ShowStatus("Map-Server %d connected: %d maps, from IP %d.%d.%d.%d port %d.\n",
				id, j, CONVIP(map_server[id].ip), map_server[id].port);
	ShowStatus("Map-server %d loading complete.\n", id);

	// send name for wisp to player
	WFIFOHEAD(fd, 3 + NAME_LENGTH);
	WFIFOW(fd,0) = 0x2afb;
	WFIFOB(fd,2) = 0; //0 succes, 1:failure
	memcpy(WFIFOP(fd,3), charserv_config.wisp_server_name, NAME_LENGTH);
	WFIFOSET(fd,3+NAME_LENGTH);

	chmapif_send_fame_list(fd); //Send fame list.

	{
		int x;
		if (j == 0) {
			ShowWarning("Map-server %d has NO maps.\n", id);
		} else {
			unsigned char buf[16384];
			// Transmitting maps information to the other map-servers
			WBUFW(buf,0) = 0x2b04;
			WBUFW(buf,2) = j * 4 + 10;
			WBUFL(buf,4) = htonl(map_server[id].ip);
			WBUFW(buf,8) = htons(map_server[id].port);
			memcpy(WBUFP(buf,10), RFIFOP(fd,4), j * 4);
			chmapif_sendallwos(fd, buf, WBUFW(buf,2));
		}
		// Transmitting the maps of the other map-servers to the new map-server
		for(x = 0; x < ARRAYLENGTH(map_server); x++) {
			if (map_server[x].fd > 0 && x != id) {
				WFIFOHEAD(fd,10 +4*ARRAYLENGTH(map_server[x].map));
				WFIFOW(fd,0) = 0x2b04;
				WFIFOL(fd,4) = htonl(map_server[x].ip);
				WFIFOW(fd,8) = htons(map_server[x].port);
				j = 0;
				for(i = 0; i < ARRAYLENGTH(map_server[x].map); i++)
					if (map_server[x].map[i])
						WFIFOW(fd,10+(j++)*4) = map_server[x].map[i];
				if (j > 0) {
					WFIFOW(fd,2) = j * 4 + 10;
					WFIFOSET(fd,WFIFOW(fd,2));
				}
			}
		}
	}
	RFIFOSKIP(fd,RFIFOW(fd,2));
	return 1;
}
开发者ID:jespirit,项目名称:rathena,代码行数:68,代码来源:char_mapif.c

示例12: WBUFW

CMessageStandardPacket::CMessageStandardPacket(CCharEntity* PChar, uint32 param0, uint32 param1, uint16 MessageID)
{
	this->type = 0x09;
	this->size = 0x12;

	WBUFW(data,(0x0A)-4) = MessageID;

	if (PChar != nullptr)
	{
		WBUFL(data,(0x04)-4) = PChar->id;
		WBUFW(data,(0x08)-4) = PChar->targid;
		
		if (MessageID == 0x59) 
		{
			this->size = 0x30;

			WBUFB(data,(0x0C)-4) = 0x10;

			snprintf((int8*)data+(0x0D)-4, 24, "string2 %s", PChar->GetName());
		}
	}
	else
	{
		snprintf((int8*)data+(0x0D)-4, 20, "Para0 %d Para1 %d", param0, param1);
	}
}
开发者ID:Ex0r,项目名称:darkstar,代码行数:26,代码来源:message_standard.cpp

示例13: mapif_party_optionchanged

// パーティ設定変更通知
int mapif_party_optionchanged(int fd,struct party *p,int account_id,int flag)
{
	unsigned char buf[16];
	WBUFW(buf,0)=0x3823;
	WBUFL(buf,2)=p->party_id;
	WBUFL(buf,6)=account_id;
	WBUFW(buf,10)=p->exp;
	WBUFW(buf,12)=p->item;
	WBUFB(buf,14)=flag;
	if(flag==0)
		mapif_sendall(buf,15);
	else
		mapif_send(fd,buf,15);
	printf("int_party: option changed %d %d %d %d %d\n",p->party_id,account_id,p->exp,p->item,flag);
	return 0;
}
开发者ID:AxlSckay,项目名称:Ragnarok-OldTimes,代码行数:17,代码来源:int_party.c

示例14: CBasicPacket

CShopItemsPacket::CShopItemsPacket(CCharEntity * PChar)
{
	this->type = 0x3C;
	this->size = 0x04;

	uint8 ItemsCount = PChar->Container->getItemsCount();

    uint8 i = 0;
	for (uint8 slotID = 0; slotID < ItemsCount; ++slotID)
	{
        if (i == 20)
        {
            PChar->pushPacket(new CBasicPacket(*this));

            i = 0;
            this->size = 0x04;
            memset(data, 0, sizeof(data));
        }
		this->size += 0x06;

		WBUFL(data,((i*12)+0x08)-4) = PChar->Container->getQuantity(slotID);
		WBUFW(data,((i*12)+0x0C)-4) = PChar->Container->getItemID(slotID);
		WBUFB(data,((i*12)+0x0E)-4) = slotID;
        i++;
	}
}
开发者ID:Celyste,项目名称:darkstar,代码行数:26,代码来源:shop_items.cpp

示例15: WBUFB

CShopBuyPacket::CShopBuyPacket(uint8 slotID, uint32 quantity)
{
	this->type = 0x3F;
	this->size = 0x06;

	WBUFB(data,(0x04)-4) = slotID;
	WBUFL(data,(0x08)-4) = quantity;
}
开发者ID:Gwynthell,项目名称:FFDB,代码行数:8,代码来源:shop_buy.cpp


注:本文中的WBUFL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。