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


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

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


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

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

示例2: 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);
				}
			}
开发者ID:jun199004,项目名称:server,代码行数:101,代码来源:CGLotterySelectHandler.cpp


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