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


C++ GuildMember::expire方法代码示例

本文整理汇总了C++中GuildMember::expire方法的典型用法代码示例。如果您正苦于以下问题:C++ GuildMember::expire方法的具体用法?C++ GuildMember::expire怎么用?C++ GuildMember::expire使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GuildMember的用法示例。


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

示例1: execute

//----------------------------------------------------------------------
// 
// GSExpelGuildMemberHandler::execute()
// 
//----------------------------------------------------------------------
void GSExpelGuildMemberHandler::execute (GSExpelGuildMember* pPacket, Player* pPlayer )
	 throw(ProtocolException , Error )
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __SHARED_SERVER__
	//cout << "GSExpelGuildMember received" << endl;

	Assert(pPacket != NULL);

	// 플레이어가 속한 길드를 가져온다.
	Guild* pGuild = g_pGuildManager->getGuild(pPacket->getGuildID());
	//try { Assert(pGuild != NULL); } catch (Throwable& ) { return; }
	if (pGuild==NULL) return;

	// 플레이어가 길드의 멤버인지 확인한다.
	GuildMember* pGuildMember = pGuild->getMember(pPacket->getName());
	//try { Assert(pGuildMember != NULL); } catch (Throwable& ) { return; }
	if (pGuildMember==NULL) return;

	// 길드 탈퇴 로그를 남긴다.
	filelog("GuildExit.log", "GuildID: %d, GuildName: %s, Expel: %s, By: %s", pGuild->getID(), pGuild->getName().c_str(), pPacket->getName().c_str(), pPacket->getSender().c_str());

	///////////////////////////////////////////////////////////////////
	//  DB에 Slayer, Vampire, Ousters 테이블의 GuildID 를 바꾼다.
	///////////////////////////////////////////////////////////////////
	Statement* pStmt = NULL;
	BEGIN_DB
	{
		pStmt = g_pDatabaseManager->getConnection("DARKEDEN" )->createStatement();

		if (pGuild->getRace() == Guild::GUILD_RACE_SLAYER )
		{
			pStmt->executeQuery("UPDATE Slayer SET GuildID = 99 WHERE Name = '%s'", pGuildMember->getName().c_str());
		}
		else if (pGuild->getRace() == Guild::GUILD_RACE_VAMPIRE )
		{
			pStmt->executeQuery("UPDATE Vampire SET GuildID = 0 WHERE Name = '%s'", pGuildMember->getName().c_str());
		}
		else if (pGuild->getRace() == Guild::GUILD_RACE_OUSTERS )
		{
			pStmt->executeQuery("UPDATE Ousters SET GuildID = 66 WHERE Name = '%s'", pGuildMember->getName().c_str());
		}

		SAFE_DELETE(pStmt);
	}
	END_DB(pStmt)

	// Guild Member 를 expire 시킨다.
	pGuildMember->expire();

	// Guild 에서 삭제한다.
	pGuild->deleteMember(pGuildMember->getName());

	// 게임 서버로 보낼 패킷을 만든다.
	SGExpelGuildMemberOK sgExpelGuildMemberOK;
	sgExpelGuildMemberOK.setGuildID(pGuild->getID());
	sgExpelGuildMemberOK.setName(pPacket->getName());
	sgExpelGuildMemberOK.setSender(pPacket->getSender());

	// 게임 서버로 패킷을 보낸다.
	g_pGameServerManager->broadcast(&sgExpelGuildMemberOK);

	// 길드 인원이 5명 미만이 될 경우 길드를 삭제한다.
	if (pGuild->getState() == Guild::GUILD_STATE_ACTIVE && pGuild->getActiveMemberCount() < MIN_GUILDMEMBER_COUNT )
	{
		// 길드 삭제 로그를 남긴다.
		filelog("GuildBroken.log", "GuildID: %d, GuildName: %s, MemberCount: %d, Expel: %s", pGuild->getID(), pGuild->getName().c_str(), pGuild->getActiveMemberCount(), pPacket->getName().c_str());

		// 길드 멤버 expire and delete
		HashMapGuildMember& Members = pGuild->getMembers();
		HashMapGuildMemberItor itr = Members.begin();
		
		BEGIN_DB
		{
			pStmt = g_pDatabaseManager->getConnection("DARKEDEN" )->createStatement();

			for (; itr != Members.end(); itr++ )
			{
				GuildMember* pGuildMember = itr->second;

				///////////////////////////////////////////////////////////////////
				//  DB에 Slayer, Vampire, Ousters 테이블의 GuildID 를 바꾼다.
				///////////////////////////////////////////////////////////////////
				if (pGuild->getRace() == Guild::GUILD_RACE_SLAYER )
				{
					pStmt->executeQuery("UPDATE Slayer SET GuildID = 99 WHERE Name = '%s'", pGuildMember->getName().c_str());
				}
				else if (pGuild->getRace() == Guild::GUILD_RACE_VAMPIRE )
				{
					pStmt->executeQuery("UPDATE Vampire SET GuildID = 0 WHERE Name = '%s'", pGuildMember->getName().c_str());
				}
				else if (pGuild->getRace() == Guild::GUILD_RACE_OUSTERS )
				{
					pStmt->executeQuery("UPDATE Ousters SET GuildID = 66 WHERE Name = '%s'", pGuildMember->getName().c_str());
//.........这里部分代码省略.........
开发者ID:mrktj,项目名称:darkeden,代码行数:101,代码来源:GSExpelGuildMemberHandler.cpp


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