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


C++ CreatureObject::getEquipManager方法代码示例

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


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

示例1: validate

bool EVWeapon::validate(uint32 &reply1, uint32 &reply2, uint64 targetId, uint32 opcode, ObjectControllerCmdProperties*& cmdProperties)
{
    CreatureObject* creature = dynamic_cast<CreatureObject*>(mController->getObject());

    // check our equipped weapon
    uint32	weaponGroup = WeaponGroup_Unarmed;

    if(Item* weapon = dynamic_cast<Item*>(creature->getEquipManager()->getEquippedObject(CreatureEquipSlot_Hold_Left)))
    {
        // could be an instrument
        if(weapon->getItemFamily() == ItemFamily_Weapon)
        {
            weaponGroup = dynamic_cast<Weapon*>(weapon)->getGroup();
        }
    }

    if(cmdProperties->mRequiredWeaponGroup && (weaponGroup & cmdProperties->mRequiredWeaponGroup) != weaponGroup)
    {
        reply1 = 0;
        reply2 = 1;

        if(PlayerObject* player = dynamic_cast<PlayerObject*>(creature))
        {
            gMessageLib->SendSystemMessage(::common::OutOfBand("cbt_spam", "no_attack_wrong_weapon"), player);
        }

        return(false);
    }

    return(true);
}
开发者ID:ANHcRush,项目名称:mmoserver,代码行数:31,代码来源:EVWeapon.cpp

示例2: prepareCustomRadialMenu

void Food::prepareCustomRadialMenu(CreatureObject* creatureObject, uint8 itemCount)
{
    RadialMenu* radial	= new RadialMenu();

    CreatureObject* unknownCreature;
    Inventory* creatureInventory;
    if (this->getParentId() &&
            (unknownCreature = dynamic_cast<CreatureObject*>(gWorldManager->getObjectById(this->getParentId() - 1))) &&
            (creatureInventory = dynamic_cast<Inventory*>(unknownCreature->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory))) &&
            (creatureInventory->getId() == this->getParentId()))
    {
        // Its an object in an inventory

        NPCObject* npcObject = dynamic_cast<NPCObject*>(unknownCreature);
        if (npcObject)
        {
            if ((npcObject->getNpcFamily() == NpcFamily_AttackableCreatures) && npcObject->isDead())
            {
                // I'm pretty sure we are a loot item.
                radial->addItem(1,0,radId_itemPickup,radAction_ObjCallback,"@ui_radial:loot");
                radial->addItem(2,0,radId_examine,radAction_Default);
                mRadialMenu = RadialMenuPtr(radial);
                return;
            }
        }
    }

    // Note: If we are to never use the default "Eat", THEN remove the isTutorial()-condition test.
    if (gWorldConfig->isTutorial())
    {
        // Tutorial clearly states that we shall use the "Use"-option.
        radial->addItem(1,0,radId_itemUse,radAction_ObjCallback,"Use");
    }
    else
    {
        radial->addItem(1,0,radId_itemUse,radAction_ObjCallback,"");		// Default.
    }
    radial->addItem(2,0,radId_examine,radAction_ObjCallback,"");
    radial->addItem(3,0,radId_itemDestroy,radAction_ObjCallback,"");
    mRadialMenu = RadialMenuPtr(radial);


}
开发者ID:Gargash,项目名称:Unofficial_Hope,代码行数:43,代码来源:Food.cpp

示例3: itemPopulateInventory

// TODO: Fix this
void ScriptSupport::itemPopulateInventory(uint64 itemId, uint64 npcId, uint64 playerId)
{
    // NOTE: For now we only check and validates TangibleObject.

    CreatureObject* creature = dynamic_cast<CreatureObject*>(gWorldManager->getObjectById(npcId));
    Object* itemObject = gWorldManager->getObjectById(itemId);

    PlayerObject* playerObject = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(playerId));

    if (creature && itemObject && playerObject)
    {
        Inventory* inventory = dynamic_cast<Inventory*>(creature->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory));
        if (inventory)
        {
            //  and (tutorial:getRoom() < 7)
            inventory->addObjectSecure(itemObject);
            itemObject->setParentId(npcId+1);
        }
    }
}
开发者ID:Gargash,项目名称:Unofficial_Hope,代码行数:21,代码来源:ScriptSupport.cpp

示例4: removeFromContainer

bool ObjectController::removeFromContainer(uint64 targetContainerId, uint64 targetId)
{
	PlayerObject*	playerObject	=	dynamic_cast<PlayerObject*>(mObject);
	Object*			itemObject		=	gWorldManager->getObjectById(targetId);
	Inventory*		inventory		=	dynamic_cast<Inventory*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory));
	TangibleObject* targetContainer = dynamic_cast<TangibleObject*>(gWorldManager->getObjectById(targetContainerId));

	TangibleObject* tangible = dynamic_cast<TangibleObject*>(itemObject);

	Item* item = dynamic_cast<Item*>(itemObject);

	// its us
	if (tangible->getParentId() == playerObject->getId())
	{
		// unequip it
		return playerObject->getEquipManager()->unEquipItem(itemObject);
		
	}
	
	//the containerObject is the container used in the tutorial or some random dungeon container
	Container* container = dynamic_cast<Container*>(gWorldManager->getObjectById(tangible->getParentId()));
	if (container)
	{
		container->removeObject(itemObject);
		//gContainerManager->destroyObjectToRegisteredPlayers(container, tangible->getId());
		if (gWorldConfig->isTutorial())
		{
			playerObject->getTutorial()->transferedItemFromContainer(targetId, tangible->getParentId());

			// If object is owned by player (private owned for instancing), we remove the owner from the object.
			// what is this used for ???
			if (itemObject->getPrivateOwner() == playerObject->getId())
			{
				itemObject->setPrivateOwner(0);
			}
		}
		return true;
	}

	//creature inventories are a special case - their items are temporary!!! we cannot loot them directly
	CreatureObject* unknownCreature;
	Inventory*		creatureInventory;


	if (itemObject->getParentId() &&
		(unknownCreature = dynamic_cast<CreatureObject*>(gWorldManager->getObjectById(itemObject->getParentId() - INVENTORY_OFFSET))) &&
		(creatureInventory = dynamic_cast<Inventory*>(unknownCreature->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory))) &&
		(creatureInventory->getId() == itemObject->getParentId()) && (creatureInventory->getId() != inventory->getId()))
	{
		
		if(!creatureInventory->removeObject(itemObject))
		{
			LOG(warning) << "ObjectController::removeFromContainer: Internal Error could not remove  " <<  itemObject->getId() << " from creature inventory "  << creatureInventory->getId();
			return false;
		}


		// we destroy the item in this case as its a temporary!! 
		// we do not want to clog the db with unlooted items
		gContainerManager->destroyObjectToRegisteredPlayers(creatureInventory, tangible->getId());

		ObjectIDList* invObjList = creatureInventory->getObjects();
		if (invObjList->size() == 0)
		{
			// Put this creature in the pool of delayed destruction and remove the corpse from scene.
			gWorldManager->addCreatureObjectForTimedDeletion(creatureInventory->getParentId(), LootedCorpseTimeout);
		}
		
		if (gWorldConfig->isTutorial())
		{
			// TODO: Update tutorial about the loot.
			playerObject->getTutorial()->transferedItemFromContainer(targetId, creatureInventory->getId());
		}

		//bail out here and request the item over the db - as the item in the NPC has a temporary id and we dont want that in the db
		// This ensure that we do not use/store any of the temp id's in the database.
        gObjectFactory->requestNewDefaultItem(inventory, item->getItemFamily(), item->getItemType(), inventory->getId(), 99, glm::vec3(), "");
		return false;

	}		   

	//cells are NOT tangibles - thei are static Objects
	CellObject* cell;
	if(cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(itemObject->getParentId())))
	{
		// Stop playing if we pick up the (permanently placed) instrument we are playing
		if (item && (item->getItemFamily() == ItemFamily_Instrument))
		{
			uint32 instrumentType = item->getItemType();
			if ((instrumentType == ItemType_Nalargon) || (instrumentType == ItemType_omni_box) || (instrumentType == ItemType_nalargon_max_reebo))
			{
				// It's a placeable original instrument.
				// Are we targeting the instrument we actually play on?
				if (playerObject->getActiveInstrumentId() == item->getId())
				{
					gEntertainerManager->stopEntertaining(playerObject);
				}
			}
		}
		
//.........这里部分代码省略.........
开发者ID:schizix,项目名称:mmoserver,代码行数:101,代码来源:OCCommonHandlers.cpp


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