本文整理汇总了C++中PlayerCreature::addTimeLimitItem方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerCreature::addTimeLimitItem方法的具体用法?C++ PlayerCreature::addTimeLimitItem怎么用?C++ PlayerCreature::addTimeLimitItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerCreature
的用法示例。
在下文中一共展示了PlayerCreature::addTimeLimitItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例3: execute
//.........这里部分代码省略.........
if (isLairItem )
{
const MonsterInfo* pMonsterInfo = g_pMonsterInfoManager->getMonsterInfo(masterType);
TreasureList *pTreasureList = NULL;
if (pPC->isSlayer())
pTreasureList = pMonsterInfo->getSlayerTreasureList();
else if (pPC->isVampire() )
pTreasureList = pMonsterInfo->getVampireTreasureList();
else if (pPC->isOusters() )
pTreasureList = pMonsterInfo->getOustersTreasureList();
const list<Treasure*>& treasures = pTreasureList->getTreasures();
list<Treasure*>::const_iterator itr = treasures.begin();
ITEM_TEMPLATE it;
for(; itr != treasures.end(); itr++)
{
Treasure* pTreasure = (*itr);
it.ItemClass = Item::ITEM_CLASS_MAX;
it.ItemType = 0;
it.NextOptionRatio = 0;
//cout << "TradeLairItem: BonusRatio = " << it.NextOptionRatio << endl;
if (pTreasure->getRandomItem(&it) )
{
pItem = g_pItemFactoryManager->createItem(it.ItemClass, it.ItemType, it.OptionType);
Assert(pItem != NULL);
}
}
}
else
{
pItem = g_pItemFactoryManager->createItem(iClass, iType, oList);
}
GenderRestriction gender = GENDER_BOTH;
switch(pPC->getSex() )
{
case MALE:
gender = GENDER_MALE;
break;
case FEMALE:
gender = GENDER_FEMALE;
break;
default:
break;
}
setItemGender(pItem, gender);
_TPOINT tp;
if (pItem != NULL && pPC->getInventory()->addItem(pItem, tp ) )
{
pPC->getZone()->registerObject(pItem);
pItem->create(pPC->getName(), STORAGE_INVENTORY, 0, tp.x, tp.y);
if (isTimeLimit )
{
pPC->addTimeLimitItem(pItem, 604800);
pPC->sendTimeLimitItemInfo();
}
GCCreateItem gcCreateItem;
makeGCCreateItem(&gcCreateItem, pItem, tp.x, tp.y);
pPC->getPlayer()->sendPacket(&gcCreateItem);
remainTraceLog(pItem, "GOD", pCreature->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
}
else
{
if (isUnique )
pItem->setUnique();
if (isTimeLimit )
pItem->setTimeLimitItem();
pPC->setQuestItem(pItem);
remainTraceLog(pItem, "GOD", pCreature->getName(), ITEM_LOG_CREATE, DETAIL_EVENTNPC);
}
}
if (pPC->getLottoQuestLevel() == 4 )
{
pPC->getQuestManager()->cancelQuest();
GCNoticeEvent gcNE;
gcNE.setCode(NOTICE_EVENT_START_QUEST_ENDING);
pPC->getPlayer()->sendPacket(&gcNE);
}
}