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


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

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


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

示例1: execute

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

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

	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature2);
	Assert(pPC != NULL);

	QuestID_t	qID;
	int questLevel = m_QuestLevel;

	if (questLevel < 0 ) questLevel = pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel() - 1;

	//cout << "Activated : " << toString() << " ... " << pPC->getName() << " ...  " << questLevel << endl;

	EventQuestAdvance::Status status = pPC->getQuestManager()->getEventQuestAdvanceManager()->getStatus(questLevel);
	int ownerQuestLevel = pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel();

	if (
		(ownerQuestLevel > questLevel && status == EventQuestAdvance::EVENT_QUEST_ADVANCED )
	||	((questLevel == 4 && ownerQuestLevel == -1 ) || pPC->getQuestManager()->successEventQuest(questLevel, qID ) )
	)
	{
		GamePlayer* pGP = dynamic_cast<GamePlayer*>(pPC->getPlayer());
		Assert (pGP != NULL);

//		if (g_pConfig->getPropertyInt("IsNetMarble" ) || !pGP->isPayPlaying() )
		if (true )
		{
			pPC->getQuestManager()->getEventQuestAdvanceManager()->rewarded(questLevel);
			pPC->getQuestManager()->getEventQuestAdvanceManager()->save();
			if (questLevel != 4 )
				pPC->getQuestManager()->questRewarded(qID);
			else
				pPC->getQuestManager()->cancelQuest();

			pPC->setLottoQuestLevel(questLevel);

			list<Item*> iList;
			pPC->getInventory()->clearQuestItem(iList);

			list<Item*>::iterator itr = iList.begin();
			list<Item*>::iterator endItr = iList.end();

			for (; itr != endItr ; ++itr )
			{
				GCDeleteInventoryItem gcDII;
				gcDII.setObjectID((*itr)->getObjectID());
				pPC->getPlayer()->sendPacket(&gcDII);
				(*itr)->destroy();
				SAFE_DELETE(*itr);
			}

			iList.clear();

			CGLotterySelect	cgLS;
			cgLS.setType(TYPE_FINISH_SCRATCH);
			cgLS.setQuestLevel(0);
			cgLS.setGiftID(0);
			CGLotterySelectHandler::execute(&cgLS, pPC->getPlayer());
//			cgLS.execute(pPC->getPlayer());

		}
		else
		{
			Player* pPlayer = pCreature2->getPlayer();
	//		pPlayer->sendPacket(&gcSM);

			GCNPCResponse gcNPCResponse;
			gcNPCResponse.setCode(NPC_RESPONSE_LOTTERY);
			gcNPCResponse.setParameter((uint)questLevel);

			pPlayer->sendPacket(&gcNPCResponse);

			filelog("EventQuest.log","ActionGiveLotto : %d to %s", questLevel, pPC->getName().c_str());
		}
	}

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

	__END_CATCH
}
开发者ID:hillwah,项目名称:darkeden,代码行数:92,代码来源:ActionGiveLotto.cpp

示例2: execute

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

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

	Creature* pCreature = pGP->getCreature();
	Assert(pCreature != NULL);
		
	PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pCreature);
	Assert(pPC != NULL);

	filelog("EventQuest.log", "CGLotterySelectHandler : got [%d:%d:%d] from %s", pPacket->getType(), pPacket->getGiftID(), pPacket->getQuestLevel(),
			pPC->getName().c_str());

	switch (pPacket->getType() )
	{
		case TYPE_SELECT_LOTTERY:
			{
				// 인벤에서 퀘스트 아이템 삭제
				QuestID_t qID;
				EventQuestAdvance::Status status = pPC->getQuestManager()->getEventQuestAdvanceManager()->getStatus(pPacket->getQuestLevel());
				int ownerQuestLevel = pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel();
				if (
					(ownerQuestLevel > pPacket->getQuestLevel() && status == EventQuestAdvance::EVENT_QUEST_ADVANCED ) ||	
					(pPacket->getQuestLevel() == 4 &&  ownerQuestLevel== -1 ) ||
					pPC->getQuestManager()->successEventQuest(pPacket->getQuestLevel(), qID ) )
				{
					pPC->getQuestManager()->getEventQuestAdvanceManager()->rewarded(pPacket->getQuestLevel());
					pPC->getQuestManager()->getEventQuestAdvanceManager()->save();
					pPC->getQuestManager()->questRewarded(qID);
					pPC->sendCurrentQuestInfo();

					list<Item*> iList;
					pPC->getInventory()->clearQuestItem(iList);

					list<Item*>::iterator itr = iList.begin();
					list<Item*>::iterator endItr = iList.end();

					for (; itr != endItr ; ++itr )
					{
						GCDeleteInventoryItem gcDII;
						gcDII.setObjectID((*itr)->getObjectID());
						pPC->getPlayer()->sendPacket(&gcDII);
						(*itr)->destroy();
						SAFE_DELETE(*itr);
					}

					iList.clear();
				}
				else
				{
					filelog("EventBug.txt", "CGLotterySelectHandler : 복권 선택이 날라왔는데 완료한 퀘스트가 없다. -_-; %s[%d:%d]",
							pPC->getName().c_str(), pPacket->getQuestLevel(), pPacket->getGiftID());

					return;
				}

				GCNoticeEvent gcNE;
				gcNE.setCode(NOTICE_EVENT_RESULT_LOTTERY);
				if (bWinPrize(pPacket->getGiftID(), pPacket->getQuestLevel() ) ) 
				{
					// PlayerCreature 에 정보를 저장한다
					pPC->setLotto(true);
					pPC->setLottoRewardID(pPacket->getGiftID());
					pPC->setLottoQuestLevel(pPacket->getQuestLevel());
					gcNE.setParameter((uint)1);
				}
				else
				{
					// PlayerCreature 에 정보를 저장한다
					pPC->setLotto(false);
					pPC->setLottoRewardID(pPacket->getGiftID());
					pPC->setLottoQuestLevel(pPacket->getQuestLevel());
					gcNE.setParameter((uint)0);
				}
				pGP->sendPacket(&gcNE);

				filelog("EventQuest.log", "CGLotterySelectHandler : %d to %s", gcNE.getParameter(), pPC->getName().c_str());
			}
			break;
		case TYPE_FINISH_SCRATCH:
			{
				// 당첨된 경우 디비에 저장
				if (pPC->isLotto() )
				{
					// 다시 false 로 만들어줘야함.
					// 아님 담번 퀘스트에서 무조건 당첨으로 처리되니 ;;
					pPC->setLotto(false);

					Statement* pStmt = NULL;

					BEGIN_DB
					{
						pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement();

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


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