本文整理汇总了C++中CreatureObject::GetGhost方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureObject::GetGhost方法的具体用法?C++ CreatureObject::GetGhost怎么用?C++ CreatureObject::GetGhost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureObject
的用法示例。
在下文中一共展示了CreatureObject::GetGhost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removePlayerfromAccountMap
void WorldManager::removePlayerfromAccountMap(uint64 playerID)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(gWorldManager->getObjectById(playerID));
if(!creature) {
LOG (error) << "WorldManager::removePlayerfromAccountMap : no player";
return;
}
PlayerObject* player = creature->GetGhost();
if(player) {
PlayerAccMap::iterator playerAccIt = mPlayerAccMap.find(player->getAccountId());
if(playerAccIt != mPlayerAccMap.end()) {
LOG(info) << "Player left [" << player->getId() << "] Total players on zone [" << (getPlayerAccMap()->size() -1) << "]";
mPlayerAccMap.erase(playerAccIt);
}
else
{
LOG(error) << "Error removing player from account map [" << player->getAccountId() << "]";
}
}
else
{
LOG(error) << "Error removing player from account map [" << player->getAccountId() << "]";
}
}
示例2: addObjControllerToProcess
uint64 WorldManager::addObjControllerToProcess(ObjectController* objController)
{
//make sure the Objectcontroller wont be added to the processqueue after we removed it there when logging out
//Q: can only players be added to the process queue ???
//A: probably yes - so put this to the playerhandlers
if(!objController)
return 0;
//we get added automatically when the client sends a command to process
if(objController->getObject()->getType() == ObjType_Player)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(objController->getObject());
PlayerObject* player = creature->GetGhost();
if ((player->getConnectionState() == PlayerConnState_LinkDead) || (player->getConnectionState() == PlayerConnState_Destroying))
return 0;
}
return((mObjControllerScheduler->addTask(fastdelegate::MakeDelegate(objController,&ObjectController::process),1,125,NULL)));
}
示例3:
void ObjectController::_handleHarvesterDeActivate(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)
{
return;
}
HarvesterObject* harvester = dynamic_cast<HarvesterObject*>(structure);
harvester->setActive(false);
//send the respective delta
gMessageLib->sendHarvesterActive(harvester);
//send the db update
mDatabase->executeSqlAsync(0,0,"UPDATE %s.harvesters SET active = 0 WHERE id=%"PRIu64" ",mDatabase->galaxy(),harvester->getId());
}
示例4: 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
}
示例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: _handleDiagnose
void ObjectController::_handleDiagnose(uint64 targetId, Message* message,ObjectControllerCmdProperties* cmdProperties)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* Medic = creature->GetGhost();
PlayerObject* Target = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(targetId));
if(Target != 0)
{
gMedicManager->Diagnose(Medic, Target);
} else {
gMessageLib->SendSystemMessage(::common::OutOfBand("healing_response", "healing_response_b6"), Medic);
return;
}
}
示例7: HandleRotateFurniture_
//======================================================================================================================
//
// rotates an item
//
void ObjectController::HandleRotateFurniture_(
uint64 targetId,
Message* message,
ObjectControllerCmdProperties* cmdProperties) {
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* player = creature->GetGhost();
if (!player) {
assert(false && "ObjectController::HandleRotateFurniture_ Player not found");
return;
}
// Verify that there was a target passed.
if (!targetId) {
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "rotate_what"), player);
return;
}
Object* object = gWorldManager->getObjectById(targetId);
if(!object) {
assert(false && "ObjectController::HandleRotateFurniture_ item not found");
return;
}
// Verify that the item and player are in the same structure.
CellObject* playerCell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(player->getParentId()));
if(!playerCell) {
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "rotate_what"), player);
return;
}
uint64 playerStructure = playerCell->getParentId();
CellObject* objectCell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(object->getParentId()));
if(!objectCell) {
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "rotate_what"), player);
return;
}
uint64 objectStructure = objectCell->getParentId();
if (objectStructure != playerStructure) {
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "rotate_what"), player);
return;
}
// Verify that the player has appropriate rights on this structure.
if (playerCell) {
if (BuildingObject* building = dynamic_cast<BuildingObject*>(gWorldManager->getObjectById(playerCell->getParentId()))) {
if (!building->getAdminData().check_admin(player->getId())) {
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "admin_move_only"), player);
return;
}
} else {
assert(false && "ObjectController::HandleRotateFurniture_ no structure");
return;
}
} else {
//were just outside??
return;
}
// Read the message out of the packet.
BString tmp;
message->getStringUnicode16(tmp);
// If the string has no length the message is ill-formatted, send the
// proper format to the client.
if (!tmp.getLength()) {
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "format_rotatefurniture_degrees"), player);
return;
}
// Convert the string to an ansi string for ease with the regex.
tmp.convert(BSTRType_ANSI);
std::string input_string(tmp.getAnsi());
static const regex pattern("(right|left) ([0-9]+)");
smatch result;
regex_search(input_string, result, pattern);
// If the pattern doesn't match all elements then send the proper format
// to the client.
if (result.length() < 2) {
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "format_rotatefurniture_degrees"), player);
return;
}
// Gather the results of the pattern for validation and use.
std::string direction(result[1]);
float degrees = boost::lexical_cast<float>(result[2]);
// If the the specified amount is not within the valid range notify the client.
if (degrees < 1.0f || degrees > 180.0f) {
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "rotate_params"), player);
return;
//.........这里部分代码省略.........
示例8: handleGenericMissionRequest
void ObjectController::handleGenericMissionRequest(Message* message)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* player = creature->GetGhost();
gMessageLib->SendSystemMessage(L"Missions are currently disabled, do not report this as a bug",player);
return;
uint64 mission_id = message->getUint64();
gMissionManager->missionRequest(player, mission_id);
}
示例9: if
//======================================================================================================================
//
// Modifies the Admin List
//
void ObjectController::_handleModifyPermissionList(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* player = creature->GetGhost();
if(!player)
{
DLOG(info) << " ObjectController::_handleModifyPermissionList Player not found";
return;
}
//find out where our structure is
BString dataStr;
message->getStringUnicode16(dataStr);
BString playerStr,list,action;
dataStr.convert(BSTRType_ANSI);
int8 s1[64],s2[32],s3[32];
sscanf(dataStr.getAnsi(),"%32s %16s %16s",s1, s2, s3);
playerStr = s1;
list = s2;
action = s3;
if(playerStr.getLength() > 40)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "permission_40_char"), player);
return;
}
//TODO is target a structure?? used when using the commandline option
uint64 id = player->GetCreature()->getTargetId();
Object* object = gWorldManager->getObjectById(id);
PlayerStructure* structure = dynamic_cast<PlayerStructure*>(object);
//if we have no structure that way, see whether we have a structure were we just used the adminlist
if(!structure)
{
id = player->getStructurePermissionId();
Object* object = gWorldManager->getObjectById(id);
structure = dynamic_cast<PlayerStructure*>(object);
}
if(!structure)
{
return;
}
//is the structure in Range???
float fAdminListDistance = gWorldConfig->getConfiguration<float>("Player_Admin_List_Distance",(float)32.0);
if(player->getParentId())
{
if(CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(player->getParentId())))
{
if(HouseObject* house = dynamic_cast<HouseObject*>(gWorldManager->getObjectById(cell->getParentId())))
{
if(house->getId() != structure->getId())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
}
}
}
else if(glm::distance(player->GetCreature()->mPosition, structure->mPosition) > fAdminListDistance)
{
gMessageLib->SendSystemMessage(::common::OutOfBand("player_structure", "command_no_building"), player);
return;
}
player->setStructurePermissionId(0);
StructureAsyncCommand command;
command.PlayerId = player->getId();
command.StructureId = structure->getId();
command.List = list;
command.PlayerStr = playerStr.getAnsi();
if(action == "add")
{
command.Command = Structure_Command_AddPermission;
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);
//addNametoPermissionList(command.StructureId, command.PlayerId, command.PlayerStr, command.List);
}
if(action == "remove")
{
command.Command = Structure_Command_RemovePermission;
gStructureManager->checkNameOnPermissionList(structure->getId(),player->getId(),player->GetCreature()->getFirstName(),"ADMIN",command);
}
}
示例10: handleMissionListRequest
void ObjectController::handleMissionListRequest(Message* message)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* player = creature->GetGhost();
gMessageLib->SendSystemMessage(L"Missions are currently disabled, do not report this as a bug",player);
return;
/*uint8 unknown = */
message->getUint8();
uint8 stale_flag = message->getUint8();
uint64 terminal_id = message->getUint64();
gMissionManager->listRequest(player, terminal_id,stale_flag);
}
示例11: handleMissionCreateRequest
void ObjectController::handleMissionCreateRequest(Message* message)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* player = creature->GetGhost();
gMessageLib->SendSystemMessage(L"Missions are currently disabled, do not report this as a bug",player);
return;
gMissionManager->createRequest(player);
}
示例12: destroyObject
void ObjectController::destroyObject(uint64 objectId)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* playerObject = creature->GetGhost();
Datapad* datapad = playerObject->getDataPad();
Object* object = gWorldManager->getObjectById(objectId);
auto equip_service = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::equipment::EquipmentService>("EquipmentService");
auto inventory = dynamic_cast<Inventory*>(equip_service->GetEquippedObject(playerObject->GetCreature(), "inventory"));
//could be a schematic!
ManufacturingSchematic* schem = datapad->getManufacturingSchematicById(objectId);
if(schem != NULL)
{
//delete schematic
datapad->removeManufacturingSchematic(objectId);
//delete schematic object
gObjectFactory->deleteObjectFromDB(schem);
gMessageLib->sendDestroyObject(objectId,playerObject);
return;
}
// or something else
if(object == NULL)
{
DLOG(info) << "ObjController::destroyObject: could not find object " << objectId;
return;
}
// waypoint
if(object->getType() == ObjType_Waypoint)
{
// delete from db
gObjectFactory->deleteObjectFromDB(object);
if(!datapad) {
LOG(error) << "ObjectController::destroyObject cant get datapad to destroy waypoint : " << object->getId();
return;
}
datapad->RemoveWaypoint(object->getId());
//remove from grid and/or container
gWorldManager->destroyObject(object);
}
//Inangible Objects
if(object->getType() == ObjType_Intangible)
{
gObjectFactory->deleteObjectFromDB(object);
//remove from grid and/or container
gWorldManager->destroyObject(object);
}
// tangible
else if(object->getType() == ObjType_Tangible)
{
TangibleObject* tangibleObject = dynamic_cast<TangibleObject*>(object);
auto equip_service = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::equipment::EquipmentService>("EquipmentService");
auto inventory = dynamic_cast<Inventory*>(equip_service->GetEquippedObject(playerObject->GetCreature(), "inventory"));
// items
if(Item* item = dynamic_cast<Item*>(tangibleObject))
{
// handle any family specifics
switch(item->getItemFamily())
{
case ItemFamily_CraftingTools: _handleDestroyCraftingTool(dynamic_cast<CraftingTool*>(item)); break;
case ItemFamily_Instrument: _handleDestroyInstrument(item); break;
default:break;
}
}
// reset pending ui callbacks
playerObject->resetUICallbacks(object);
// delete from db CAVE :: mark if its an Object saved in the db!!!!
// temporary placed instruments are not saved in the db
gObjectFactory->deleteObjectFromDB(object);
//remove from grid and/or container and/or World
gWorldManager->destroyObject(object);
}
//.........这里部分代码省略.........
示例13: _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;
}
}
}
示例14: _handleHealDamage
void ObjectController::_handleHealDamage(uint64 targetId, Message* message,ObjectControllerCmdProperties* cmdProperties)
{
CreatureObject* creature = dynamic_cast<CreatureObject*>(mObject); PlayerObject* Medic = creature->GetGhost();
PlayerObject* Target = dynamic_cast<PlayerObject*>(Medic->getHealingTarget(Medic));
mHandlerCompleted = gMedicManager->CheckMedicine(Medic, Target, cmdProperties, stim);
if (mHandlerCompleted)
{
//call the event
gMedicManager->startInjuryTreatmentEvent(Medic);
}
}
示例15: _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;
}
}