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


C++ GuildMember类代码示例

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


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

示例1: throw

void CGModifyGuildMemberIntroHandler::execute (CGModifyGuildMemberIntro* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	SYSTEM_ASSERT(SYSTEM_GUILD);

	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	Assert(pGamePlayer != NULL);

	Creature* pCreature = pGamePlayer->getCreature();
	Assert(pCreature != NULL);

	PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
	Assert(pPlayerCreature != NULL);

	// 길드를 가져온다.
	Guild* pGuild = g_pGuildManager->getGuild(pPlayerCreature->getGuildID());
	if (pGuild==NULL) return;

	// 길드 멤버 정보를 가져온다.
	GuildMember* pGuildMember  = pGuild->getMember(pPlayerCreature->getName());
	if (pGuildMember==NULL) return;

	pGuildMember->saveIntro(pPacket->getGuildMemberIntro());

#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:35,代码来源:CGModifyGuildMemberIntroHandler.cpp

示例2: throw

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

#ifdef __SHARED_SERVER__
	//cout << "GSModifyGuildMember 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;

	// 보낸사람이 길드 마스터인지 확인한다. (길드 마스터를 바꿀때는 예외 )
	if (pGuild->getMaster() != pPacket->getSender() 
		&& pPacket->getGuildMemberRank() != GuildMember::GUILDMEMBER_RANK_MASTER )
		return;

	if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_WAIT &&
		 pPacket->getGuildMemberRank() == GuildMember::GUILDMEMBER_RANK_NORMAL )
	{
		///////////////////////////////////////////////////////////////////////////////////////
		// 길드 멤버 가입을 승인한 경우, 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 = %d WHERE Name = '%s'", pGuild->getID(), pGuildMember->getName().c_str());
				pStmt->executeQuery("INSERT INTO Messages (Receiver, Message ) VALUES ('%s', '%s' )", pGuildMember->getName().c_str(), g_pStringPool->c_str(STRID_TEAM_JOIN_ACCEPT ));
			}
			else if (pGuild->getRace() == Guild::GUILD_RACE_VAMPIRE )
			{
				pStmt->executeQuery("UPDATE Vampire SET GuildID = %d WHERE Name = '%s'", pGuild->getID(), pGuildMember->getName().c_str());
				pStmt->executeQuery("INSERT INTO Messages (Receiver, Message ) VALUES ('%s', '%s' )", pGuildMember->getName().c_str(), g_pStringPool->c_str(STRID_CLAN_JOIN_ACCEPT ));
			}
			else if (pGuild->getRace() == Guild::GUILD_RACE_OUSTERS )
			{
				pStmt->executeQuery("UPDATE Ousters SET GuildID = %d WHERE Name = '%s'", pGuild->getID(), pGuildMember->getName().c_str());
				pStmt->executeQuery("INSERT INTO Messages (Receiver, Message ) VALUES ('%s', '%s' )", pGuildMember->getName().c_str(), g_pStringPool->c_str(STRID_CLAN_JOIN_ACCEPT ));
			}

			SAFE_DELETE(pStmt);
		}
		END_DB(pStmt)

		// Guild Member 정보를 변경한다.
		pGuild->modifyMemberRank(pGuildMember->getName(), pPacket->getGuildMemberRank());
	}
开发者ID:jun199004,项目名称:server,代码行数:65,代码来源:GSModifyGuildMemberHandler.cpp

示例3: updated

void GuildShell::guildMemberUpdate(const uint8_t* data, size_t len)
{
  const GuildMemberUpdate* gmu = (const GuildMemberUpdate*)data;

  QString memberName = QString::fromUtf8(gmu->name);

  // find the member
  GuildMember* member = m_members[memberName];

  // update the guild members information
  if (member)
  {
    member->update(gmu);
    emit updated(member);
  }
  else
  {
#ifdef GUILDSHELL_DIAG
    seqDebug("GuildShell::guildMemberUpdate(): Failed to find '%s'(%d)!",
	     (const char*)memberName, memberName.length());
#if GUILDSHELL_DIAG > 1
    seqDebug("%d in members dict.", m_members.count());
    GuildMemberDictIterator it(m_members); // See QDictIterator
    for( ; it.current(); ++it )
	seqDebug("'%s'(%d): '%s'(%d)", 
		 (const char*)it.currentKey(), it.currentKey().length(),
		 (const char*)it.current()->name(), it.current()->name().length());
#endif // GUILDSHELL_DIAG > 1
#endif // GUILDSHELL_DIAG
  }
}
开发者ID:xbackupx,项目名称:showeqx,代码行数:31,代码来源:guildshell.cpp

示例4: WithdrawMoney

void Guild::WithdrawMoney(WorldSession * pClient, uint32 uAmount)
{
    GuildMember * pMember = pClient->GetPlayer()->m_playerInfo->guildMember;
    if (pMember == NULL)
        return;

    // sanity checks
    if (pMember->pRank->iGoldLimitPerDay > 0)
    {
        if (pMember->CalculateAvailableAmount() < uAmount)
        {
            pClient->SystemMessage("You have already withdrawn too much today.");
            return;
        }
    }

    if (pMember->pRank->iGoldLimitPerDay == 0)
    {
        pClient->SystemMessage("You don't have permission to do that.");
        return;
    }

    if (m_bankBalance < uAmount)
        return;

    if (sWorld.GoldCapEnabled)
    {
        if ((pClient->GetPlayer()->GetUInt32Value(PLAYER_FIELD_COINAGE) + uAmount) > sWorld.GoldLimit)
        {
            pClient->GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_TOO_MUCH_GOLD);
            return;
        }
    }

    // update his bank state
    pMember->OnMoneyWithdraw(uAmount);

    // give the gold! GM PLS GOLD PLS 1 COIN
    pClient->GetPlayer()->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (uint32)uAmount);

    // subtract the balance
    m_bankBalance -= uAmount;

    // update in db
    CharacterDatabase.Execute("UPDATE guilds SET bankBalance = %u WHERE guildId = %u", (m_bankBalance > 0) ? m_bankBalance : 0, m_guildId);

    // notify everyone with the new balance
    char buf[20];
    snprintf(buf, 20, I64FMT, (uint64)m_bankBalance);
    LogGuildEvent(GUILD_EVENT_SETNEWBALANCE, 1, buf);

    // log it!
    LogGuildBankActionMoney(GUILD_BANK_LOG_EVENT_WITHDRAW_MONEY, pClient->GetPlayer()->GetLowGUID(), uAmount);
}
开发者ID:Nupper,项目名称:AscEmu_Vanilla,代码行数:54,代码来源:Guild.cpp

示例5: WithdrawMoney

void Guild::WithdrawMoney(WorldSession * pClient, uint32 uAmount)
{
	PlayerInfo * pPlayer = pClient->GetPlayer()->m_playerInfo;
	GuildMember * pMember = pClient->GetPlayer()->m_playerInfo->guildMember;
	if(pMember==NULL)
		return;

	if(uAmount == 0)
		return;

	if(m_bankBalance < uAmount)
	{
		pClient->SystemMessage("You cannot withdraw more money then the account holds.");
		return;
	}

	// sanity checks (execpt for guildmasters)
	if( pPlayer->guildRank->iId !=0 )
	{
		if(pMember->pRank->iGoldLimitPerDay > 0 && pMember->CalculateAvailableAmount() < uAmount )
		{
			pClient->SystemMessage("You have already withdrawn too much today.");
			return;
		}
		if(pMember->pRank->iGoldLimitPerDay == 0 )
		{
			pClient->SystemMessage("You don't have permission to withdraw money.");
			return;
		}
	}

	// update his bank state
	pMember->OnMoneyWithdraw(uAmount);

	// give the gold! GM PLS GOLD PLS 1 COIN
	pClient->GetPlayer()->ModUnsigned32Value(PLAYER_FIELD_COINAGE, (uint32)uAmount);

	// subtract the balance
	m_bankBalance -= uAmount;

	// update in db
	CharacterDatabase.Execute("UPDATE guilds SET bankBalance = %u WHERE guildId = %u", (m_bankBalance>0)?m_bankBalance:0, m_guildId);

	// notify everyone with the new balance
	char buf[20];
	snprintf(buf, 20, I64FMT, (long long unsigned int)m_bankBalance);
	LogGuildEvent(GUILD_EVENT_SETNEWBALANCE, 1, buf);

	// log it!
	LogGuildBankActionMoney(GUILD_BANK_LOG_EVENT_WITHDRAW_MONEY, pClient->GetPlayer()->GetLowGUID(), uAmount);
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:51,代码来源:Guild.cpp

示例6: WithdrawMoney

void Guild::WithdrawMoney(WorldSession* pClient, uint32 uAmount)
{
	GuildMember* pMember = pClient->GetPlayer()->getPlayerInfo()->guildMember;
	if(pMember == NULL)
		return;

	// sanity checks
	if(pMember->pRank->iGoldLimitPerDay > 0)
	{
		if(pMember->CalculateAvailableAmount() < uAmount)
		{
			pClient->SystemMessage("You have already withdrawn too much today.");
			return;
		}
	}

	if(pMember->pRank->iGoldLimitPerDay == 0)
	{

		pClient->SystemMessage("You don't have permission to do that.");
		return;
	}

	if(m_bankBalance < uAmount)
		return;

	// Check they dont have more than the max gold
	if(sWorld.GoldCapEnabled)
	{
		if((pClient->GetPlayer()->GetGold() + uAmount) > sWorld.GoldLimit)
		{
			pClient->GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_TOO_MUCH_GOLD);
			return;
		}
	}

	// update his bank state
	pMember->OnMoneyWithdraw(uAmount);

	// give the gold! GM PLS GOLD PLS 1 COIN
	pClient->GetPlayer()->ModGold((uint32)uAmount);

	SpendMoney(uAmount);

	// log it!
	LogGuildBankActionMoney(GUILD_BANK_LOG_EVENT_WITHDRAW_MONEY, pClient->GetPlayer()->GetLowGUID(), uAmount);
}
开发者ID:Antares84,项目名称:arcemu,代码行数:47,代码来源:Guild.cpp

示例7: throw

void CGSelectGuildMemberHandler::execute (CGSelectGuildMember* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	SYSTEM_ASSERT(SYSTEM_GUILD);

	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	Assert(pGamePlayer != NULL);

	PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pGamePlayer->getCreature());
	Assert(pPlayerCreature != NULL);

	// 선택한 길드를 가져온다.
	Guild* pGuild = g_pGuildManager->getGuild(pPlayerCreature->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;

	GCShowGuildMemberInfo gcShowGuildMemberInfo;
	gcShowGuildMemberInfo.setGuildID(pGuildMember->getGuildID());
	gcShowGuildMemberInfo.setName(pGuildMember->getName());
	gcShowGuildMemberInfo.setGuildMemberRank(pGuildMember->getRank());
	gcShowGuildMemberInfo.setGuildMemberIntro(pGuildMember->getIntro());

	pPlayer->sendPacket(&gcShowGuildMemberInfo);

#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:40,代码来源:CGSelectGuildMemberHandler.cpp

示例8: while

void GuildManager::updateList()
{
    Guild *guild = Guild::getGuild(1);
    if (guild)
    {
        guild->setServerGuild(false);
        StringVectCIter it = mTempList.begin();
        StringVectCIter it_end = mTempList.end();
        int i = 0;
        while (it != it_end)
        {
            std::string name = *it;
            if (name.size() > 1)
            {
                int status = atoi(name.substr(name.size() - 1).c_str());

                name = name.substr(0, name.size() - 1);
                GuildMember *m = guild->addMember(i, 0, name);
                if (m)
                {
                    m->setOnline(status & 1);
                    m->setGender(GENDER_UNSPECIFIED);
                    if (status & 2)
                        m->setPos(10);
                    else
                        m->setPos(0);
                    if (player_node && name == player_node->getName())
                    {
                        mHavePower = (status & 2);
                        m->setOnline(true);
                    }
                }
            }
            ++ it;
            i ++;
        }
        guild->sort();
        createTab(guild);
        if (actorSpriteManager)
        {
            actorSpriteManager->updatePlayerGuild();
            actorSpriteManager->updatePlayerColors();
        }
    }
    mTempList.clear();
    mSentInfoRequest = false;
    mGotInfo = true;
}
开发者ID:Evonline,项目名称:ManaPlus,代码行数:48,代码来源:guildmanager.cpp

示例9: throw

void CGModifyGuildMemberHandler::execute (CGModifyGuildMember* pPacket , Player* pPlayer)
	 throw(Error)
{
	__BEGIN_TRY __BEGIN_DEBUG_EX
		
#ifdef __GAME_SERVER__

	//cout << "CGModifyGuildMember received." << endl;

	Assert(pPacket != NULL);
	Assert(pPlayer != NULL);

	SYSTEM_ASSERT(SYSTEM_GUILD);

	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pPlayer);
	Assert(pGamePlayer != NULL);

	Creature* pCreature = pGamePlayer->getCreature();
	Assert(pCreature != NULL);

	PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
	Assert(pPlayerCreature != NULL);

	// 길드를 가져온다.
	Guild* pGuild = g_pGuildManager->getGuild(pPlayerCreature->getGuildID());
	//try { Assert(pGuild != NULL); } catch (Throwable& t ) { return; }
	if (pGuild==NULL) return;

	// 길드 멤버 정보를 가져온다.
	GuildMember* pGuildMember  = pGuild->getMember(pPlayerCreature->getName());
	//try { Assert(pGuild != NULL); } catch (Throwable& t ) { return; }
	if (pGuildMember==NULL) return;

	//cout << "get guild" << endl;

	if (pPacket->getGuildMemberRank() == GuildMember::GUILDMEMBER_RANK_DENY )
	{
		////////////////////////////////////////////////////////
		// 길드 멤버를 추방한다.
		////////////////////////////////////////////////////////

		// 마스터가 아니면 추방할 수 없다.
		if (pGuildMember->getRank() != GuildMember::GUILDMEMBER_RANK_MASTER )
			return;

		if (g_pGuildManager->hasActiveWar(pGuild->getID() ) )
		{
			GCSystemMessage msg;
			msg.setMessage(g_pStringPool->getString(STRID_CANNOT_KICK_DURING_WAR ));
			pPlayer->sendPacket(&msg);

			return;
		}

		GSExpelGuildMember gsExpelGuildMember;
		gsExpelGuildMember.setGuildID(pGuild->getID());
		gsExpelGuildMember.setName(pPacket->getName());
		gsExpelGuildMember.setSender(pPlayerCreature->getName());

		//cout << "send GSExpelGuildMember" << endl;
		g_pSharedServerManager->sendPacket(&gsExpelGuildMember);
	}
	else
	{
		if (pGuild->getActiveMemberCount() >= MAX_GUILDMEMBER_ACTIVE_COUNT )
		{
			GCSystemMessage msg;
			msg.setMessage(g_pStringPool->getString(STRID_CANNOT_ACCEPT_MORE_JOIN ));
			pPlayer->sendPacket(&msg);

			return;
		}
		///////////////////////////////////////////////////////
		// 길드 가입을 승인한다.
		///////////////////////////////////////////////////////

		// 마스터나 서브마스터 이어야 한다.
		if (pGuildMember->getRank() != GuildMember::GUILDMEMBER_RANK_MASTER
		  && pGuildMember->getRank() != GuildMember::GUILDMEMBER_RANK_SUBMASTER )
			return;

		if (g_pGuildManager->hasActiveWar(pGuild->getID() ) )
		{
			GCSystemMessage msg;
			msg.setMessage(g_pStringPool->getString(STRID_CANNOT_ACCEPT_DURING_WAR ));
			pPlayer->sendPacket(&msg);

			return;
		}

		GSModifyGuildMember gsModifyGuildMember;
		gsModifyGuildMember.setGuildID(pGuild->getID());
		gsModifyGuildMember.setName(pPacket->getName());
		gsModifyGuildMember.setGuildMemberRank(pPacket->getGuildMemberRank());
		gsModifyGuildMember.setSender(pPlayerCreature->getName());

		//cout << "send GSModifyGuildMember" << endl;
		g_pSharedServerManager->sendPacket(&gsModifyGuildMember);
	}

//.........这里部分代码省略.........
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:CGModifyGuildMemberHandler.cpp

示例10: throw

//----------------------------------------------------------------------
// 
// SGModifyGuildOKHandler::execute()
// 
//----------------------------------------------------------------------
void SGModifyGuildOKHandler::execute (SGModifyGuildOK* pPacket )
	 throw(ProtocolException , Error )
{
	__BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

	Guild* pGuild = g_pGuildManager->getGuild(pPacket->getGuildID());
	Assert(pGuild != NULL);

	if (pGuild->getState() == Guild::GUILD_STATE_WAIT && pPacket->getGuildState() == Guild::GUILD_STATE_ACTIVE )
	{
		/////////////////////////////////////////////////////////////
		// 존 추가
		/////////////////////////////////////////////////////////////
/*		if (pGuild->getServerGroupID() == g_pConfig->getPropertyInt("ServerID" ) )
		{
			// 이 게임 서버에 길드 아지트를 만든다.

			//////////////
			// Zone Info
			//////////////
			ZoneInfo* pZoneInfo = new ZoneInfo();
			pZoneInfo->setZoneID(pGuild->getZoneID());
			pZoneInfo->setZoneGroupID(2);
			pZoneInfo->setZoneType("NPC_SHOP");
			pZoneInfo->setZoneLevel(0);
			pZoneInfo->setZoneAccessMode("PUBLIC");
			pZoneInfo->setZoneOwnerID("");
			pZoneInfo->setPayPlay("");
			if (pGuild->getRace() == Guild::GUILD_RACE_SLAYER )
			{
				pZoneInfo->setSMPFilename("team_hdqrs.smp");
				pZoneInfo->setSSIFilename("team_hdqrs.ssi");
				string Name = "team - " + pGuild->getName();
				pZoneInfo->setFullName(Name);
				pZoneInfo->setShortName(Name);
			}
			else if (pGuild->getRace() == Guild::GUILD_RACE_VAMPIRE )
			{
				pZoneInfo->setSMPFilename("clan_hdqrs.smp");
				pZoneInfo->setSSIFilename("clan_hdqrs.ssi");
				string Name = "clan - " + pGuild->getName();
				pZoneInfo->setFullName(Name);
				pZoneInfo->setShortName(Name);
			}

			g_pZoneInfoManager->addZoneInfo(pZoneInfo);
			
			/////////
			// Zone
			/////////
			Zone* pZone = new Zone(pGuild->getZoneID());
			Assert(pZone != NULL);

			ZoneGroup* pZoneGroup = g_pZoneGroupManager->getZoneGroup(2);
			Assert(pZoneGroup != NULL);

			pZone->setZoneGroup(pZoneGroup);
			pZoneGroup->addZone(pZone);
			pZone->init();
		}
*/

		// 정식 길드로 변경
		pGuild->setState(Guild::GUILD_STATE_ACTIVE);

		HashMapGuildMember& Members = pGuild->getMembers();
		HashMapGuildMemberItor itr = Members.begin();
		for (; itr != Members.end(); itr++ )
		{
			GuildMember* pGuildMember = itr->second;

			// 멤버가 접속해 있다면
			__ENTER_CRITICAL_SECTION((*g_pPCFinder))

			Creature* pCreature = g_pPCFinder->getCreature_LOCKED(pGuildMember->getName());
			if (pCreature != NULL && pCreature->isPC() )
			{
				Player* pPlayer = pCreature->getPlayer();
				Assert(pPlayer != NULL);

				PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
				Assert(pPlayerCreature != NULL);

				// 길드 아이디를 바꿔준다.
				pPlayerCreature->setGuildID(pGuild->getID());

				// 클라이언트에 길드 아이디가 바꼈음을 알려준다.
				GCModifyGuildMemberInfo gcModifyGuildMemberInfo;
				gcModifyGuildMemberInfo.setGuildID(pGuild->getID());
				gcModifyGuildMemberInfo.setGuildName(pGuild->getName());
				gcModifyGuildMemberInfo.setGuildMemberRank(pGuildMember->getRank());
				pPlayer->sendPacket(&gcModifyGuildMemberInfo);

//.........这里部分代码省略.........
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:SGModifyGuildOKHandler.cpp

示例11: throw

//----------------------------------------------------------------------
// 
// 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

示例12: cleared

void GuildShell::guildMemberList(const uint8_t* data, size_t len)
{
  // clear out any existing member data
  emit cleared();
  m_members.clear();

  m_maxNameLength = 0;

  // construct a netstream object on the data
  NetStream gml(data, len);
  
  // read the player name from the front of the stream
  QString player = gml.readText();

  // read the player count from the stream
  uint32_t count;
  count = gml.readUInt32();

#ifdef GUILDSHELL_DIAG
  seqDebug("Guild has %d members:", count);
#endif

  GuildMember* member;

#ifdef GUILDSHELL_DIAG
  QDateTime dt;
#endif // GUILDSHELL_DIAG

  // iterate over the data until we reach the end of it
  while (!gml.end())
  {
    // create a new guildmember initializing it from the NetStream
    member = new GuildMember(gml);

    // insert the new member into the dictionary
    m_members.insert(member->name(), member);
    
    // check for new longest member name
    if (member->name().length() > m_maxNameLength)
      m_maxNameLength = member->name().length();

    emit added(member);

#ifdef GUILDSHELL_DIAG
    dt.setTime_t(member->lastOn());
    seqDebug("%-64s\t%d\t%s\t%d\t%s\t'%s'\t%s:%d",
	     (const char*)member->name(),
	     member->level(),
	     (const char*)classString(member->classVal()),
	     member->guildRank(), 
	     (const char*)dt.toString(),
	     (const char*)member->publicNote(),
	     (const char*)m_zoneMgr->zoneNameFromID(member->zoneId()),
	     member->zoneInstance());
#endif	     
  }

  emit loaded();

#ifdef GUILDSHELL_DIAG
  seqDebug("Finished processing %d guildmates. %d chars in longest name.", 
	   m_members.count(), m_maxNameLength);
#endif // 
}
开发者ID:xbackupx,项目名称:showeqx,代码行数:64,代码来源:guildshell.cpp

示例13: throw

//----------------------------------------------------------------------
// 
// SGDeleteGuildOKHandler::execute()
// 
//----------------------------------------------------------------------
void SGDeleteGuildOKHandler::execute (SGDeleteGuildOK* pPacket )
	 throw(ProtocolException , Error )
{
	__BEGIN_TRY

#ifdef __GAME_SERVER__

	// 길드 아지트에 있는 멤버를 warp 시킨다.
	// 길드 아지트를 삭제한다.
	// 멤버 warp와 길드 아지트 삭제 시 다른 쓰레드에서 ZoneGroup Thread 내부에서 일어나게 해야 별탈이 없을 듯 하다.
	// 일단은 걍 둔다. Portal 이 막히므로 다시 들어갈 수 없을 것이다.
	
	Assert(pPacket != NULL);

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


	// 길드 활동 중인 상태에서의 해체인지 대기 중인 상태에서의 해체인지 구별한다.
	if (pGuild->getState() == Guild::GUILD_STATE_ACTIVE )
	{
		HashMapGuildMember& Members = pGuild->getMembers();
		HashMapGuildMemberItor itr = Members.begin();

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

			// 접속해 있으면
			__ENTER_CRITICAL_SECTION((*g_pPCFinder))

			Creature* pCreature = g_pPCFinder->getCreature_LOCKED(pGuildMember->getName());
			if (pCreature != NULL && pCreature->isPC() )
			{
				Player* pPlayer = pCreature->getPlayer();
				Assert(pPlayer != NULL);

				PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
				Assert(pPlayerCreature != NULL);

				// Slayer, Vampire 의 길드 아이디를 바꾼다.
				if (pPlayerCreature->isSlayer() )
				{
					pPlayerCreature->setGuildID(99);		// 슬레이어 가입안한 상태의 길드 ID

					// 클라이언트에 길드 아이디가 바꼈음을 알린다.
					GCModifyGuildMemberInfo gcModifyGuildMemberInfo;
					gcModifyGuildMemberInfo.setGuildID(pPlayerCreature->getGuildID());
					gcModifyGuildMemberInfo.setGuildName("");
					gcModifyGuildMemberInfo.setGuildMemberRank(GuildMember::GUILDMEMBER_RANK_DENY);
					pPlayer->sendPacket(&gcModifyGuildMemberInfo);
				}
				else if (pPlayerCreature->isVampire() )
				{
					pPlayerCreature->setGuildID(0);		// 뱀파이어 가입안한 상태의 길드 ID

					// 클라이언트에 길드 아이디가 바꼈음을 알린다.
					GCModifyGuildMemberInfo gcModifyGuildMemberInfo;
					gcModifyGuildMemberInfo.setGuildID(pPlayerCreature->getGuildID());
					gcModifyGuildMemberInfo.setGuildName("");
					gcModifyGuildMemberInfo.setGuildMemberRank(GuildMember::GUILDMEMBER_RANK_DENY);
					pPlayer->sendPacket(&gcModifyGuildMemberInfo);
				}
				else if (pPlayerCreature->isOusters() )
				{
					pPlayerCreature->setGuildID(66);		// 아우스터즈 가입안한 상태의 길드 ID

					// 클라이언트에 길드 아이디가 바꼈음을 알린다.
					GCModifyGuildMemberInfo gcModifyGuildMemberInfo;
					gcModifyGuildMemberInfo.setGuildID(pPlayerCreature->getGuildID());
					gcModifyGuildMemberInfo.setGuildName("");
					gcModifyGuildMemberInfo.setGuildMemberRank(GuildMember::GUILDMEMBER_RANK_DENY);
					pPlayer->sendPacket(&gcModifyGuildMemberInfo);
				}

				// 주위에 클라이언트에 길드 아이디가 바꼈음을 알린다.
				GCOtherModifyInfo gcOtherModifyInfo;
				gcOtherModifyInfo.setObjectID(pCreature->getObjectID());
				gcOtherModifyInfo.addShortData(MODIFY_GUILDID, pPlayerCreature->getGuildID());

				Zone* pZone = pCreature->getZone();
				Assert(pZone != NULL);

				pZone->broadcastPacket(pCreature->getX(), pCreature->getY(), &gcOtherModifyInfo, pCreature);
			}

			__LEAVE_CRITICAL_SECTION((*g_pPCFinder))

			// Guild Member 객체를 삭제한다.
			SAFE_DELETE(pGuildMember);
		}

		// 길드 멤버 맵을 삭제한다.
		Members.clear();
//.........这里部分代码省略.........
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:SGDeleteGuildOKHandler.cpp

示例14: throw

//----------------------------------------------------------------------
//
// SGAddGuildMemberOKHandler::execute()
//
//----------------------------------------------------------------------
void SGAddGuildMemberOKHandler::execute (SGAddGuildMemberOK* pPacket )
throw(ProtocolException , Error )
{
    __BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

    // 길드 멤버 object 를 만든다.
    GuildMember* pGuildMember = new GuildMember();
    pGuildMember->setGuildID(pPacket->getGuildID());
    pGuildMember->setName(pPacket->getName());
    pGuildMember->setRank(pPacket->getGuildMemberRank());

    // 길드에 추가한다.
    Guild* pGuild = g_pGuildManager->getGuild(pGuildMember->getGuildID());
    pGuild->addMember(pGuildMember);

    // 멤버에게 메세지를 보낸다.
    __ENTER_CRITICAL_SECTION((*g_pPCFinder))

    Creature* pCreature = g_pPCFinder->getCreature_LOCKED(pGuildMember->getName());
    if (pCreature != NULL && pCreature->isPC() )
    {
        Player* pPlayer = pCreature->getPlayer();
        Assert(pPlayer != NULL);

        if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_MASTER ||
                pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_SUBMASTER )		// 길드마스터나 서브마스터일 경우
        {
            PlayerCreature* pPlayerCreature = dynamic_cast<PlayerCreature*>(pCreature);
            Assert(pPlayerCreature != NULL);

            Gold_t Fee;
            if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_MASTER )
                Fee = REQUIRE_SLAYER_MASTER_GOLD;
            else if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_SUBMASTER )
                Fee = REQUIRE_SLAYER_SUBMASTER_GOLD;
            else
                Fee = 0;

            Gold_t CurMoney = pPlayerCreature->getGold();
            if (CurMoney < Fee )
            {
                // 큰일났군
                CurMoney = 0;
            }
            else
                CurMoney -= Fee;

            pPlayerCreature->setGoldEx(CurMoney);

            if (Fee != 0 )
            {
                GCModifyInformation gcModifyInformation;
                gcModifyInformation.addLongData(MODIFY_GOLD, CurMoney);

                // 바뀐정보를 클라이언트에 보내준다.
                pPlayer->sendPacket(&gcModifyInformation);
            }

            // 길드 가입 메시지를 보여준다.
            GCSystemMessage gcSystemMessage;
            if (pGuild->getRace() == Guild::GUILD_RACE_SLAYER )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_TEAM_JOIN_ACCEPTED ));
            else if (pGuild->getRace() == Guild::GUILD_RACE_VAMPIRE )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CLAN_JOIN_ACCEPTED ));
            else if (pGuild->getRace() == Guild::GUILD_RACE_OUSTERS )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CLAN_JOIN_ACCEPTED ));
            pPlayer->sendPacket(&gcSystemMessage);

        }
        else if (pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_WAIT )
        {
            // 길드 가입 신청 메시지를 보낸다.
            GCSystemMessage gcSystemMessage;
            if (pGuild->getRace() == Guild::GUILD_RACE_SLAYER )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_TEAM_JOIN_TRY ));
            else if (pGuild->getRace() == Guild::GUILD_RACE_VAMPIRE )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CLAN_JOIN_TRY ));
            else if (pGuild->getRace() == Guild::GUILD_RACE_OUSTERS )
                gcSystemMessage.setMessage(g_pStringPool->getString(STRID_CLAN_JOIN_TRY ));

            pPlayer->sendPacket(&gcSystemMessage);
        }
    }
    else
    {
        // 접속이 안되어 있다.

        // 마스터나 서브마스터일 경우
        // DB 에서 돈을 까도록 한다.
        if ((pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_MASTER ||
                pGuildMember->getRank() == GuildMember::GUILDMEMBER_RANK_SUBMASTER )		// 길드마스터나 서브마스터일 경우
                && pPacket->getServerGroupID() == g_pConfig->getPropertyInt("ServerID" ) )		// 이 게임 서버에서 추가한 길드원인가?
        {
//.........这里部分代码省略.........
开发者ID:opendarkeden,项目名称:server,代码行数:101,代码来源:SGAddGuildMemberOKHandler.cpp

示例15: createGuild

bool GuildManager::process(std::string msg)
{
    if (msg.size() > 4 && msg[0] == '#' && msg[1] == '#')
        msg = msg.substr(3);

    bool haveNick = (msg.find(": ") != std::string::npos);

    if (!haveNick && findCutLast(msg, " is now Offline."))
    {
        Guild *guild = createGuild();
        if (!guild)
            return false;
        if (msg.size() < 4)
            return false;
        if (msg[0] == '#' && msg[1] == '#')
            msg = msg.substr(3);

        GuildMember *m = guild->addMember(msg);
        if (m)
            m->setOnline(false);
        guild->sort();
        mRequest = false;
        return true;
    }
    else if (!haveNick && findCutLast(msg, " is now Online."))
    {
        Guild *guild = createGuild();
        if (!guild)
            return false;
        if (msg.size() < 4)
            return false;
        if (msg[0] == '#' && msg[1] == '#')
            msg = msg.substr(3);
        GuildMember *m = guild->addMember(msg);
        if (m)
            m->setOnline(true);
        guild->sort();
        mRequest = false;
        return true;
    }
    else if (findCutFirst(msg, "Welcome to the "))
    {
        Guild *guild = createGuild();
        if (!guild)
            return false;
//        logger->log("welcome message: %s", msg.c_str());
        size_t pos = msg.find("! (");
        if (pos == std::string::npos)
            return false;
        msg = msg.substr(0, pos);
        guild->setName(msg);
        if (player_node)
            player_node->setGuildName(msg);
        mGotName = true;
        mSentNameRequest = false;
        mRequest = false;
        return true;
    }
    else if (findCutFirst(msg, "Player name: "))
    {
        Guild *guild = createGuild();
        if (!guild)
            return false;
        size_t pos = msg.find("Access Level: ");
        if (pos == std::string::npos)
            return false;

        msg = msg.substr(pos);
        if (!findCutFirst(msg, "Access Level: "))
            return false;

        pos = msg.find(", Guild:");
        if (pos == std::string::npos)
            return false;

        int level = atoi(msg.substr(0, pos).c_str());
        if (level >= 10)
            mHavePower = true;
        else
            mHavePower = false;

        msg = msg.substr(pos + strlen(", Guild:"));
        pos = msg.find(", No. Of Online Players: ");
        if (pos == std::string::npos)
            return false;

        msg = msg.substr(0, pos);
//        logger->log("guild name: %s", msg.c_str());

        guild->setName(msg);
        if (player_node)
            player_node->setGuildName(msg);
        mGotName = true;
        mSentNameRequest = false;
        mRequest = false;
        return true;
    }
    else if (findCutFirst(msg, "OL#"))
    {
//        logger->log("OL");
//.........这里部分代码省略.........
开发者ID:Evonline,项目名称:ManaPlus,代码行数:101,代码来源:guildmanager.cpp


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