本文整理汇总了C++中PlayerObject::getPlacedInstrumentId方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::getPlacedInstrumentId方法的具体用法?C++ PlayerObject::getPlacedInstrumentId怎么用?C++ PlayerObject::getPlacedInstrumentId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::getPlacedInstrumentId方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _handleDestroyInstrument
void ObjectController::_handleDestroyInstrument(Item* item)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(mObject);
Item* tempInstrument = NULL;
Item* permanentInstrument = NULL;
// first, stop playing, if its currently in use
if(playerObject->getPerformingState() == PlayerPerformance_Music)
{
// equipped instrument
if(item == dynamic_cast<Item*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Instrument))
|| playerObject->getPlacedInstrumentId())
{
gEntertainerManager->stopEntertaining(playerObject);
}
}
// handle destruction of instanced instruments, placed in world
if(playerObject->getPlacedInstrumentId())
{
// get the instruments
tempInstrument = dynamic_cast<Item*>(gWorldManager->getObjectById(playerObject->getPlacedInstrumentId()));
if(!tempInstrument)
{
gLogger->logMsg("ObjectController::handleDestroyInstrument : no temporary Instrument\n");
return;
}
permanentInstrument = dynamic_cast<Item*>(gWorldManager->getObjectById(tempInstrument->getPersistantCopy()));
if(!permanentInstrument)
{
gLogger->logMsg("ObjectController::handleDestroyInstrument : no parent Instrument\n");
return;
}
// the temporary gets ALWAYS deleted
// update the attributes of the permanent Instrument
if(tempInstrument == item)
{
permanentInstrument->setPlaced(false);
permanentInstrument->setNonPersistantCopy(0);
playerObject->setPlacedInstrumentId(0);
}
// it is the permanent Instrument delete the temporary copy too
else if(permanentInstrument == item)
{
destroyObject(tempInstrument->getId());
}
}
}
示例2: _handleDestroyInstrument
void ObjectController::_handleDestroyInstrument(Item* item)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(mObject);
Item* tempInstrument = NULL;
Item* permanentInstrument = NULL;
auto equip_service = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::equipment::EquipmentService>("EquipmentService");
auto held_item = dynamic_cast<Item*>(equip_service->GetEquippedObject(playerObject, "hold_r"));
// first, stop playing, if its currently in use
if(playerObject->GetCreature()->getPerformingState() == PlayerPerformance_Music)
{
// equipped instrument
if(item == held_item || playerObject->getPlacedInstrumentId())
{
gEntertainerManager->stopEntertaining(playerObject);
}
}
// handle destruction of instanced instruments, placed in world
if(playerObject->getPlacedInstrumentId())
{
// get the instruments
tempInstrument = dynamic_cast<Item*>(gWorldManager->getObjectById(playerObject->getPlacedInstrumentId()));
if(!tempInstrument)
{
return;
}
permanentInstrument = dynamic_cast<Item*>(gWorldManager->getObjectById(tempInstrument->getPersistantCopy()));
if(!permanentInstrument)
{
return;
}
// the temporary gets ALWAYS deleted
// update the attributes of the permanent Instrument
if(tempInstrument == item)
{
permanentInstrument->setPlaced(false);
permanentInstrument->setNonPersistantCopy(0);
playerObject->setPlacedInstrumentId(0);
}
// it is the permanent Instrument delete the temporary copy too
else if(permanentInstrument == item)
{
destroyObject(tempInstrument->getId());
}
}
}
示例3: _handleTransferItemMisc
//.........这里部分代码省略.........
if(!checkTargetContainer(targetContainerId,itemObject))
{
DLOG(info) << "ObjController::_handleTransferItemMisc:TargetContainer is not valid :(";
return;
}
if(!checkContainingContainer(tangible->getParentId(), playerObject->getId()))
{
DLOG(info) << "ObjController::_handleTransferItemMisc:ContainingContainer is not allowing the transfer :(";
return;
}
// Remove the object from whatever contains it.
if(!removeFromContainer(targetContainerId, targetId))
{
DLOG(info) << "ObjectController::_handleTransferItemMisc: removeFromContainer failed :( this might be caused by looting a corpse though";
return;
}
//we need to destroy the old radial ... our item now gets a new one
//delete(itemObject->getRadialMenu());
itemObject->ResetRadialMenu();
itemObject->setParentId(targetContainerId);
//Now update the registered watchers!!
gContainerManager->updateObjectPlayerRegistrations(newContainer, oldContainer, tangible, linkType);
//now go and move it to wherever it belongs
cell = dynamic_cast<CellObject*>(newContainer);
if (cell)
{
// drop in a cell
//special case temp instrument
if (item&&item->getItemFamily() == ItemFamily_Instrument)
{
if (playerObject->getPlacedInstrumentId())
{
// We do have a placed instrument.
uint32 instrumentType = item->getItemType();
if ((instrumentType == ItemType_Nalargon) || (instrumentType == ItemType_omni_box) || (instrumentType == ItemType_nalargon_max_reebo))
{
// We are about to drop the real thing, remove any copied instrument.
// item->setOwner(playerObject->getId();
playerObject->getController()->destroyObject(playerObject->getPlacedInstrumentId());
}
}
}
itemObject->mPosition = playerObject->mPosition;
//do the db update manually because of the position - unless we get an automated position save in
itemObject->setParentId(targetContainerId);
ResourceContainer* rc = dynamic_cast<ResourceContainer*>(itemObject);
if(rc)
mDatabase->executeSqlAsync(0,0,"UPDATE %s.resource_containers SET parent_id ='%I64u', oX='%f', oY='%f', oZ='%f', oW='%f', x='%f', y='%f', z='%f' WHERE id='%I64u'",mDatabase->galaxy(),itemObject->getParentId(), itemObject->mDirection.x, itemObject->mDirection.y, itemObject->mDirection.z, itemObject->mDirection.w, itemObject->mPosition.x, itemObject->mPosition.y, itemObject->mPosition.z, itemObject->getId());
else
mDatabase->executeSqlAsync(0,0,"UPDATE %s.items SET parent_id ='%I64u', oX='%f', oY='%f', oZ='%f', oW='%f', x='%f', y='%f', z='%f' WHERE id='%I64u'",mDatabase->galaxy(),itemObject->getParentId(), itemObject->mDirection.x, itemObject->mDirection.y, itemObject->mDirection.z, itemObject->mDirection.w, itemObject->mPosition.x, itemObject->mPosition.y, itemObject->mPosition.z, itemObject->getId());
cell->addObjectSecure(itemObject);
gMessageLib->sendDataTransformWithParent053(itemObject);
itemObject->updateWorldPosition();
return;
}
PlayerObject* player = dynamic_cast<PlayerObject*>(newContainer);
if(player)
{
//equip / unequip handles the db side, too
if(!player->getEquipManager()->EquipItem(item))
{
LOG(warning) << "ObjectController::_handleTransferItemMisc: Error equipping " << item->getId();
//panik!!!!!!
}
itemObject->setParentIdIncDB(newContainer->getId());
return;
}
//*****************************************************************
//All special cases have been handled - now its just our generic ObjectContainer Type
//some other container ... hopper backpack chest inventory etc
if(newContainer)
{
newContainer->addObjectSecure(itemObject);
itemObject->setParentIdIncDB(newContainer->getId());
return;
}
}
示例4: prepareCustomRadialMenu
void Instrument::prepareCustomRadialMenu(CreatureObject* player, uint8 itemCount)
{
// NOTE: player is also of type CreatureObject* !!!
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(player);
mRadialMenu.reset();
mRadialMenu = RadialMenuPtr(new RadialMenu());
// RadialMenu* radial = new RadialMenu();
//string mInstrumentString = instrument->getName();
uint32 instrumentNr = this->getItemType();
if ((instrumentNr == ItemType_Nalargon) || (instrumentNr == ItemType_omni_box) || (instrumentNr == ItemType_nalargon_max_reebo))
{
uint32 radId = 1;
// We have to know if this is the real one or the copy.
if (playerObject->getPlacedInstrumentId() == this->getId())
{
// We are handling the copy
if ((playerObject->getId() == this->getOwner()) && this->getPlaced())
{
if ((playerObject->GetCreature()->getPerformingState() == PlayerPerformance_Music))
{
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback, "@radial_performance:stop_playing");
}
else
{
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback, "@radial_performance:play_instrument");
}
}
else
{
// radial->addItem(radId++,0,radId_examine,radAction_Default);
// radial->addItem(radId++,0,radId_itemPickup,radAction_Default);
return;
}
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default);
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemPickup,radAction_Default);
}
else
{
// We may be handling the original instrument.
auto equip_service = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::equipment::EquipmentService>("EquipmentService");
auto inventory = dynamic_cast<Inventory*>(equip_service->GetEquippedObject(playerObject->GetCreature(), "inventory"));
if (inventory) {
if (inventory->getId() == this->getParentId())
{
// We have our real instrument in the inventory.
// We can't drop if outside in the world.
if (player->getParentId() == 0)
{
// Outside
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default);
mRadialMenu->addItem(static_cast<uint8>(radId),0,radId_itemDestroy, radAction_Default);
}
else
{
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default);
mRadialMenu->addItem(static_cast<uint8>(radId),0,radId_itemDrop,radAction_Default);
mRadialMenu->addItem(static_cast<uint8>(radId),0,radId_itemDestroy, radAction_Default);
}
if (playerObject->getPlacedInstrumentId() == 0)
{
// We do not have any other placed intrument out.
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback,"Use");
}
}
else if (dynamic_cast<CellObject*>(gWorldManager->getObjectById(this->getParentId())))
{
// It's either a original instrument, or someone else instrument, copy or original.
// Time for some dirty... the original instrument does not have an owner.
// Let's take advantage of that shortcoming.
// Is this my instrument?
if (this->getOwner() == player->getId())
{
// Yes, are we handling the original instrument.
// if (cell->getId() == this->getParentId())
{
if ((playerObject->GetCreature()->getPerformingState() == PlayerPerformance_Music))
{
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback, "@radial_performance:stop_playing");
}
else
{
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemUse,radAction_ObjCallback, "@radial_performance:play_instrument");
}
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_examine,radAction_Default);
mRadialMenu->addItem(static_cast<uint8>(radId++),0,radId_itemPickup,radAction_Default);
}
}
else
//.........这里部分代码省略.........
示例5: handleDataTransform
//.........这里部分代码省略.........
}
}
}
else
{
// we should never get here !
gLogger->logMsg("ObjController::DataTransform: could not find zone region in map");
gLogger->logMsg("ObjController:: probably a bot : %I64u",static_cast<int>(player->getId()));
// hammertime !
// muglies botter sometimes sends us weird positions with X or Y far out of possible regions
// however other 3rd party tools might do the same
// we need to get rid of the client at this point nad probably should ban the player / add him to
// a monitoring list when the coordinates were indeed out of bounds
gWorldManager->addDisconnectedPlayer(player);
return;
}
}
player->mDirection = dir;
player->setCurrentSpeed(speed);
//If our player is mounted lets update his mount aswell
if(player->checkIfMounted() && player->getMount())
{
player->getMount()->mDirection = dir;
player->getMount()->setCurrentSpeed(speed);
}
// destroy the instanced instrument if out of range
if (player->getPlacedInstrumentId())
{
if (!gWorldManager->objectsInRange(player->getId(), player->getPlacedInstrumentId(), 5.0))
{
if (Item* item = dynamic_cast<Item*>(gWorldManager->getObjectById(player->getPlacedInstrumentId())))
{
destroyObject(item->getId());
}
}
}
// Terminate active conversation with npc if to far away (trainers only so far).
ActiveConversation* ac = gConversationManager->getActiveConversation(player->getId());
if (ac != NULL)
{
// We do have a npc conversation going.
if (!gWorldManager->objectsInRange(player->getId(), (ac->getNpc())->getId(), 11.0))
{
// Terminate conversation, since we are out of range.
gMessageLib->sendSystemMessage(player,L"","system_msg","out_of_range");
gConversationManager->stopConversation(player, true); // We will get the current dialog text in a chat bubble, only seen by me. Impressive :)
}
}
if (updateAll)
{
// Update our world.
playerWorldUpdate(true);
// Speed up the timed update, if any pending.
gWorldManager->addPlayerMovementUpdateTime(player, 250);
}
else
{
if (!gWorldConfig->isInstance())
{
//If player is mounted... move his mount too!
if(player->checkIfMounted() && player->getMount())
{
//gMessageLib->sendDataTransform(player->getMount());
gMessageLib->sendUpdateTransformMessage(player->getMount());
}
else
{
// send out position updates to known players
// please note that these updates mess up our dance performance
if(player->getPerformingState() == PlayerPerformance_None)
{
gMessageLib->sendUpdateTransformMessage(player);
}
}
}
else
{
// send out position updates to known players in group or self only
gMessageLib->sendUpdateTransformMessage(player, player);
}
}
//uint64 localTimeEnd = Anh_Utils::Clock::getSingleton()->getLocalTime();
//gLogger->logMsgF("Exec time PRId32",MSG_NORMAL, localTimeEnd - localTimeStart);
}
示例6: handleDataTransformWithParent
//.........这里部分代码省略.........
if(QTRegion* region = gWorldManager->getQTRegion(player->getSubZoneId()))
{
player->setSubZoneId(0);
region->mTree->removeObject(player);
//If our player is mounted lets update his mount aswell
if(player->checkIfMounted() && player->getMount())
{
player->getMount()->setSubZoneId(0);
region->mTree->removeObject(player->getMount());
//Can't ride into a building with a mount! :-p
//However, its easy to do so we have handling incase the client is tricked.
// the vehicle is the INTANGIBLE Datapad Controller
// the *vehicle* itself is the BODY
if(Vehicle* datapad_pet = dynamic_cast<Vehicle*>(gWorldManager->getObjectById(player->getMount()->getPetController())))
{
datapad_pet->dismountPlayer();
datapad_pet->store();
}
}
}
}
}
// put us into new one
gMessageLib->broadcastContainmentMessage(player->getId(),parentId,4,player);
if((cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(parentId))))
{
cell->addObjectSecure(player);
// Inform tutorial about cell change.
if (gWorldConfig->isTutorial())
{
player->getTutorial()->setCellId(parentId);
// gLogger->logMsgF("handleDataTransformWithParent: Adding %"PRIu64" to cell(%"PRIu64")",MSG_NORMAL,player->getId(),parentId);
}
}
else
{
gLogger->logMsgF("Error adding %"PRIu64" to cell(%"PRIu64")",MSG_NORMAL,player->getId(),parentId);
}
}
// update the player
player->setParentId(parentId);
player->mDirection = dir;
player->mPosition = pos;
player->setCurrentSpeed(speed);
// destroy the instanced instrument if out of range
if (player->getPlacedInstrumentId())
{
if (!gWorldManager->objectsInRange(player->getId(), player->getPlacedInstrumentId(), 5.0))
{
if (Item* item = dynamic_cast<Item*>(gWorldManager->getObjectById(player->getPlacedInstrumentId())))
{
destroyObject(item->getId());
}
}
}
// Terminate active conversation with npc if to far away (trainers only so far).
ActiveConversation* ac = gConversationManager->getActiveConversation(player->getId());
if (ac != NULL)
{
// We do have a npc conversation going.
if (!gWorldManager->objectsInRange(player->getId(), (ac->getNpc())->getId(), 11.0))
{
// Terminate conversation, since we are out of range.
gMessageLib->sendSystemMessage(player,L"","system_msg","out_of_range");
gConversationManager->stopConversation(player, true); // We will get the current dialog text in a chat bubble, only seen by me. Impressive :)
}
}
if (updateAll)
{
// Update our world.
playerWorldUpdate(true);
// Speed up the timed update, if any pending.
gWorldManager->addPlayerMovementUpdateTime(player, 250);
}
else
{
if (!gWorldConfig->isInstance())
{
// send out updates
gMessageLib->sendUpdateTransformMessageWithParent(player);
}
else
{
// send out position updates to known players in group or self only
gMessageLib->sendUpdateTransformMessageWithParent(player, player);
}
}
}
}
示例7: handleDataTransform
//.........这里部分代码省略.........
// put into new
player->setSubZoneId((uint32)newRegion->getId());
player->setSubZone(newRegion);
newRegion->mTree->addObject(player);
//If our player is mounted lets update his mount aswell
if(player->checkIfMounted() && player->getMount())
{
player->getMount()->setSubZoneId((uint32)newRegion->getId());
newRegion->mTree->addObject(player->getMount());
}
}
else
{
// we should never get here !
DLOG(INFO) << "ObjController::handleDataTransform: could not find zone region in map";
DLOG(INFO) << "ObjController:: probably a bot : " << player->getId();
// hammertime !
// muglies botter sometimes sends us weird positions with X or Y far out of possible regions
// however other 3rd party tools might do the same
// we need to get rid of the client at this point nad probably should ban the player / add him to
// a monitoring list when the coordinates were indeed out of bounds
gWorldManager->addDisconnectedPlayer(player);
return;
}
}
player->mDirection = dir;
player->setCurrentSpeed(speed);
// destroy the instanced instrument if out of range
if (player->getPlacedInstrumentId())
{
if (!gWorldManager->objectsInRange(player->getId(), player->getPlacedInstrumentId(), 5.0))
{
if (Item* item = dynamic_cast<Item*>(gWorldManager->getObjectById(player->getPlacedInstrumentId())))
{
destroyObject(item->getId());
}
}
}
// Terminate active conversation with npc if to far away (trainers only so far).
ActiveConversation* ac = gConversationManager->getActiveConversation(player->getId());
if (ac != NULL)
{
// We do have a npc conversation going.
if (!gWorldManager->objectsInRange(player->getId(), (ac->getNpc())->getId(), 11.0))
{
// Terminate conversation, since we are out of range.
gMessageLib->SendSystemMessage(::common::OutOfBand("system_msg", "out_of_range"), player);
gConversationManager->stopConversation(player, true); // We will get the current dialog text in a chat bubble, only seen by me. Impressive :)
}
}
if (updateAll)
{
// Update our world.
playerWorldUpdate(true);
// Speed up the timed update, if any pending.
gWorldManager->addPlayerMovementUpdateTime(player, 250);
}
else