本文整理汇总了C++中PlayerObject::getPerformingState方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::getPerformingState方法的具体用法?C++ PlayerObject::getPerformingState怎么用?C++ PlayerObject::getPerformingState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::getPerformingState方法的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: 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->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.
Inventory* inventory = dynamic_cast<Inventory*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_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->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
{
//.........这里部分代码省略.........
示例3: handleRequestSurvey
bool ArtisanManager::handleRequestSurvey(Object* playerObject,Object* target,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(playerObject);
std::shared_ptr<SimpleEvent> start_survey_event = nullptr;
if(cmdProperties)
mSurveyMindCost = cmdProperties->mMindCost;
// don't allow survey in buildings
if(player->getParentId())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "survey_in_structure"), player);
return false;
}
if(player->getPerformingState() != PlayerPerformance_None)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "wrong_state"), player);
return false;
}
if(player->getSurveyState())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "survey_cant"), player);
return false;
}
if(player->getSamplingState())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "survey_sample"), player);
return false;
}
SurveyTool* tool = dynamic_cast<SurveyTool*>(target);
CurrentResource* resource = NULL;
BString resourceName;
message->getStringUnicode16(resourceName);
resourceName.convert(BSTRType_ANSI);
resource = reinterpret_cast<CurrentResource*>(gResourceManager->getResourceByNameCRC(resourceName.getCrc()));
if(tool && resource)
{
player->setSurveyState(true);
// play effect
std::string effect = gWorldManager->getClientEffect(tool->getInternalAttribute<uint32>("survey_effect"));
gMessageLib->sendPlayClientEffectLocMessage(effect,player->mPosition,player);
PlayerObjectSet* playerList = player->getKnownPlayers();
PlayerObjectSet::iterator it = playerList->begin();
while(it != playerList->end())
{
gMessageLib->sendPlayClientEffectLocMessage(effect,player->mPosition,(*it));
++it;
}
uint32 mindCost = mSurveyMindCost;
Ham* hamz = player->getHam();
//are we able to sample in the first place ??
if(!hamz->checkMainPools(0,0,mindCost))
{
int32 myMind = hamz->mAction.getCurrentHitPoints();
//return message for sampling cancel based on HAM
if(myMind < (int32)mindCost)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "sample_mind"), player);
}
//message for stop sampling
gMessageLib->SendSystemMessage(::common::OutOfBand("survey", "sample_cancel"), player);
player->getSampleData()->mPendingSurvey = false;
hamz->updateRegenRates();
player->updateMovementProperties();
return false;
}
hamz->performSpecialAction(0,0,(float)mindCost,HamProperty_CurrentHitpoints);
// send system message
resourceName.convert(BSTRType_Unicode16);
gMessageLib->SendSystemMessage(::common::OutOfBand("survey", "start_survey", L"", L"", resourceName.getUnicode16()), player);
// schedule execution
start_survey_event = std::make_shared<SimpleEvent>(EventType("start_survey"),0, 5000,
std::bind(&ArtisanManager::surveyEvent, this, player, resource, tool));
}
else
{
gMessageLib->SendSystemMessage(::common::OutOfBand("ui","survey_nothingfound"));
return false;
}
// notify any listeners
if (start_survey_event)
gEventDispatcher.Notify(start_survey_event);
return true;
}
示例4: handleRequestCoreSample
bool ArtisanManager::handleRequestCoreSample(Object* player,Object* target, Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(player);
if(cmdProperties)
// unfortunately it's not in this opcode
// hardcode for now
//mSampleActionCost = cmdProperties->mActionCost;
mSampleActionCost = 150;
if(playerObject->getPerformingState() != PlayerPerformance_None || playerObject->checkIfMounted() || playerObject->isDead())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "wrong_state"), playerObject);
return false;
}
// can't sample while surveying
if(playerObject->getSurveyState())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("survey", "sample_survey"), playerObject);
return false;
}
// don't allow sampling in buildings
if(playerObject->getParentId())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "survey_in_structure"), playerObject);
return false;
}
uint64 localTime = Anh_Utils::Clock::getSingleton()->getLocalTime();
// don't allow more than one sample at a time
if(playerObject->getSamplingState())
{
playerObject->getSampleData()->mPendingSample = false;
playerObject->setNextSampleTime(localTime + 18000);
gMessageLib->SendSystemMessage(::common::OutOfBand("survey", "tool_recharge_time", 0, 0, 0, (int32)(playerObject->getNextSampleTime() - localTime) / 1000), playerObject);
return false;
}
if(!playerObject->getNextSampleTime() || (int32)(playerObject->getNextSampleTime() - localTime) <= 0)
{
playerObject->getSampleData()->mPendingSample = false;
playerObject->setNextSampleTime(localTime + 18000);
}
else
{
gMessageLib->SendSystemMessage(::common::OutOfBand("survey", "tool_recharge_time", 0, 0, 0, (int32)(playerObject->getNextSampleTime() - localTime) / 1000), playerObject);
return false;
}
SurveyTool* tool = dynamic_cast<SurveyTool*>(target);
CurrentResource* resource = NULL;
BString resourceName;
message->getStringUnicode16(resourceName);
resourceName.convert(BSTRType_ANSI);
resource = reinterpret_cast<CurrentResource*>(gResourceManager->getResourceByNameCRC(resourceName.getCrc()));
if(resource == NULL || tool == NULL)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("ui","survey_noresource"), playerObject);
return false;
}
if((resource->getType()->getCategoryId() == 903)||(resource->getType()->getCategoryId() == 904))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("survey", "must_have_harvester"), playerObject);
return false;
}
playerObject->setSamplingState(true);
ArtisanHeightmapAsyncContainer* container = new ArtisanHeightmapAsyncContainer(this, HeightmapCallback_ArtisanSurvey);
container->addToBatch(playerObject->mPosition.x,playerObject->mPosition.z);
container->playerObject = playerObject;
container->resource = resource;
container->resourceName = resourceName;
container->tool = tool;
gHeightmap->addNewHeightMapJob(container);
return true;
}
示例5: handleDataTransform
void ObjectController::handleDataTransform(Message* message,bool inRangeUpdate)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if (!player)
{
gLogger->logMsgF("ObjectController::handleDataTransform Object is NOT A PLAYER, id = %"PRIu64"", MSG_HIGH, mObject->getId());
return;
}
glm::vec3 pos;
glm::quat dir;
uint32 inMoveCount;
uint32 tickCount;
float speed;
bool updateAll = false;
// get tick and move counters
tickCount = message->getUint32();
inMoveCount = message->getUint32();
// gLogger->logMsg("ObjectController::handleDataTransform");
//uint64 localTimeStart = Anh_Utils::Clock::getSingleton()->getLocalTime();
// only process if its in sequence
if(player->getInMoveCount() >= inMoveCount)
{
return;
}
//uint32 ticks = tickCount - player->getClientTickCount();
// update tick and move counters...
player->setLastMoveTick(tickCount);
player->setClientTickCount(tickCount);
player->setInMoveCount(inMoveCount);
if(player->checkIfMounted() && player->getMount())
{
//Player is mounted lets update his mount too
player->getMount()->setLastMoveTick(tickCount);
//player->getMount()->setInMoveCount((inMoveCount+1));
player->getMount()->setInMoveCount((inMoveCount)); // + 1 or nor does not matter, as long as we update inMoveCount.
}
// get new direction, position and speed
dir.x = message->getFloat();
dir.y = message->getFloat();
dir.z = message->getFloat();
dir.w = message->getFloat();
pos.x = message->getFloat();
pos.y = message->getFloat();
pos.z = message->getFloat();
speed = message->getFloat();
// gLogger->logMsgF("Position outside = %.2f, %.2f, %.2f",MSG_NORMAL, pos.x, pos.y, pos.z);
/*
if (Heightmap::isHeightmapCacheAvaliable())
{
gLogger->logMsgF("Heightmap value = %.2f",MSG_NORMAL, Heightmap::Instance()->getCachedHeightAt2DPosition(pos.x, pos.z));
}
*/
// gLogger->logMsgF("Direction = %f, %f, %f, %f",MSG_NORMAL, dir.x, dir.y, dir.z, dir.w);
// stop entertaining, if we were
// important is, that if we move we change our posture to NOT skill animating anymore!
// so only stop entertaining when we are performing and NOT skillanimationg
if(player->getPerformingState() != PlayerPerformance_None && player->getPosture() != CreaturePosture_SkillAnimating)
{
gEntertainerManager->stopEntertaining(player);
}
// if we just left a building
if(player->getParentId() != 0)
{
updateAll = true;
// Testing with 4 for add and 0 for remove.
// Remove us from previous cell.
gMessageLib->broadcastContainmentMessage(player->getId(),player->getParentId(),0,player);
// remove us from the last cell we were in
if(CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(player->getParentId())))
{
cell->removeObject(player);
}
else
{
gLogger->logMsgF("Error removing %"PRIu64" from cell(%"PRIu64")",MSG_HIGH,player->getId(),player->getParentId());
}
// we are outside again
player->setParentId(0);
player->mPosition = pos;
// Add us to the world.
gMessageLib->broadcastContainmentMessage(player->getId(),0,4,player);
//.........这里部分代码省略.........
示例6: handleDataTransformWithParent
void ObjectController::handleDataTransformWithParent(Message* message,bool inRangeUpdate)
{
// FIXME: for now assume we only get messages from players
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
glm::vec3 pos;
glm::quat dir;
uint32 inMoveCount;
uint32 tickCount;
uint64 parentId;
float speed;
bool updateAll = false;
// get tick and move counters
tickCount = message->getUint32();
inMoveCount = message->getUint32();
// only process if its in sequence
if (player->getInMoveCount() <= inMoveCount)
{
uint64 oldParentId = player->getParentId();
//uint32 ticks = tickCount - player->getClientTickCount();
// update tick and move counters
player->setClientTickCount(tickCount);
player->setInMoveCount(inMoveCount);
// get new direction, position, parent and speed
parentId = message->getUint64();
dir.x = message->getFloat();
dir.y = message->getFloat();
dir.z = message->getFloat();
dir.w = message->getFloat();
pos.x = message->getFloat();
pos.y = message->getFloat();
pos.z = message->getFloat();
speed = message->getFloat();
// gLogger->logMsgF("Position inside = %f, %f, %f",MSG_NORMAL, pos.x, pos.y, pos.z);
// gLogger->logMsgF("Direction = %f, %f, %f, %f",MSG_NORMAL, dir.x, dir.y, dir.z, dir.w);
// stop entertaining, if we were
if(player->getPerformingState() != PlayerPerformance_None && player->getPosture() != CreaturePosture_SkillAnimating)
{
gEntertainerManager->stopEntertaining(player);
}
// if we changed cell
if (oldParentId != parentId)
{
CellObject* cell = NULL;
// gLogger->logMsgF("We changed cell from (%"PRIu64") to (%"PRIu64")",MSG_NORMAL, oldParentId, parentId);
// Remove us from whatever we where in before.
// (4 for add and 0 for remove)
gMessageLib->broadcastContainmentMessage(player->getId(),oldParentId,0,player);
// only remove us from si, if we just entered the building
if (oldParentId != 0)
{
if((cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(oldParentId))))
{
cell->removeObject(player);
// Done above.. gMessageLib->broadcastContainmentMessage(player->getId(),parentId,4,player);
}
else
{
gLogger->logMsgF("Error removing %"PRIu64" from cell(%"PRIu64")",MSG_NORMAL,player->getId(),oldParentId);
}
}
else
{
updateAll = true; // We just entered the building.
// remove us from qt
if(player->getSubZoneId())
{
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())))
{
//.........这里部分代码省略.........
示例7: handleDataTransform
void ObjectController::handleDataTransform(Message* message,bool inRangeUpdate)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if (!player)
{
return;
}
glm::vec3 pos;
glm::quat dir;
uint32 inMoveCount;
uint32 tickCount;
float speed;
bool updateAll = false;
// get tick and move counters
tickCount = message->getUint32();
inMoveCount = message->getUint32();
// only process if its in sequence
if(player->getInMoveCount() >= inMoveCount)
{
return;
}
//uint32 ticks = tickCount - player->getClientTickCount();
// update tick and move counters...
player->setLastMoveTick(tickCount);
player->setClientTickCount(tickCount);
player->setInMoveCount(inMoveCount);
// get new direction, position and speed
dir.x = message->getFloat();
dir.y = message->getFloat();
dir.z = message->getFloat();
dir.w = message->getFloat();
pos.x = message->getFloat();
pos.y = message->getFloat();
pos.z = message->getFloat();
speed = message->getFloat();
// stop entertaining ???
// important is, that if we move we change our posture to NOT skill animating anymore!
// so only stop entertaining when we are performing and NOT skillanimationg
if(player->getPerformingState() != PlayerPerformance_None && player->states.getPosture() != CreaturePosture_SkillAnimating)
{
gEntertainerManager->stopEntertaining(player);
}
// if we just left a building
if(player->getParentId() != 0)
{
updateAll = true;
// Testing with 4 for add and 0 for remove.
// Remove us from previous cell.
gMessageLib->broadcastContainmentMessage(player->getId(),player->getParentId(),0,player);
// remove us from the last cell we were in
if(CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(player->getParentId())))
{
cell->removeObject(player);
}
else
{
DLOG(INFO) << "Error removing" << player->getId() << " from cell " << player->getParentId();
}
// we are outside again
player->setParentId(0);
player->mPosition = pos;
// Add us to the world.
gMessageLib->broadcastContainmentMessage(player->getId(),0,4,player);
// add us to the qtree
if(QTRegion* newRegion = mSI->getQTRegion((double)pos.x,(double)pos.z))
{
player->setSubZoneId((uint32)newRegion->getId());
player->setSubZone(newRegion);
newRegion->mTree->addObject(player);
}
else
{
// we should never get here !
// it basically means we left the map
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
//however other 3rd party tools might do the same
gWorldManager->addDisconnectedPlayer(player);
return;
}
//.........这里部分代码省略.........