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


C++ PlayerCreature::getGuildID方法代码示例

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


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

示例1: execute

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: execute

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

示例3: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionShowTaxBalance::execute (Creature * pCreature1 , Creature * pCreature2) 
	throw(Error)
{
	__BEGIN_TRY

	Assert(pCreature1 != NULL);
	Assert(pCreature2 != NULL);
	Assert(pCreature1->isNPC());
	Assert(pCreature2->isPC());

	bool bSuccess = true;

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);

	Player* pPlayer = pPC->getPlayer();
	Assert(pPlayer != NULL);

	GuildID_t guildID = pPC->getGuildID();
	GCNPCResponse deny;

	Guild* pGuild = g_pGuildManager->getGuild(guildID);
	if(bSuccess && pGuild == NULL ) 
	{
		// 길드가 없다.
		bSuccess = false;
		deny.setCode(NPC_RESPONSE_NO_GUILD);
	}

	if(bSuccess && pGuild->getMaster() != pPC->getName() )
	{
		// 길드 마스터가 아니다.
		bSuccess = false;
		deny.setCode(NPC_RESPONSE_NOT_GUILD_MASTER);
	}

	// 길드 마스터이다.
	list<CastleInfo*> pCastleInfoList = g_pCastleInfoManager->getGuildCastleInfos(guildID);
	if(bSuccess && pCastleInfoList.empty() )
	{
		// 길드가 소유한 성이 없다.
		bSuccess = false;
		deny.setCode(NPC_RESPONSE_HAS_NO_CASTLE);
	}

    list<CastleInfo*>::iterator itr = pCastleInfoList.begin();
    CastleInfo* pCastleInfo = NULL;

	for (; itr != pCastleInfoList.end() ; itr++ )
	{
		if ((*itr)->getZoneID() == pCreature1->getZoneID() )
		{
			pCastleInfo = (*itr);
			break;
		}
	}

	if(bSuccess && pCastleInfo == NULL)
	{
		bSuccess = false;
		deny.setCode(NPC_RESPONSE_NOT_YOUR_CASTLE);
	}

	if (bSuccess )
	{
		GCNPCResponse response;
		response.setCode(NPC_RESPONSE_SHOW_TAX_BALANCE);
		response.setParameter((uint)pCastleInfo->getTaxBalance());
		pPlayer->sendPacket(&response);
	}
	else
	{
		pPlayer->sendPacket(&deny);
	}
	
	GCNPCResponse quit;
	quit.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
	pPlayer->sendPacket(&quit);

	__END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:83,代码来源:ActionShowTaxBalance.cpp

示例4: execute

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

示例5: execute

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

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

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

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

#ifdef __OLD_GUILD_WAR__
	GCSystemMessage gcSM;
	gcSM.setMessage("아직 지원되지 않는 기능입니다.");
	pGamePlayer->sendPacket(&gcSM);
	return;
#endif

	SYSTEM_ASSERT(SYSTEM_GUILD);

	GCGuildResponse gcGuildResponse;

	GuildUnion *pUnion = GuildUnionManager::Instance().getGuildUnion(pPlayerCreature->getGuildID());
	if(pUnion == NULL)
	{
		gcGuildResponse.setCode(GuildUnionOfferManager::NOT_IN_UNION);
		pPlayer->sendPacket(&gcGuildResponse);

		return;
	}
	
	// 요청한놈이 지가 속한 길드의 마스터인가? || 연합의 마스터길드가 내 길드가 맞나?
	if(!g_pGuildManager->isGuildMaster (pPlayerCreature->getGuildID(), pPlayerCreature )
		|| pUnion->getMasterGuildID() != pPlayerCreature->getGuildID() 		
		)
	{
		// GC_GUILD_RESPONSE 날려준다.
		// 내용 : 길드 마스터가 아니자녀 -.-+

		gcGuildResponse.setCode(GuildUnionOfferManager::SOURCE_IS_NOT_MASTER);
		pPlayer->sendPacket(&gcGuildResponse);

		return;
	}

	uint result = GuildUnionOfferManager::Instance().acceptQuit(pPacket->getGuildID());

	gcGuildResponse.setCode(result);
	pPlayer->sendPacket(&gcGuildResponse);
////////////////////

	if(result == GuildUnionOfferManager::OK)
	{
	
		Guild*  pGuild  = g_pGuildManager->getGuild(pPacket->getGuildID());

		if(pGuild == NULL)
		{
			return;
		}
		string  TargetGuildMaster = pGuild->getMaster();

		//cout << "연합탈퇴가 수락되었다. 통보받을 유저는 : " << TargetGuildMaster.c_str() << endl;


		Statement* pStmt = NULL;

		BEGIN_DB
		{
			pStmt = g_pDatabaseManager->getConnection("DARKEDEN" )->createStatement();
			pStmt->executeQuery("INSERT INTO Messages (Receiver, Message) values('%s','%s')", TargetGuildMaster.c_str(),  g_pStringPool->c_str(375 ));

			// 탈퇴수락한뒤에 나 혼자 남아있다면?
			Result *pResult = pStmt->executeQuery("SELECT count(*) FROM GuildUnionMember WHERE UnionID='%u'", pUnion->getUnionID());
			pResult->next();

			if(pResult->getInt(1) == 0)
			{
				//cout << "연합탈퇴가 수락된후..남아있는 멤버가 없으면..연합장이면 안되니까..지워버린다" << endl;
				pStmt->executeQuery("DELETE FROM GuildUnionInfo WHERE UnionID='%u'", pUnion->getUnionID());
				GuildUnionManager::Instance().reload();

			}
		
			
			SAFE_DELETE(pStmt);
		}
		END_DB(pStmt)
		
		// 연합탈퇴하면 연합정보가 바뀌었을 수도 있다. 갱신된 정보를 다시 보내준다.
		Creature *pCreature = NULL;
		pCreature = pGamePlayer->getCreature();

		if(pCreature == NULL)   return;

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

示例6: execute

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

示例7: execute

void CGRequestUnionInfoHandler::execute (CGRequestUnionInfo* 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);

#ifdef __OLD_GUILD_WAR__
	GCSystemMessage gcSM;
	gcSM.setMessage("아직 지원되지 않는 기능입니다.");
	pGamePlayer->sendPacket(&gcSM);
	return;
#endif

	GCGuildResponse gcGuildResponse;
	
	GuildUnion	*pGuildUnion	= GuildUnionManager::Instance().getGuildUnion(pPlayerCreature->getGuildID());
	// 자기가 속한 길드가 연합에 가입되어있는지 찾는다
	if (pGuildUnion == NULL)
	{
	
		gcGuildResponse.setCode(GuildUnionOfferManager::NOT_IN_UNION);
		pPlayer->sendPacket(&gcGuildResponse);

		return;
	}

	// Master 길드의 정보를 가져온다.
	Guild* pGuild = g_pGuildManager->getGuild(pGuildUnion->getMasterGuildID());

	if (pGuild == NULL)
	{
		gcGuildResponse.setCode(GuildUnionOfferManager::NO_TARGET_UNION);
		pPlayer->sendPacket(&gcGuildResponse);
	
		return;
	}

	
	GCShowUnionInfo	gcShowUnionInfo;
	
	if (pGuild->getState() == Guild::GUILD_STATE_ACTIVE )
	{
		
		gcShowUnionInfo.getMasterGuildInfo().setGuildID(pGuild->getID());
		gcShowUnionInfo.getMasterGuildInfo().setGuildName(pGuild->getName());
		gcShowUnionInfo.getMasterGuildInfo().setGuildState(pGuild->getState());
		gcShowUnionInfo.getMasterGuildInfo().setGuildMaster(pGuild->getMaster());
		gcShowUnionInfo.getMasterGuildInfo().setGuildMemberCount(pGuild->getActiveMemberCount());
		gcShowUnionInfo.getMasterGuildInfo().setGuildIntro(pGuild->getIntro());
		gcShowUnionInfo.getMasterGuildInfo().setJoinFee(0);
	}

	list<GuildID_t> gList = pGuildUnion->getGuildList();
	list<GuildID_t>::iterator itr = gList.begin();
	for (; itr != gList.end() ; ++itr )
    {

		Guild*	pGuild2	= g_pGuildManager->getGuild(*itr); 
		if(pGuild2 != NULL)
		{
			SingleGuildInfo	*GuildInfo	= new SingleGuildInfo;
			
			GuildInfo->setGuildID(pGuild2->getID());
			GuildInfo->setGuildName(pGuild2->getName());
			GuildInfo->setGuildState(pGuild2->getState());
			GuildInfo->setGuildMaster(pGuild2->getMaster());
			GuildInfo->setGuildMemberCount(pGuild2->getActiveMemberCount());
			GuildInfo->setGuildIntro(pGuild2->getIntro());
			GuildInfo->setJoinFee(0);

			gcShowUnionInfo.addGuildInfoList(GuildInfo);
		}
    }
	
	pPlayer->sendPacket(&gcShowUnionInfo);
	
#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:92,代码来源:CGRequestUnionInfoHandler.cpp

示例8: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionRegisterSiege::execute (Creature * pCreature1 , Creature * pCreature2) 
	throw(Error)
{
	__BEGIN_TRY

#ifndef __OLD_GUILD_WAR__

	Assert(pCreature1 != NULL);
	Assert(pCreature2 != NULL);
	Assert(pCreature1->isNPC());
	Assert(pCreature2->isPC());

	SYSTEM_RETURN_IF_NOT(SYSTEM_GUILD_WAR);

	GCNPCResponse gcNPCResponse;

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
	GuildID_t guildID = pPC->getGuildID();

	if (!g_pVariableManager->isWarActive() || !g_pVariableManager->isActiveGuildWar() )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_WAR_UNAVAILABLE);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	if (!g_pGuildManager->isGuildMaster(guildID, pPC ) )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_NOT_GUILD_MASTER);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	Gold_t warRegistrationFee = g_pVariableManager->getVariable(WAR_REGISTRATION_FEE);
	if (pPC->getGold() < warRegistrationFee )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_NOT_ENOUGH_MONEY);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	Zone* pZone = getZoneByZoneID(m_ZoneID);
	Assert(pZone != NULL);
	Assert(pZone->isCastle());

	WarScheduler* pWarScheduler = pZone->getWarScheduler();
	Assert(pWarScheduler != NULL);

	/* 성을 소유했어도 전쟁 신청이 되도록 수정함 (자기 성에는 신청 못하겠지 -_-;;)
	// 이미 성을 소유한 길드인가?
	if (g_pGuildManager->hasCastle(guildID ) )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_ALREADY_HAS_CASTLE);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}
	*/

//	ServerID_t serverID;
//	ZoneID_t zoneID;
//	bool bHasCastle = g_pGuildManager->hasCastle(guildID , serverID , zoneID);

//	if (bHasCastle && serverID == g_pConfig->getPropertyInt("ServerID" ) && zoneID == m_ZoneID )

	CastleInfo* pCastleInfo = g_pCastleInfoManager->getCastleInfo(m_ZoneID);
	GuildID_t ownerGuildID = pCastleInfo->getGuildID();

	if (guildID == ownerGuildID )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_ALREADY_HAS_CASTLE);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	// 이미 전쟁 신청을 했는가?
	if (g_pGuildManager->hasWarSchedule(guildID ) )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_WAR_ALREADY_REGISTERED);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	// 전쟁 스케쥴이 다 찼는가?
/*	if (!pWarScheduler->canAddWar(WAR_GUILD ) )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_WAR_SCHEDULE_FULL);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	GuildWar* pWar = new GuildWar(m_ZoneID, guildID, War::WAR_STATE_WAIT);

	pWar->setRegistrationFee(warRegistrationFee);

	if (!pWarScheduler->addWar(pWar ) )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_WAR_SCHEDULE_FULL);
//.........这里部分代码省略.........
开发者ID:hillwah,项目名称:darkeden,代码行数:101,代码来源:ActionRegisterSiege.cpp

示例9: execute

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

示例10: execute

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

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

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

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

#ifdef __OLD_GUILD_WAR__
	GCSystemMessage gcSM;
	gcSM.setMessage("아직 지원되지 않는 기능입니다.");
	pGamePlayer->sendPacket(&gcSM);
	return;
#endif

	GuildID_t guildID = pPC->getGuildID();

	list<CastleInfo*> pCastleInfoList = g_pCastleInfoManager->getGuildCastleInfos(guildID);
	if (pCastleInfoList.empty() )
	{
		GCNPCResponse fail;
		fail.setCode(NPC_RESPONSE_MODIFY_TAX_RATIO_FAIL);

		pGamePlayer->sendPacket(&fail);
		return;
	}

	bool bOwner = false;
	list<CastleInfo*>::iterator itr = pCastleInfoList.begin();
	CastleInfo* pCastleInfo = NULL;
	for (; itr != pCastleInfoList.end() ; itr++ )
	{
		if ((*itr)->getZoneID() == pPC->getZoneID() )
		{
			pCastleInfo = (*itr);
			bOwner = true;
			break;
		}
	}

	if (!g_pGuildManager->isGuildMaster(guildID, pPC )	// 길드 마스터가 아니다.
		|| !bOwner											// 이 플레이어의 길드가 점령한 성이 아니다.
		|| pPacket->getRatio() > 10
	)
	{
		GCNPCResponse fail;
		fail.setCode(NPC_RESPONSE_MODIFY_TAX_RATIO_FAIL);

		pGamePlayer->sendPacket(&fail);
		return;
	}

	g_pCastleInfoManager->setItemTaxRatio(pPC->getZone(), pPacket->getRatio()+100);
	GCNPCResponse ok;
	ok.setCode(NPC_RESPONSE_MODIFY_TAX_RATIO_OK);
	pGamePlayer->sendPacket(&ok);
	
#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:mrktj,项目名称:darkeden,代码行数:69,代码来源:CGModifyTaxRatioHandler.cpp

示例11: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionDenyReinforce::execute (Creature * pCreature1 , Creature * pCreature2) 
	throw(Error)
{
	__BEGIN_TRY

#ifndef __OLD_GUILD_WAR__

	Assert(pCreature1 != NULL);
	Assert(pCreature2 != NULL);
	Assert(pCreature1->isNPC());
	Assert(pCreature2->isPC());

	SYSTEM_RETURN_IF_NOT(SYSTEM_GUILD_WAR);

	GCNPCResponse gcNPCResponse;

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
	GuildID_t guildID = pPC->getGuildID();

	if (!g_pVariableManager->isWarActive() || !g_pVariableManager->isActiveGuildWar() )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_WAR_UNAVAILABLE);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	if (!g_pGuildManager->isGuildMaster(guildID, pPC ) )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_NOT_GUILD_MASTER);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	Zone* pZone = getZoneByZoneID(m_ZoneID);
	Assert(pZone != NULL);
	Assert(pZone->isCastle());

	WarScheduler* pWarScheduler = pZone->getWarScheduler();
	Assert(pWarScheduler != NULL);

	CastleInfo* pCastleInfo = g_pCastleInfoManager->getCastleInfo(m_ZoneID);
	GuildID_t ownerGuildID = pCastleInfo->getGuildID();

	if (guildID != ownerGuildID )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_NOT_YOUR_CASTLE);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);
		return;
	}

	Schedule* pNextSchedule = pWarScheduler->getRecentSchedule();

	Work* pNextWork = NULL;
	if (pNextSchedule != NULL ) pNextWork = pNextSchedule->getWork();

	SiegeWar* pNextWar = dynamic_cast<SiegeWar*>(pNextWork);

	if (pNextWar == NULL || pNextWar->recentReinforceCandidate() == 0 )
	{
		gcNPCResponse.setCode(NPC_RESPONSE_NO_WAR_REGISTERED);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);

		//SAFE_DELETE(pNextWar);
		return;
	}
	else if (pNextWar->getReinforceGuildID() == 0 )
	{
		WarSchedule* pNextWarSchedule = dynamic_cast<WarSchedule*>(pNextSchedule);
		Assert(pNextWarSchedule != NULL);

		if (!pNextWar->denyReinforce() )
		{
			gcNPCResponse.setCode(NPC_RESPONSE_CANNOT_ACCEPT);
			pPC->getPlayer()->sendPacket(&gcNPCResponse);

			//SAFE_DELETE(pNextWar);
			return;
		}
	}
	else
	{
		gcNPCResponse.setCode(NPC_RESPONSE_ALREADY_REINFORCE_ACCEPTED);
		pPC->getPlayer()->sendPacket(&gcNPCResponse);

		//SAFE_DELETE(pNextWar);
		return;
	}

	gcNPCResponse.setCode(NPC_RESPONSE_ACCEPT_OK);
	pPC->getPlayer()->sendPacket(&gcNPCResponse);

	gcNPCResponse.setCode(NPC_RESPONSE_QUIT_DIALOGUE);
	pPC->getPlayer()->sendPacket(&gcNPCResponse);

	return;

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

示例12: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionEnterSiege::execute (Creature * pNPC , Creature * pCreature) 
	throw(Error)
{
	__BEGIN_TRY
	__BEGIN_DEBUG

	Assert(pCreature != NULL);
	Assert(pCreature->isPC());

	GamePlayer* pGamePlayer = dynamic_cast<GamePlayer*>(pCreature->getPlayer());
	if (!g_pWarSystem->hasCastleActiveWar(m_ZoneID ) )
	{
		GCSystemMessage gcSM;
		gcSM.setMessage("공선전 중에만 입장하실 수 있습니다.");
		pGamePlayer->sendPacket(&gcSM);
		return;
	}

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);

	Assert(pPC != NULL);

	Zone* pZone = getZoneByZoneID(m_ZoneID);
	Assert(pZone != NULL);

	WarScheduler* pWS = pZone->getWarScheduler();
	Assert(pWS != NULL);

	ZoneID_t siegeZoneID = SiegeManager::Instance().getSiegeZoneID(m_ZoneID);
	Assert(siegeZoneID != 0);

/*	WarSchedule* pSchedule = dynamic_cast<WarSchedule*>(pWS->getRecentSchedule());
	if (pSchedule == NULL )
	{
		return;
	}*/

	SiegeWar* pSiegeWar = dynamic_cast<SiegeWar*>(g_pWarSystem->getActiveWar(m_ZoneID ));
	if (pSiegeWar == NULL )
	{
		GCSystemMessage gcSM;
		gcSM.setMessage("타입 1 서버 오류입니다. 운영팀에 문의하세요.");
		pGamePlayer->sendPacket(&gcSM);
		return;
	}

	int side = pSiegeWar->getGuildSide(pPC->getGuildID());
	if (side == 0 )
	{
		GCSystemMessage gcSM;
		gcSM.setMessage("전쟁에 참가한 길드가 아닙니다.");
		pGamePlayer->sendPacket(&gcSM);
		return;
	}
	
	if (!g_pGuildManager->isGuildMaster(pPC->getGuildID(), pPC ) )
	{
		GCSystemMessage gcSM;
		gcSM.setMessage("길드 마스터만 가능합니다.");
		pGamePlayer->sendPacket(&gcSM);
		return;
	}

	static TPOINT targetPos[7] =
	{
		{172, 38},
		{172, 38},
		{20, 232},
		{20, 232},
		{20, 232},
		{20, 232},
		{20, 232}
	};

	// 소환자의 존과 좌표.
	ZoneID_t ZoneNum = siegeZoneID;
	Coord_t ZoneX = targetPos[side-1].x;
	Coord_t ZoneY = targetPos[side-1].y;

	for (int i=0; i<7; ++i )
	{
		deleteCreatureEffect(pPC, (Effect::EffectClass)(Effect::EFFECT_CLASS_SIEGE_DEFENDER + i));
	}

	if (side < 8 && side > 0 )
	{
		//cout << "side : " << side << endl;
		addSimpleCreatureEffect(pPC, (Effect::EffectClass)(Effect::EFFECT_CLASS_SIEGE_DEFENDER + side - 1));
	}

	EventTransport* pEvent = dynamic_cast<EventTransport*>(pGamePlayer->getEvent(Event::EVENT_CLASS_TRANSPORT));
	bool newEvent = false;
	if (pEvent==NULL)
	{
		pEvent = new EventTransport(pGamePlayer);
		newEvent = true;
	}
//.........这里部分代码省略.........
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:ActionEnterSiege.cpp


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