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


C++ SetByte函数代码示例

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


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

示例1: memset

void CUser::SelNationToAgent(char *pBuf)
{
	int index = 0, send_index = 0, retvalue = 0;
	int nation = 0;
	char send_buff[256];
	memset( send_buff, NULL, 256);

	nation = GetByte( pBuf, index );
	if( nation > 2 )
		goto fail_return;

	SetByte( send_buff, WIZ_SEL_NATION, send_index );
	SetShort( send_buff, m_Sid, send_index );
	SetKOString(send_buff, m_strAccountID, send_index);
	SetByte( send_buff, nation, send_index );

	retvalue = m_pMain->m_LoggerSendQueue.PutData( send_buff, send_index );
	if (retvalue < SMQ_FULL)
		return;

	DEBUG_LOG("Nation Sel Send Fail : %d", retvalue);

fail_return:
	send_index = 0;
	SetByte( send_buff, WIZ_SEL_NATION, send_index );
	SetByte( send_buff, 0x00, send_index );
	Send( send_buff, send_index );
}
开发者ID:Kageyoshi,项目名称:snoxd-koserver,代码行数:28,代码来源:CharacterSelectionHandler.cpp

示例2: memset

void CUser::PartyDelete()
{
	int send_index = 0;
	CUser* pUser = NULL;
	_PARTY_GROUP* pParty = NULL;
	if( m_sPartyIndex == -1 ) return;

	pParty = m_pMain->m_PartyArray.GetData( m_sPartyIndex );
	if( !pParty ) {
		m_sPartyIndex = -1;
		return;
	}
	for( int i=0; i<8; i++ ) {
		pUser = m_pMain->GetUserPtr(pParty->uid[i]);
		if (pUser == NULL) 
			continue;
		pUser->m_sPartyIndex = -1;
	}

	char send_buff[256]; memset( send_buff, 0x00, 256 );
	SetByte( send_buff, WIZ_PARTY, send_index );
	SetByte( send_buff, PARTY_DELETE, send_index );
	m_pMain->Send_PartyMember( pParty->wIndex, send_buff, send_index );	// ????? ???? ??e??????..

	// AI Server
	send_index = 0; memset( send_buff, 0x00, 256 );
	SetByte( send_buff, AG_USER_PARTY, send_index );
	SetByte( send_buff, PARTY_DELETE, send_index );
	SetShort( send_buff, pParty->wIndex, send_index );
	m_pMain->Send_AIServer(m_pUserData->m_bZone, send_buff, send_index);

	m_pMain->DeleteParty(pParty->wIndex);
}
开发者ID:DeathsEffigy,项目名称:snoxd-koserver-1,代码行数:33,代码来源:PartyHandler.cpp

示例3: SetByte

void User::Refresh()
{
	this->lpPlayer			= &*(ObjectCharacter*)oUserObjectStruct;
	this->lpViewPlayer		= &*(ObjectPreview*)oUserPreviewStruct;
	this->GetTarget();
	// ----
	this->m_CursorX			= pCursorX;
	this->m_CursorY			= pCursorY;
	this->m_MapNumber		= pMapNumber;
	this->m_MasterLevel		= pMasterLevel;
	this->m_MasterPoint		= pMasterPoint;
	this->m_MasterExp		= pMasterExp;
	this->m_MasterNextExp	= pMasterNextExp;
	// ----
	if( (gObjUser.lpPlayer->Class & 7) != 6 )
	{
		SetByte((PVOID)(0x00556C32 + 6), 2);
	}
	else
	{
		SetByte((PVOID)(0x00556C32 + 6), 15);
	}
	// ----
	if( gTrayMode.InTray )
	{
		if( !this->lpViewPlayer->m_Model.Unknown4 && gConnectEx.m_ConnectState == 0 )
		{
			gTrayMode.ShowMessage(NIIF_WARNING, "MU Online", "Your character has been killed");
		}
	}
}
开发者ID:EderRS,项目名称:muOnline-season6,代码行数:31,代码来源:User.cpp

示例4: memset

void CUser::Parsing(int len, char *pData)
{
	int index = 0, send_index = 0, i=0, client_version = 0;
	char buff[2048]; memset( buff, 0x00, 2048 );
	BYTE command = GetByte( pData, index );

	switch( command ) {
	case LS_VERSION_REQ:
		SetByte( buff, LS_VERSION_REQ, send_index );
		SetShort( buff, m_pMain->m_nLastVersion, send_index );
		Send( buff, send_index );
		break;
	case LS_SERVERLIST:
		m_pMain->m_DBProcess.LoadUserCountList();		// 기범이가 ^^;
		SetByte( buff, LS_SERVERLIST, send_index );
		SetByte( buff, m_pMain->m_nServerCount, send_index );
		for(i=0; i<m_pMain->m_ServerList.size(); i++) {		
			SetShort( buff, strlen(m_pMain->m_ServerList[i]->strServerIP), send_index );
			SetString( buff, m_pMain->m_ServerList[i]->strServerIP, strlen(m_pMain->m_ServerList[i]->strServerIP), send_index );
			SetShort( buff, strlen(m_pMain->m_ServerList[i]->strServerName), send_index );
			SetString( buff, m_pMain->m_ServerList[i]->strServerName, strlen( m_pMain->m_ServerList[i]->strServerName ), send_index );			
			SetShort( buff, m_pMain->m_ServerList[i]->sUserCount, send_index);   // 기범이가 ^^;
		}
		Send( buff, send_index );
		break;
	case LS_DOWNLOADINFO_REQ:
		client_version = GetShort( pData, index );
		SendDownloadInfo( client_version );
		break;
	case LS_LOGIN_REQ:
		LogInReq( pData+index );
		break;
	}
}
开发者ID:croweffect,项目名称:snoxd-koserver-1,代码行数:34,代码来源:User.cpp

示例5: GetShort

void CUdpSocket::RecvJoinKnights( char* pBuf, BYTE command )
{
	int send_index = 0, knightsindex = 0, index = 0;
	char charid[MAX_ID_SIZE+1], send_buff[128], finalstr[128];
	CKnights*	pKnights = NULL;

	knightsindex = GetShort( pBuf, index );
	if (!GetKOString(pBuf, charid, index, MAX_ID_SIZE))
		return;

	pKnights = m_pMain->m_KnightsArray.GetData( knightsindex );

	if( command == KNIGHTS_JOIN ) {
		sprintf( finalstr, "#### %s님이 가입하셨습니다. ####", charid );
		// 클랜정보에 추가
		m_pMain->m_KnightsManager.AddKnightsUser( knightsindex, charid );
		TRACE("UDP - RecvJoinKnights - 가입, name=%s, index=%d\n", charid, knightsindex);
	}
	else {		// 탈퇴..
		// 클랜정보에 추가
		m_pMain->m_KnightsManager.RemoveKnightsUser( knightsindex, charid );
		sprintf( finalstr, "#### %s님이 탈퇴하셨습니다. ####", charid );
		TRACE("UDP - RecvJoinKnights - 탈퇴, name=%s, index=%d\n", charid, knightsindex );
	}

	//TRACE("UDP - RecvJoinKnights - command=%d, name=%s, index=%d\n", command, charid, knightsindex);

	send_index = 0;
	SetByte( send_buff, WIZ_CHAT, send_index );
	SetByte( send_buff, KNIGHTS_CHAT, send_index );
	SetByte( send_buff, 1, send_index );
	SetShort( send_buff, -1, send_index );
	SetKOString( send_buff, finalstr, send_index );
	m_pMain->Send_KnightsMember( knightsindex, send_buff, send_index );
}
开发者ID:DuMaNLaR,项目名称:snoxd-koserver,代码行数:35,代码来源:UdpSocket.cpp

示例6: SetUInt32Value

bool Transporter::CreateAsTransporter(uint32 EntryID, const char* Name)
{
	// Lookup GameobjectInfo
	if(!CreateFromProto(EntryID,0,0,0,0,0))
		return false;
	
	SetUInt32Value(GAMEOBJECT_FLAGS,40);
	SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100);

	//Maybe this would be the perfect way, so there would be no extra checks in Object.cpp:
	SetByte( GAMEOBJECT_BYTES_1, 0, GAMEOBJECT_TYPE_TRANSPORT );
	//but these fields seems to change often and between server flavours (ArcEmu, Aspire, name another one) - by: VLack aka. VLsoft
	if( pInfo )
		pInfo->Type = GAMEOBJECT_TYPE_TRANSPORT;
	else
		sLog.outString("Transporter id[%i] name[%s] - can't set GAMEOBJECT_TYPE - it will behave badly!",EntryID,Name);

	// Generate waypoints
	if(!GenerateWaypoints())
		return false;

	// Set position
	SetMapId(m_WayPoints[0].mapid);
	SetPosition(m_WayPoints[0].x, m_WayPoints[0].y, m_WayPoints[0].z, 0);

	SetUInt32Value(GAMEOBJECT_LEVEL, m_period); // ITS OVER 9000!!!!! No, really, it is.

	// Add to world
	AddToWorld();

	return true;
}
开发者ID:AtVirus,项目名称:Descent-core,代码行数:32,代码来源:TransporterHandler.cpp

示例7: memset

void CUser::SendMagicAttackResult(int tuid, BYTE result, short sDamage, short sHP)
{
	int send_index = 0;
	int sid = -1, tid = -1;
	BYTE type, bResult;
	char buff[256];
	memset( buff, 0x00, 256 );
	float rx=0.0f, ry=0.0f, rz=0.0f;

	type = 0x01;				
	bResult = result;
	sid = m_iUserId+USER_BAND;
	tid = tuid;

	SetByte( buff, AG_MAGIC_ATTACK_RESULT, send_index );
	SetByte( buff, type, send_index );
	SetByte( buff, bResult, send_index );
	SetShort( buff, sid, send_index );
	SetShort( buff, tid, send_index );
	SetShort( buff, sDamage, send_index );
	SetShort( buff, sHP, send_index );

	//TRACE("User - SendAttackSuccess() : [sid=%d, tid=%d, result=%d], damage=%d, hp = %d\n", sid, tid, bResult, sDamage, sHP);

	SendAll(buff, send_index);   // thread 에서 send
}
开发者ID:Kageyoshi,项目名称:snoxd-koserver,代码行数:26,代码来源:User.cpp

示例8: SetUInt32Value

bool GameObject::Load(GOSpawn *spawn)
{
	if(!CreateFromProto(spawn->entry,0,spawn->x,spawn->y,spawn->z,spawn->facing,spawn->orientation1,spawn->orientation2,spawn->orientation3,spawn->orientation4))
		return false;

	m_phaseMode = spawn->phase;
	m_spawn = spawn;
	SetUInt32Value(GAMEOBJECT_FLAGS,spawn->flags);
	SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_STATE, spawn->state);
	if(spawn->faction)
	{
		SetUInt32Value(GAMEOBJECT_FACTION,spawn->faction);
		m_faction = dbcFactionTemplate.LookupEntry(spawn->faction);
		if(m_faction)
			m_factionDBC = dbcFaction.LookupEntry(m_faction->Faction);
	}
	SetFloatValue(OBJECT_FIELD_SCALE_X,spawn->scale);

	if( spawn->flags & GO_FLAG_IN_USE || spawn->flags & GO_FLAG_LOCKED )
		SetByte(GAMEOBJECT_BYTES_1, GAMEOBJECT_BYTES_ANIMPROGRESS, 100);

	CALL_GO_SCRIPT_EVENT(TO_GAMEOBJECT(this), OnCreate)();

	_LoadQuests();
	return true;
}
开发者ID:arcticdev,项目名称:arctic-test,代码行数:26,代码来源:GameObject.cpp

示例9: GetShort

void CAISocket::RecvUserFail(char* pBuf)
{
	short nid = 0, sid=0;
	int index = 0, send_index = 0;
	char pOutBuf[1024];

	nid = GetShort(pBuf,index);
	sid = GetShort(pBuf,index);

	CUser* pUser = m_pMain->GetUserPtr(nid);
	if (pUser == NULL)
		return;

	pUser->HpChange(-10000, 1);

	BYTE type = 0x01;
	BYTE result = 0x02;
	float fDir = 0.0f;

	SetByte(pOutBuf, WIZ_ATTACK, send_index);
	SetByte( pOutBuf, type, send_index );
	SetByte( pOutBuf, result, send_index );
	SetShort( pOutBuf, sid, send_index );
	SetShort( pOutBuf, nid, send_index );

	TRACE("### AISocket - RecvUserFail : sid=%d, tid=%d, id=%s ####\n", sid, nid, pUser->m_pUserData->m_id);

	m_pMain->Send_Region(pOutBuf, send_index, pUser->GetMap(), pUser->m_RegionX, pUser->m_RegionZ);

}
开发者ID:tuku,项目名称:snoxd-koserver,代码行数:30,代码来源:AISocket.cpp

示例10: GetByte

void CAISocket::RecvSystemMsg(char* pBuf)
{
	int index = 0, send_index = 0;
	char send_buff[256], strSysMsg[256];

	BYTE bType;
	short sWho;

	bType = GetByte(pBuf,index);
	sWho = GetShort(pBuf,index);
	if (!GetKOString(pBuf, strSysMsg, index, sizeof(strSysMsg) - 1))
		return;

	//TRACE("RecvSystemMsg - type=%d, who=%d, len=%d, msg=%s\n", bType, sWho, sLength, strSysMsg);

	switch(sWho)
	{
	case SEND_ME:
		break;
	case SEND_REGION:
		break;
	case SEND_ALL:
		SetByte( send_buff, WIZ_CHAT, send_index );
		SetByte( send_buff, bType, send_index );
		SetByte( send_buff, 0x01, send_index );		// nation
		SetShort( send_buff, -1, send_index );		// sid
		SetKOString( send_buff, strSysMsg, send_index );
		m_pMain->Send_All( send_buff, send_index );
		break;
	case SEND_ZONE:
		break;
	}
	
}
开发者ID:tuku,项目名称:snoxd-koserver,代码行数:34,代码来源:AISocket.cpp

示例11: memset

void CNpc::RemoveRegion(int del_x, int del_z)
{
	int send_index = 0, i=0;
	int region_x = -1, region_z = -1, uid = -1;
	char buff[128];
	memset( buff, NULL, 128 );
	C3DMap* pMap = GetMap();

	SetByte( buff, WIZ_NPC_INOUT, send_index );
	SetByte( buff, NPC_OUT, send_index );
	SetShort( buff, m_sNid, send_index );

	if( del_x != 0 ) {
		m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x*2, m_sRegion_Z+del_z-1 );
		m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x*2, m_sRegion_Z+del_z );
		m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x*2, m_sRegion_Z+del_z+1 );
	}
	if( del_z != 0 ) {	
		m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x, m_sRegion_Z+del_z*2 );
		if( del_x < 0 ) 
			m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x+1, m_sRegion_Z+del_z*2 );
		else if( del_x > 0 )
			m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x-1, m_sRegion_Z+del_z*2 );
		else {
			m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x-1, m_sRegion_Z+del_z*2 );
			m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x+1, m_sRegion_Z+del_z*2 );
		}
	}
}
开发者ID:DeathsEffigy,项目名称:snoxd-koserver-1,代码行数:29,代码来源:Npc.cpp

示例12: memset

void CNpc::InsertRegion(int del_x, int del_z)
{
	int send_index = 0, buff_index = 0, i=0;
	int region_x = -1, region_z = -1;
	char buff[128];
	memset( buff, NULL, 128 );
	C3DMap* pMap = GetMap();
	if (pMap == NULL)
		return;

	SetByte( buff, WIZ_NPC_INOUT, send_index );
	SetByte( buff, NPC_IN, send_index );

	GetNpcInfo(buff, send_index);

	if( del_x != 0 ) {
		m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x, m_sRegion_Z-1 );
		m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x, m_sRegion_Z );
		m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+del_x, m_sRegion_Z+1 );
	}
	if( del_z != 0 ) {
		m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X, m_sRegion_Z+del_z );
		
		if( del_x < 0 )	{
			m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+1, m_sRegion_Z+del_z );
		}
		else if( del_x > 0 ) {
			m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X-1, m_sRegion_Z+del_z );
		}
		else {
			m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X-1, m_sRegion_Z+del_z );
			m_pMain->Send_UnitRegion( buff, send_index, GetMap(), m_sRegion_X+1, m_sRegion_Z+del_z );
		}
	}
}
开发者ID:ImOriqinaL,项目名称:snoxd-koserver,代码行数:35,代码来源:Npc.cpp

示例13: SetByte

void CUser::HandleStoreClose()
{
	char send_buff[256];
	int send_index = 0;

	m_bStoreOpen = false;

	// Tell Aujard we're closing the PUS so that we can call LOAD_WEB_ITEMMALL and load the extra items.
	SetByte(send_buff, WIZ_SHOPPING_MALL, send_index);
	SetByte(send_buff, STORE_CLOSE, send_index);
	SetShort(send_buff, GetSocketID(), send_index);
	m_pMain->m_LoggerSendQueue.PutData(send_buff, send_index);
}
开发者ID:DuMaNLaR,项目名称:snoxd-koserver,代码行数:13,代码来源:ShoppingMallHandler.cpp

示例14: inventory

BOOL CUser::RobItem(int itemid, short count)
{
	int send_index = 0, i = 0;					
	char send_buff[256];
	BYTE type = 1;

	_ITEM_TABLE* pTable = NULL;				// This checks if such an item exists.
	pTable = m_pMain->m_ItemtableArray.GetData( itemid );
	if( !pTable ) return FALSE;

	for ( i = SLOT_MAX ; i < SLOT_MAX + HAVE_MAX * type ; i++ ) {
		if( m_pUserData->m_sItemArray[i].nNum == itemid ) {		
			if (!pTable->m_bCountable) {	// Remove item from inventory (Non-countable items)
				m_pUserData->m_sItemArray[i].nNum = 0;
				m_pUserData->m_sItemArray[i].sCount = 0;
				m_pUserData->m_sItemArray[i].sDuration = 0;
				goto success_return;
			}
			else {	// Remove the number of items from the inventory (Countable Items)
				if (m_pUserData->m_sItemArray[i].sCount >= count) {
					m_pUserData->m_sItemArray[i].sCount -= count ;

					if (m_pUserData->m_sItemArray[i].sCount == 0) {
						m_pUserData->m_sItemArray[i].nNum = 0 ;
						m_pUserData->m_sItemArray[i].sCount = 0;
						m_pUserData->m_sItemArray[i].sDuration = 0;
					}					
					goto success_return;
				}
				else {
					return FALSE;	
				}
			}			
		}		
	}
	
	return FALSE;

success_return:
	SendItemWeight();	// Change weight first :)
	SetByte( send_buff, WIZ_ITEM_COUNT_CHANGE, send_index );	
	SetShort( send_buff, 0x01, send_index );	// The number of for-loops
	SetByte( send_buff, 0x01, send_index );
	SetByte( send_buff, i - SLOT_MAX, send_index );
	SetDWORD( send_buff, itemid, send_index );	// The ID of item.
	SetDWORD( send_buff, m_pUserData->m_sItemArray[i].sCount, send_index );
	Send( send_buff, send_index );
	return TRUE;
}
开发者ID:captknuckles,项目名称:snoxd-koserver,代码行数:49,代码来源:ItemHandler.cpp

示例15: memset

void CUser::ItemRepair(char *pBuf)
{
	int index = 0, send_index = 0, money = 0, quantity = 0;
	int itemid = 0, pos = 0, slot = -1, durability = 0;
	char send_buff[128]; memset( send_buff, 0x00, 128 );
	_ITEM_TABLE* pTable = NULL;

	pos = GetByte( pBuf, index );
	slot = GetByte( pBuf, index );
	itemid = GetDWORD( pBuf, index );
	if( pos == 1 ) {	// SLOT
		if( slot >= SLOT_MAX ) goto fail_return;
		if( m_pUserData->m_sItemArray[slot].nNum != itemid ) goto fail_return;
	}
	else if ( pos == 2 ) {	// INVEN
		if( slot >= HAVE_MAX ) goto fail_return;
		if( m_pUserData->m_sItemArray[SLOT_MAX+slot].nNum != itemid ) goto fail_return;
	}
	pTable = m_pMain->m_ItemtableArray.GetData( itemid );
	if( !pTable ) goto fail_return;
	durability = pTable->m_sDuration;
	if( durability == 1 ) goto fail_return;
	if( pos == 1 )
		quantity = pTable->m_sDuration - m_pUserData->m_sItemArray[slot].sDuration;
	else if( pos == 2 ) 
		quantity = pTable->m_sDuration - m_pUserData->m_sItemArray[SLOT_MAX+slot].sDuration;
	
	money = (int)( ((pTable->m_iBuyPrice-10)/10000.0f) + pow(pTable->m_iBuyPrice, 0.75)) * quantity / (double)durability;
	if( money > m_pUserData->m_iGold ) goto fail_return;

	m_pUserData->m_iGold -= money;
	if( pos == 1 )
		m_pUserData->m_sItemArray[slot].sDuration = durability;
	else if( pos == 2 )
		m_pUserData->m_sItemArray[SLOT_MAX+slot].sDuration = durability;

	SetByte( send_buff, WIZ_ITEM_REPAIR, send_index );
	SetByte( send_buff, 0x01, send_index );
	SetDWORD( send_buff, m_pUserData->m_iGold, send_index );
	Send( send_buff, send_index );

	return;
fail_return:
	SetByte( send_buff, WIZ_ITEM_REPAIR, send_index );
	SetByte( send_buff, 0x00, send_index );
	SetDWORD( send_buff, m_pUserData->m_iGold, send_index );
	Send( send_buff, send_index );
}
开发者ID:DeathsEffigy,项目名称:snoxd-koserver-1,代码行数:48,代码来源:NPCHandler.cpp


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