本文整理汇总了C++中PlayerCreature::getQuestItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::getQuestItem方法的具体用法?C++ PlayerCreature::getQuestItem怎么用?C++ PlayerCreature::getQuestItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::getQuestItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
////////////////////////////////////////////////////////////////////////////////
// 액션을 실행한다.
////////////////////////////////////////////////////////////////////////////////
void ActionGiveQuestItem::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);
TPOINT pt;
Item* pItem = pPC->getQuestItem();
if (pItem == NULL || !pPC->getInventory()->getEmptySlot(pItem, pt ) )
{
GCNPCAsk gcNPCAsk;
gcNPCAsk.setObjectID(pCreature1->getObjectID());
gcNPCAsk.setScriptID(m_CounterScriptID);
gcNPCAsk.setNPCID(dynamic_cast<NPC*>(pCreature1)->getNPCID());
pPC->getPlayer()->sendPacket(&gcNPCAsk);
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, 43200);
}
GCCreateItem gcCreateItem;
makeGCCreateItem(&gcCreateItem, pItem, pt.x, pt.y);
pPC->getPlayer()->sendPacket(&gcCreateItem);
}
__END_CATCH
}
示例2: 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
}