本文整理汇总了C++中PlayerObject::GetCreature方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::GetCreature方法的具体用法?C++ PlayerObject::GetCreature怎么用?C++ PlayerObject::GetCreature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::GetCreature方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Process
void FireworkManager::Process()
{
//This iterates all fired fireworks and keeps everything spiffy.
std::list<FireworkEvent*>::iterator it=this->fireworkEvents.begin();
std::list<FireworkEvent*>::iterator fEnd = fireworkEvents.end();
//We can do this outside the while...We likely won't get a vastly different value while in it anyway.
uint64 currentTime = gWorldManager->GetCurrentGlobalTick();
while( it != fEnd)
{
if(*it && (currentTime - (*it)->timeFired) > 2000 && (*it)->playerToldToStand == false) //2 sec
{
PlayerObject* player = dynamic_cast<PlayerObject*> (gWorldManager->getObjectById((*it)->firework_operator));
if(player && player->GetCreature()->GetPosture() == CreaturePosture_Crouched)
{
gStateManager.setCurrentPostureState(player->GetCreature(), CreaturePosture_Upright);
(*it)->playerToldToStand = true;
}
++it;
}
else if(*it && (currentTime - (*it)->timeFired) > 25000) //25 sec (about the time of a firework)
{
gWorldManager->destroyObject((*it)->firework);
delete *it;
it = fireworkEvents.erase(it);
}
else
{
++it;
}
}
}
示例2: _handleTendWound
void ObjectController::_handleTendWound(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* Medic = creature->GetGhost();
PlayerObject* Target = dynamic_cast<PlayerObject*>(Medic->getHealingTarget(Medic));
//TODO:: add medic droid
/*EMLocationType loc = Medic->getPlayerLocation();
if(loc != EMLocation_Cantina || loc != EMLocation_Camp || loc != EMLocation_PlayerStructure)
{
return;
}*/
std::string messageResponse = gMedicManager->handleMessage(message,"(action|constitution|health|quickness|stamina|strength)");
if (messageResponse.length() == 0) {
//you must specify a valid wound type
gMessageLib->SendSystemMessage(::common::OutOfBand("healing_response", "healing_response_65"), Medic);
return;
}
//check Medic has enough Mind
auto ham = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::ham::HamService>("HamService");
if(!ham->checkMainPools(Medic->GetCreature(), 0, 0, 500)) {
gMessageLib->SendSystemMessage(::common::OutOfBand("healing_response", "not_enough_mind"), Medic);
return;
}
if (gMedicManager->HealWound(Medic, Target, 0, cmdProperties, messageResponse + "tendwound"))
{
ham->ApplyWound(Medic->GetCreature(), HamBar_Focus, 5);
ham->ApplyWound(Medic->GetCreature(), HamBar_Willpower, 5);
Medic->GetCreature()->AddBattleFatigue(2);
//call the event
gMedicManager->startWoundTreatmentEvent(Medic);
return;
}
}
示例3: _handleTendDamage
void ObjectController::_handleTendDamage(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* Medic = creature->GetGhost();
PlayerObject* Target = dynamic_cast<PlayerObject*>(Medic->getHealingTarget(Medic));
//check Medic has enough Mind
auto ham = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::ham::HamService>("HamService");
if(!ham->checkMainPools(Medic->GetCreature(), cmdProperties->mHealthCost, cmdProperties->mActionCost, cmdProperties->mMindCost)){
gMessageLib->SendSystemMessage(::common::OutOfBand("healing_response", "not_enough_mind"), Medic);
return;
}
if (gMedicManager->HealDamage(Medic, Target, 0, cmdProperties, "tendDamage"))
{
ham->ApplyWound(Medic->GetCreature(), HamBar_Focus, 5);
ham->ApplyWound(Medic->GetCreature(), HamBar_Willpower, 5);
Medic->GetCreature()->AddBattleFatigue(2);
//call the event
gMedicManager->startInjuryTreatmentEvent(Medic);
return;
}
}
示例4:
//======================================================================================================================
//
// Modifies the Admin List
//
void ObjectController::_handleTransferStructure(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
// requirement we have the structure targeted AND give the name of the recipient on the commandline
// OR we have the recipient targeted and stand NEXT to the structure were about to transfer
//do we have a valid donor ?
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* player = creature->GetGhost();
if(!player)
{
return;
}
// is the player online and near 30m ?
// we get the players id as targetid if yes, otherwise we get the name as string
// however, we do not want players that are not online
//now get the target player
PlayerObject* recipient = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(targetId));
if(!recipient)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "no_transfer_target"), player);
return;
}
//do we have a valid structure ??? check our target first
uint64 id = player->GetCreature()->getTargetId();
Object* object = gWorldManager->getObjectById(id);
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
if(!structure)
{
// we need to get the nearest structure that we own
// for now dustoff
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
//is the structure in Range???
float fTransferDistance = gWorldConfig->getConfiguration<float>("Player_Transfer_Structure_Distance",(float)8.0);
if(glm::distance(player->GetCreature()->mPosition, structure->mPosition) > fTransferDistance)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
StructureAsyncCommand command;
command.PlayerId = player->getId();
command.StructureId = structure->getId();
command.RecipientId = recipient->getId();
command.PlayerStr = recipient->GetCreature()->getFirstName();
command.Command = Structure_Command_TransferStructure;
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);
}
示例5: sscanf
//======================================================================================================================
//
// Modifies the Admin List
//
void ObjectController::_handleNameStructure(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
// requirement we have the structure targeted AND give the name of the recipient on the commandline
// OR we have the recipient targeted and stand NEXT to the structure were about to transfer
//do we have a valid donor ?
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* player = creature->GetGhost();
if(!player)
{
return;
}
//do we have a valid structure ??? check our target first
uint64 id = player->GetCreature()->getTargetId();
Object* object = gWorldManager->getObjectById(id);
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
if(!structure)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
//is the structure in Range???
float fTransferDistance = gWorldConfig->getConfiguration<float>("Player_Structure_Operate_Distance",(float)10.0);
if(glm::distance(player->GetCreature()->mPosition, structure->mPosition) > fTransferDistance)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
//find out where our structure is
BString dataStr;
message->getStringUnicode16(dataStr);
BString nameStr;
dataStr.convert(BSTRType_ANSI);
sscanf(dataStr.getAnsi(),"%s",nameStr.getAnsi());
if(nameStr.getLength() > 68)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "not_valid_name"), player);
return;
}
StructureAsyncCommand command;
command.Command = Structure_Command_RenameStructure;
command.PlayerId = player->getId();
command.StructureId = structure->getId();
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);
}
示例6: DLOG
//======================================================================================================================
//
// provides the harvester with the current resources
//
void ObjectController::_handleHarvesterGetResourceData(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* player = creature->GetGhost();
if(!player) {
return;
}
//do we have a valid structure ???
uint64 id = targetId;
Object* object = gWorldManager->getObjectById(id);
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
if(!structure)
{
//gMessageLib->sendSystemMessage(player,L"","player_structure","command_no_building");
return;
}
//is the structure in Range???
float fTransferDistance = gWorldConfig->getConfiguration<float>("Player_Structure_Operate_Distance",(float)10.0);
if(glm::distance(player->GetCreature()->mPosition, structure->mPosition) > fTransferDistance)
{
DLOG(info) << " ObjectController::_handleHarvesterGetResourceData Structure not in Range";
return;
}
HarvesterObject* harvester = dynamic_cast<HarvesterObject*>(structure);
StructureAsyncCommand command;
command.Command = Structure_Command_GetResourceData;
command.PlayerId = player->getId();
command.StructureId = structure->getId();
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);
return;
gMessageLib->sendHarvesterResourceData(structure,player);
DLOG(info) << " ObjectController::_handleHarvesterGetResourceData :: hino 7 baseline";
gMessageLib->sendBaselinesHINO_7(harvester,player);
//add the structure to the timer so the resource amounts are updated while we look at the hopper
//harvester->getTTS()->todo = ttE_UpdateHopper;
//harvester->getTTS()->playerId = player->getId();
//structure->getTTS()->projectedTime = 5000 + Anh_Utils::Clock::getSingleton()->getLocalTime();
//gStructureManager->addStructureforHopperUpdate(harvester->getId());
// this needs to be handled zoneserverside - otherwise the addition of a res will trigger a racecondition
// between the sql write query and the sql read please note that the harvesting itself happens through stored procedures
// and we cant keep the updatecounters synchronized
}
示例7: _handleHealWound
void ObjectController::_handleHealWound(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* Medic = creature->GetGhost();
PlayerObject* Target = dynamic_cast<PlayerObject*>(Medic->getHealingTarget(Medic));
std::string messageResponse = gMedicManager->handleMessage(message,"(action|constitution|health|quickness|stamina|strength)");
if (messageResponse.length() == 0)
{
//you must specify a valid wound type
gMessageLib->SendSystemMessage(::common::OutOfBand("healing_response", "healing_response_65"), Medic);
}
else
{
//check Medic has enough Mind
auto ham = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::ham::HamService>("HamService");
if(!ham->checkMainPool(Medic->GetCreature(), HamBar_Mind, 140)) {
gMessageLib->SendSystemMessage(::common::OutOfBand("healing_response", "not_enough_mind"), Medic);
return;
}
if (gMedicManager->CheckMedicine(Medic, Target, cmdProperties, messageResponse))
{
//call the event
gMedicManager->startWoundTreatmentEvent(Medic);
return;
}
}
}
示例8: MountPlayer
void VehicleController::MountPlayer()
{
if (!body_) {
assert(false && "Vehicle::mountPlayer() no vehicle body!");
return;
}
PlayerObject* owner = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(owner_));
CreatureObject* owner_creature = owner->GetCreature();
//Make the mount equip the player
// body_->AddObject(owner_creature);
//ok this makes hughe problems starting with auto equipping the player crc in the creo (the naked woman riding behind me)
//and ending with the question on how to send the auto updates for the creates / destroys as we basically transfer into the main cell (which isnt existent in our core)
gMessageLib->sendContainmentMessage_InRange(owner_creature->getId(), body_->getId(), 4, owner_creature);
gStateManager.setCurrentActionState(body_, CreatureState_MountedCreature);
//gStateManager.removeActionState(owner_creature,CreatureState_ClearState);
gStateManager.setCurrentActionState(owner_creature,CreatureState_RidingMount);
gStateManager.setCurrentPostureState(owner_creature,CreaturePosture_DrivingVehicle);
gStateManager.setCurrentLocomotionState(owner_creature,CreatureLocomotion_DrivingVehicle);
owner->setMounted(true);
gMessageLib->sendUpdateMovementProperties(owner);
//gMessageLib->sendUpdateTransformMessage(body_);
}
示例9: MountPlayer
void VehicleController::MountPlayer()
{
if (!body_) {
assert(false && "Vehicle::mountPlayer() no vehicle body!");
return;
}
PlayerObject* owner = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(owner_));
CreatureObject* owner_creature = owner->GetCreature();
//Make the mount equip the player
body_->AddObject(owner_creature);
//thats currently somewhat of a hack as addobject sets the objects parent id
//this currently upsets the spatial index code as it thinks the swoop might be a cell
//and getrootparent breaks everything as it tries to calculate the lokation relative to the swoop
//this needs to be ironed out somehow
owner_creature->setParentId(0);
LOG(info) << "VehicleController::MountPlayer : arrangement " << owner->GetArrangementId();
gMessageLib->sendContainmentMessage_InRange(owner_creature->getId(), body_->getId(), owner_creature->GetArrangementId(), owner_creature);
gMessageLib->sendUpdateTransformMessage(body_);
body_->states.toggleActionOn(CreatureState_MountedCreature);
gMessageLib->sendStateUpdate(body_);
gStateManager.setCurrentActionState(owner_creature,CreatureState_RidingMount);
gMessageLib->sendStateUpdate(owner_creature);
//gStateManager.setCurrentPostureState(owner_,CreaturePosture_DrivingVehicle);
//gStateManager.setCurrentLocomotionState(owner_,CreatureLocomotion_DrivingVehicle);
owner->setMounted(true);
gMessageLib->sendUpdateMovementProperties(owner);
}
示例10: _handleDisconnectUpdate
bool WorldManager::_handleDisconnectUpdate(uint64 callTime,void* ref)
{
PlayerList::iterator it = mPlayersToRemove.begin();
while(it != mPlayersToRemove.end())
{
PlayerObject* playerObject = (*it);
// we timed out, so save + remove it
if(--*(playerObject->getDisconnectTime()) <= 0 && playerObject->isLinkDead())
{
// reset link dead state
playerObject->togglePlayerFlagOff(PlayerFlag_LinkDead);
playerObject->setConnectionState(PlayerConnState_Destroying);
//remove the player out of his group - if any
GroupObject* group = gGroupManager->getGroupObject(playerObject->GetCreature()->getGroupId());
if(group)
{
group->removePlayer(playerObject->getId());
}
//asynch save
savePlayer(playerObject->getAccountId(),true,WMLogOut_LogOut);
it = mPlayersToRemove.erase(it);
}
else
++it;
}
return(true);
}
示例11: DismountPlayer
void VehicleController::DismountPlayer() {
if(!body_) {
LOG(error) << "Vehicle::DismountPlayer() no vehicle body!";
return;
}
PlayerObject* owner = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(owner_));
CreatureObject* owner_creature = owner->GetCreature();
if(!owner->checkIfMounted()) {
LOG(error) << "Vehicle::DismountPlayer() no vehicle body!";
return;
}
//For safe measures make the player equipped by nothing
body_->RemoveObject(owner, owner_creature);
gMessageLib->sendContainmentMessage_InRange(owner_creature->getId(), 0, owner_creature->GetArrangementId(), owner_creature);
gMessageLib->sendUpdateTransformMessage(body_);
// TODO: make this more automatic...
gStateManager.removeActionState(owner_creature, CreatureState_RidingMount);
gStateManager.removeActionState(body_, CreatureState_MountedCreature);
owner->setMounted(false);
gMessageLib->sendPostureAndStateUpdate(owner_creature);
gMessageLib->sendUpdateMovementProperties(owner);
}
示例12: DismountPlayer
void VehicleController::DismountPlayer() {
if(!body_) {
LOG(error) << "Vehicle::DismountPlayer() no vehicle body!";
return;
}
LOG(error) << "Vehicle::DismountPlayer()";
PlayerObject* owner = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(owner_));
CreatureObject* owner_creature = owner->GetCreature();
if(!owner->checkIfMounted()) {
LOG(error) << "Vehicle::DismountPlayer() no vehicle body!";
return;
}
//see elaboration downstairs
// body_->RemoveObject(owner, owner_creature);
gMessageLib->sendContainmentMessage_InRange(owner_creature->getId(), 0, 0, owner_creature);
//gMessageLib->sendUpdateTransformMessage(body_);
// TODO: make this more automatic...
gStateManager.removeActionState(owner_creature, CreatureState_RidingMount);
gStateManager.setCurrentLocomotionState(owner_creature, CreatureLocomotion_Standing);
gStateManager.setCurrentPostureState(owner_creature, CreaturePosture_Upright);
gStateManager.removeActionState(body_, CreatureState_MountedCreature);
owner->setMounted(false);
gMessageLib->sendUpdateMovementProperties(owner);
}
示例13: Store
//===============================================================================================
//stores the physical body
void VehicleController::Store()
{
if(!body_) {
DLOG(info) << "Vehicle::store() Error: Store was called for a nonexistant body object!";
return;
}
PlayerObject* owner = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(owner_));
if(!owner_ || owner->GetCreature()->isDead() || owner->GetCreature()->isIncapacitated()) {
DLOG(info) << "Vehicle::store() couldnt find owner";
return;
}
// todo auto dismount
if(owner->checkIfMounted())
{
DLOG(info) << "Vehicle::store() dismounted";
DismountPlayer();
}
if(!owner->checkIfMountCalled())
{
DLOG(info) << "Vehicle::store() Mount wasnt called !!!";
return;
}
//the body is a creature_object!!!
gSpatialIndexManager->RemoveObjectFromWorld(body_);
owner->setMount(NULL);
owner->setMounted(false);
owner->setMountCalled(false);
// finally unload & destroy the vehicle creature
gWorldManager->destroyObject(body_);
// null the reference
body_ = NULL;
}
示例14: update
void CampRegion::update() {
//Camps have a max timer of 55 minutes
if (gWorldManager->GetCurrentGlobalTick() - mSetUpTime > 3300000) {
despawnCamp();
return;
}
if(mAbandoned && (gWorldManager->GetCurrentGlobalTick() >= mExpiresTime) && (!mDestroyed)) {
despawnCamp();
return;
}
PlayerObject* owner = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(mOwnerId));
if (!owner) {
despawnCamp();
return;
}
if(owner->GetCreature()->states.checkState(CreatureState_Combat)) {
//abandon
mAbandoned = true;
mExpiresTime = gWorldManager->GetCurrentGlobalTick(); //There is no grace period for combat.
return;
}
std::for_each(mVisitingPlayers.begin(), mVisitingPlayers.end(), [=] (uint64_t player_id) {
Object* visitor = gWorldManager->getObjectById(player_id);
if (!visitor) {
assert(false && "The camp is holding a reference to a player that doesn't exist");
return;
}
if (!mAbandoned) {
applyHAMHealing(visitor);
mXp++;
}
auto it = std::find_if(links.begin(), links.end(), [=] (campLink* link) {
return link->objectID == visitor->getId();
});
if (it != links.end()) {
(*it)->lastSeenTime = gWorldManager->GetCurrentGlobalTick();
if ((*it)->tickCount == 15) {
applyWoundHealing(visitor);
(*it)->tickCount = 0;
} else {
(*it)->tickCount++;
}
}
});
}
示例15: _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());
}
}
}