本文整理汇总了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());
//.........这里部分代码省略.........