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


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

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


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

示例1: execute

void CGFailQuestHandler::execute (CGFailQuest* pPacket , Player* pPlayer)
throw(Error)
{
    __BEGIN_TRY __BEGIN_DEBUG_EX

#ifdef __GAME_SERVER__

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

    PlayerCreature* pPC = dynamic_cast<PlayerCreature*>(pGP->getCreature());

    pPC->getQuestManager()->adjustQuestStatus();

    QuestMessage code;
    if (pPacket->isFail() )
        code = pPC->getQuestManager()->failQuest();
    else
        code = pPC->getQuestManager()->cancelQuest();

    if (code == CANCEL_SUCCESS )
    {
        pPC->sendCurrentQuestInfo();

        //cout << "Quest 시작 " << pPC->getName() << " " << pPacket->getQuestID() << endl;
    }
    else
    {
        //cout << "Quest 시작 실패 " << pPC->getName() << " " << (int)code << endl;
    }

#endif	// __GAME_SERVER__

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

示例2: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionGiveFinalLottoScript::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);

	GCNPCAsk gcNPCAsk;
	gcNPCAsk.setObjectID(pCreature1->getObjectID());
	gcNPCAsk.setNPCID(dynamic_cast<NPC*>(pCreature1)->getNPCID());

	QuestID_t	qID;

	if (pPC->getQuestManager()->successEventQuest(4, qID ) )
	{
		ItemType_t fitItem = rand()%10;

		if (pPC->getInventory()->findItem(Item::ITEM_CLASS_EVENT_ITEM, fitItem ) != NULL )
		{
			pPC->getQuestManager()->getEventQuestAdvanceManager()->advanced(EventQuestAdvanceManager::EVENT_QUEST_LEVEL_MAX-1);
			gcNPCAsk.setScriptID(m_SuccessScriptID);
		}
		else
		{
			gcNPCAsk.setScriptID(m_FailScriptID);
		}

		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
	{
		gcNPCAsk.setScriptID(m_CounterScriptID); 
	}

	pPC->getPlayer()->sendPacket(&gcNPCAsk);

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

示例3: execute

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

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

	GCNPCResponse gcNPCR;
	gcNPCR.setCode(NPC_RESPONSE_QUEST);

	Creature* pCreature = pPC->getZone()->getCreature(pPacket->getNPCObjectID());
	if (pCreature == NULL || !pCreature->isNPC() )
	{
		gcNPCR.setParameter((uint)START_FAIL_CANNOT_APPLY_QUEST);
		pPlayer->sendPacket(&gcNPCR);

		return;
	}

	NPC* pNPC = dynamic_cast<NPC*>(pCreature);
	if (pNPC == NULL )
	{
		gcNPCR.setParameter((uint)START_FAIL_CANNOT_APPLY_QUEST);
		pPlayer->sendPacket(&gcNPCR);

		return;
	}

	QuestInfoManager* pQIM = pNPC->getQuestInfoManager();
	if (pQIM == NULL )
	{
		gcNPCR.setParameter((uint)START_FAIL_CANNOT_APPLY_QUEST);
		pPlayer->sendPacket(&gcNPCR);

		return;
	}

	pPC->getQuestManager()->adjustQuestStatus();
	QuestMessage code = pQIM->startQuest(pPacket->getQuestID(), pPC);

	list<QuestID_t> qList;
	pQIM->getEventQuestIDs(pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel(), pPC, back_inserter(qList));

	gcNPCR.setParameter((uint)code);

	if (!pQIM->isEventQuest(pPacket->getQuestID() ) )
		pPlayer->sendPacket(&gcNPCR);

	if (code == START_SUCCESS )
	{
		pPC->sendCurrentQuestInfo();

		//cout << "Quest 시작 " << pPC->getName() << " " << pPacket->getQuestID() << endl;
	}
	else
	{
		//cout << "Quest 시작 실패 " << pPC->getName() << " " << (int)code << endl;
	}

#endif	// __GAME_SERVER__
		
	__END_DEBUG_EX __END_CATCH
}
开发者ID:jun199004,项目名称:server,代码行数:68,代码来源:CGSelectQuestHandler.cpp

示例4: execute

////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionRewardEventQuest::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);

    if (pPC->getQuestItem() != NULL )
    {
        TPOINT pt;

        Item* pItem = pPC->getQuestItem();
        if (pItem == NULL || !pPC->getInventory()->getEmptySlot(pItem, pt ) )
        {
            GCNPCResponse gcNPCResponse;
            gcNPCResponse.setCode(NPC_RESPONSE_QUEST);
            gcNPCResponse.setParameter(COMPLETE_FAIL_NO_INVENTORY_SPACE);
            pPC->getPlayer()->sendPacket(&gcNPCResponse);

            return;
        }

        if (pPC->getInventory()->addItem(pItem, pt ) )
        {
            pPC->setQuestItem(NULL);
            pPC->getZone()->registerObject(pItem);

            pItem->create(pPC->getName(), STORAGE_INVENTORY, 0, pt.x, pt.y);
            if (pItem->isUnique() || pItem->isTimeLimitItem() )
            {
                pPC->addTimeLimitItem(pItem, 604800);
                pPC->sendTimeLimitItemInfo();
            }

            GCCreateItem gcCreateItem;
            makeGCCreateItem(&gcCreateItem, pItem, pt.x, pt.y);
            pPC->getPlayer()->sendPacket(&gcCreateItem);

            GCNPCResponse gcNPCResponse;
            gcNPCResponse.setCode(NPC_RESPONSE_QUEST);
            gcNPCResponse.setParameter(COMPLETE_SUCCESS);
            pPC->getPlayer()->sendPacket(&gcNPCResponse);

            remainTraceLog(pItem, pCreature1->getName(), pCreature2->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
            return;
        }
        else
        {
            GCNPCResponse gcNPCResponse;
            gcNPCResponse.setCode(NPC_RESPONSE_QUEST);
            gcNPCResponse.setParameter(COMPLETE_FAIL_NO_INVENTORY_SPACE);
            pPC->getPlayer()->sendPacket(&gcNPCResponse);
            return;
        }

    }

    int questLevel = pPC->getQuestManager()->getEventQuestAdvanceManager()->getQuestLevel();
    ScriptID_t sID = m_ScriptID[ questLevel ];
    QuestID_t qID;

    if (!pPC->getQuestManager()->successEventQuest(questLevel, qID ) ) sID = m_CounterScriptID;
    if (pPC->getQuestManager()->getEventQuestAdvanceManager()->getStatus(questLevel) == EventQuestAdvance::EVENT_QUEST_INIT &&
            questLevel > 1 ) sID = m_CancelScriptID;

    GCNPCAsk gcNPCAsk;
    gcNPCAsk.setObjectID(pCreature1->getObjectID());
    gcNPCAsk.setScriptID(sID);
    gcNPCAsk.setNPCID(dynamic_cast<NPC*>(pCreature1)->getNPCID());

    Player* pPlayer = pCreature2->getPlayer();
    pPlayer->sendPacket(&gcNPCAsk);

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

示例5: 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

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