//////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void GCAddMonsterFromTransformation::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY
		
	BYTE name_length = m_MonsterName.size();

	oStream.write(m_ObjectID);
	oStream.write(m_MonsterType);

	oStream.write(name_length);
	if (m_MonsterName.size() != 0) oStream.write(m_MonsterName);

	oStream.write(m_MainColor);
	oStream.write(m_SubColor);
	oStream.write(m_X);
	oStream.write(m_Y);
	oStream.write(m_Dir);

	m_pEffectInfo->write(oStream);

	oStream.write(m_CurrentHP);
	oStream.write(m_MaxHP);

	__END_CATCH
}
Ejemplo n.º 2
0
void CGDissectionCorpse::write (SocketOutputStream & oStream) const 
     throw(ProtocolException , Error)
{
	__BEGIN_TRY
		
#ifdef __USE_ENCRYPTER__
	SocketEncryptOutputStream* pEOStream = dynamic_cast<SocketEncryptOutputStream*>(&oStream);
    Assert(pEOStream!=NULL);

	if (pEOStream->getEncryptCode()!=0)
	{
		SHUFFLE_STATEMENT_4(pEOStream->getEncryptCode(),
							pEOStream->writeEncrypt(m_ObjectID),
							pEOStream->writeEncrypt(m_X),
							pEOStream->writeEncrypt(m_Y),
							pEOStream->writeEncrypt(m_IsPet));
	}
	else
#endif
	{
		oStream.write(m_ObjectID);
		oStream.write(m_X);
		oStream.write(m_Y);
		oStream.write(m_IsPet);
	}

	__END_CATCH
}
Ejemplo n.º 3
0
void NicknameInfo::write(SocketOutputStream& oStream) const
	throw(ProtocolException, Error)
{
	__BEGIN_TRY

	oStream.write(m_NicknameID);
	oStream.write(m_NicknameType);

	switch (m_NicknameType )
	{
		case NICK_NONE:
			{
				break;
			}
		case NICK_BUILT_IN:
		case NICK_QUEST:
		case NICK_FORCED:
			{
				oStream.write(m_NicknameIndex);
				break;
			}
		case NICK_CUSTOM_FORCED:
		case NICK_CUSTOM:
			{
				BYTE szSTR = m_Nickname.size();
				oStream.write(szSTR);
				oStream.write(m_Nickname);
				break;
			}
		default:
			Assert(false);
	}

	__END_CATCH
}
Ejemplo n.º 4
0
//////////////////////////////////////////////////////////////////////
// Datagram 객체로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void SGModifyGuildMemberOK::write (SocketOutputStream& oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	BYTE szName = m_Name.size();
	BYTE szSender = m_Sender.size();

	if (szName == 0 )
		throw InvalidProtocolException("szName == 0");
	if (szName > 20 )
		throw InvalidProtocolException("too long name length");

	if (szSender == 0 )
		throw InvalidProtocolException("szSender == 0");
	if (szSender > 20 )
		throw InvalidProtocolException("too long sender length");

	oStream.write(m_GuildID);
	oStream.write(szName);
	oStream.write(m_Name);
	oStream.write(m_GuildMemberRank);
	oStream.write(szSender);
	oStream.write(m_Sender);

	__END_CATCH
}
Ejemplo n.º 5
0
//--------------------------------------------------------------------------------
// write to socket output stream
//--------------------------------------------------------------------------------
void Resource::write (SocketOutputStream & oStream ) const 
	throw(IOException , Error )
{
	__BEGIN_TRY

	//--------------------------------------------------------------------------------
	// write version
	//--------------------------------------------------------------------------------
	oStream.write(m_Version);
	
	//--------------------------------------------------------------------------------
	// write filename
	//--------------------------------------------------------------------------------
	BYTE szFilename = m_Filename.size();

	if (szFilename == 0 )
		throw InvalidProtocolException("szFilename == 0");

	if (szFilename > maxFilename )
		throw InvalidProtocolException("too large filename length");

	oStream.write(szFilename);

	oStream.write(m_Filename);

	//--------------------------------------------------------------------------------
	// write filesize
	//--------------------------------------------------------------------------------
	oStream.write(m_FileSize);

	__END_CATCH
}
Ejemplo n.º 6
0
void StoreInfo::write(SocketOutputStream& oStream, bool toOther) const throw(ProtocolException, Error)
{
	__BEGIN_TRY

	oStream.write(m_Open);
//	cout << "m_Open = " << (int)m_Open << endl;
	if (toOther && m_Open == 0 ) return;

	BYTE szSign = m_Sign.size();
	oStream.write(szSign);

	if (szSign != 0 ) oStream.write(m_Sign);

	BYTE ItemNum = m_Items.size();
	oStream.write(ItemNum);

	vector<StoreItemInfo>::const_iterator itr = m_Items.begin();

	for (; itr != m_Items.end(); ++itr )
	{
		itr->write(oStream);
	}

	__END_CATCH
}
Ejemplo n.º 7
0
void CGSkillToInventory::write (SocketOutputStream & oStream) const 
     throw(ProtocolException , Error)
{
	__BEGIN_TRY
		
#ifdef __USE_ENCRYPTER__
	SocketEncryptOutputStream* pEOStream = dynamic_cast<SocketEncryptOutputStream*>(&oStream);
    Assert(pEOStream!=NULL);

	if (pEOStream->getEncryptCode()!=0)
	{
		SHUFFLE_STATEMENT_5(pEOStream->getEncryptCode(),
							pEOStream->writeEncrypt(m_SkillType),
							pEOStream->writeEncrypt(m_ObjectID),
							pEOStream->writeEncrypt(m_X),
							pEOStream->writeEncrypt(m_Y),
							pEOStream->writeEncrypt(m_TargetX));
		pEOStream->writeEncrypt(m_TargetY);
		pEOStream->writeEncrypt(m_InventoryItemObjectID);
	}
	else
#endif
	{
		oStream.write(m_SkillType);
		oStream.write(m_ObjectID);
		oStream.write(m_X);
		oStream.write(m_Y);
		oStream.write(m_TargetX);
		oStream.write(m_TargetY);
		oStream.write(m_InventoryItemObjectID);
	}

	__END_CATCH
}
Ejemplo n.º 8
0
//////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void GCLearnSkillOK::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY
	oStream.write(m_SkillType);
	oStream.write(m_DomainType);
	__END_CATCH
}
Ejemplo n.º 9
0
//////////////////////////////////////////////////////////////////////
// Datagram 객체로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void SGModifyGuildOK::write (SocketOutputStream& oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_GuildID);
	oStream.write(m_GuildState);

	__END_CATCH
}
Ejemplo n.º 10
0
//////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void GCDownSkillFailed::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_SkillType);
	oStream.write(m_Desc);

	__END_CATCH
}
Ejemplo n.º 11
0
//////////////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////////////
void GCRemoveStoreItem::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_OwnerObjectID);
	oStream.write(m_Index);

	__END_CATCH
}
Ejemplo n.º 12
0
void CGMakeItem::write (SocketOutputStream & oStream) const 
     throw(ProtocolException , Error)
{
	__BEGIN_TRY

	oStream.write(m_ItemClass);
	oStream.write(m_ItemType);

	__END_CATCH
}
Ejemplo n.º 13
0
void CGRequestInfo::write (SocketOutputStream & oStream) const 
     throw(ProtocolException , Error)
{
	__BEGIN_TRY

	oStream.write(m_Code);
	oStream.write(m_Value);

	__END_CATCH
}
Ejemplo n.º 14
0
void CGReloadFromQuickSlot::write (SocketOutputStream & oStream) const 
     throw(ProtocolException , Error)
{
	__BEGIN_TRY

	oStream.write(m_ObjectID);
	oStream.write(m_SlotID);

	__END_CATCH
}
Ejemplo n.º 15
0
//--------------------------------------------------------------------------------
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//--------------------------------------------------------------------------------
void GCChangeWeather::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write((BYTE)m_Weather);
	oStream.write(m_WeatherLevel);

	__END_CATCH
}
Ejemplo n.º 16
0
//////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void GCStatusCurrentHP::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY
		
	oStream.write(m_ObjectID);
	oStream.write(m_CurrentHP);

	__END_CATCH
}
Ejemplo n.º 17
0
void CGTryJoinGuild::write (SocketOutputStream & oStream) const 
     throw(ProtocolException , Error)
{
	__BEGIN_TRY

	oStream.write(m_GuildID);
	oStream.write(m_GuildMemberRank);

	__END_CATCH
}
Ejemplo n.º 18
0
////////////////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
////////////////////////////////////////////////////////////////////////////////
void GCTradeRemoveItem::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_TargetObjectID);
	oStream.write(m_ItemObjectID );
	
	__END_CATCH
}
Ejemplo n.º 19
0
//////////////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////////////
void GCShopListMysterious::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY
		
	BYTE i      = 0;
	BYTE nTotal = 0;
	
	// calculate total number of items
	for (i=0; i<SHOP_RACK_INDEX_MAX; i++)
		if (m_pBuffer[i].bExist) nTotal++;
		
	// write NPC id & version & rack type & number of item
	oStream.write(m_ObjectID);
	oStream.write(m_Version);
	oStream.write(m_RackType);
	oStream.write(nTotal);

	// write each item info
	for (i=0; i<SHOP_RACK_INDEX_MAX; i++)
	{
		if (m_pBuffer[i].bExist)
		{
			oStream.write(i);
			oStream.write(m_pBuffer[i].itemClass);
			oStream.write(m_pBuffer[i].itemType);
		}
	}

	oStream.write(m_MarketCondBuy);
	oStream.write(m_MarketCondSell);
	
	__END_CATCH
}
Ejemplo n.º 20
0
//////////////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////////////
void GCOtherStoreInfo::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_ObjectID);
	oStream.write(m_IsRequested);
	m_pInfo->write(oStream, true);

	__END_CATCH
}
Ejemplo n.º 21
0
//////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void GCBloodDrainOK3::write (SocketOutputStream & oStream )
     const throw(ProtocolException , Error )
{
	__BEGIN_TRY
		
	// 최적화 작업시 실제 크기를 명시하도록 한다.
	oStream.write(m_ObjectID);
	oStream.write(m_TargetObjectID);

	__END_CATCH
}
Ejemplo n.º 22
0
//////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void GCUnburrowOK::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_X);
	oStream.write(m_Y);
	oStream.write(m_Dir);

	__END_CATCH
}
Ejemplo n.º 23
0
//--------------------------------------------------------------------------------
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//--------------------------------------------------------------------------------
void CUBeginUpdate::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_Version);
	if (m_Version >= atoi(g_pConfig->getProperty("GuildVersion").c_str() ) ) oStream.write(m_GuildVersion);
	if (m_Version >= atoi(g_pConfig->getProperty("InfoVersion").c_str() ) ) oStream.write(m_InfoVersion);

	__END_CATCH
}
Ejemplo n.º 24
0
void CGAddItemToCodeSheet::write (SocketOutputStream & oStream) const 
     throw(ProtocolException , Error)
{
	__BEGIN_TRY
		
	oStream.write(m_ObjectID);
	oStream.write(m_X);
	oStream.write(m_Y);

	__END_CATCH
}
Ejemplo n.º 25
0
void GCSkillFailed1::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_SkillType);
	oStream.write(m_Grade);
	ModifyInfo::write(oStream);

	__END_CATCH
}
Ejemplo n.º 26
0
void CGShopRequestSell::write (SocketOutputStream & oStream) const
throw(ProtocolException , Error)
{
    __BEGIN_TRY

    oStream.write(m_ObjectID);
    oStream.write(m_ItemObjectID);
    oStream.write(m_OpCode);

    __END_CATCH
}
Ejemplo n.º 27
0
////////////////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
////////////////////////////////////////////////////////////////////////////////
void GCTradeMoney::write (SocketOutputStream & oStream ) const 
     throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_TargetObjectID);
	oStream.write(m_Gold);
	oStream.write(m_Code);
	
	__END_CATCH
}
Ejemplo n.º 28
0
void GCShopBuyFail::write (SocketOutputStream & oStream) const 
     throw(ProtocolException , Error)
{
	__BEGIN_TRY
		
	oStream.write(m_ObjectID);
	oStream.write(m_Code);
	oStream.write(m_Amount);

	__END_CATCH
}
Ejemplo n.º 29
0
//////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void GCFlagWarStatus::write (SocketOutputStream & oStream ) 
     const throw(ProtocolException , Error )
{
	__BEGIN_TRY

	oStream.write(m_TimeRemain);
	oStream.write(m_FlagCount[0]);
	oStream.write(m_FlagCount[1]);
	oStream.write(m_FlagCount[2]);
		
	__END_CATCH
}
Ejemplo n.º 30
0
//////////////////////////////////////////////////////////////////////
// 출력스트림(버퍼)으로 패킷의 바이너리 이미지를 보낸다.
//////////////////////////////////////////////////////////////////////
void ItemNameInfo::write (SocketOutputStream & oStream ) 
     const throw(ProtocolException , Error )
{
	__BEGIN_TRY
		
	BYTE szName = m_Name.size();
	oStream.write(m_ObjectID);
	oStream.write(szName);
	oStream.write(m_Name);

	__END_CATCH
}