本文整理汇总了C++中PlayerObject::isIncapacitated方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::isIncapacitated方法的具体用法?C++ PlayerObject::isIncapacitated怎么用?C++ PlayerObject::isIncapacitated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::isIncapacitated方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleObjectMenuSelect
void TicketCollector::handleObjectMenuSelect(uint8 messageType,Object* srcObject)
{
if(messageType == radId_itemUse)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(srcObject);
// don't use while incapped or dead or in combat
if(playerObject->isIncapacitated() || playerObject->isDead() || playerObject->states.checkState(CreatureState_Combat))
{
return;
}
// in range check for shuttle not for the droid
if(playerObject->getParentId() != mParentId || (glm::distance(playerObject->mPosition, mShuttle->mPosition) > 25.0f))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "boarding_too_far"), playerObject);
return;
}
if(playerObject->checkUIWindow("handleTicketSelect"))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "boarding_ticket_selection"), playerObject);
return;
}
if(mShuttle)
{
mShuttle->useShuttle(playerObject);
}
}
else
DLOG(info) << "TravelTerminal: Unhandled MenuSelect: " << messageType;
}
示例2: handleFoodUse
void Food::handleFoodUse(Object* srcObject)
{
toDelete = true;
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(srcObject);
if(!playerObject)
{
return;
}
if(playerObject->isDead() || playerObject->isIncapacitated())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("error_message", "wrong_state"), playerObject);
return;
}
//we need to start by checking whether our stomach isnt full
//we need to update our stomach
float filling = 0;
if(this->hasInternalAttribute("food_icon"))
{
mIcon = 0;
mIcon = this->getInternalAttribute<uint32>("food_icon");
} else {
LOG(WARNING) << "Food/Drink found with no buff icon";
}
if(this->hasAttribute("counter_uses_remaining"))
{
_handleUses_Remaining(playerObject);
}
bool drink = (this->hasAttribute("stomach_drink"));
bool food = (this->hasAttribute("stomach_food"));
if(food)
{
filling = this->getAttribute<float>("stomach_food");
//do we still have place for it ?
if(!playerObject->getStomach()->checkFood(filling))
{
gMessageLib->SendSystemMessage(OutOfBand("error_message", "full_food"), playerObject);
return;
}
gMessageLib->SendSystemMessage(OutOfBand("base_player", "prose_consume_item", 0, this->getId(), 0), playerObject);
playerObject->getStomach()->incFood(filling);
}
if(drink)
{
float filling = 0;
filling = this->getAttribute<float>("stomach_drink");
//do we still have place for it ?
if(!playerObject->getStomach()->checkDrink(filling))
{
gMessageLib->SendSystemMessage(OutOfBand("error_message","full_drink"), playerObject);
return;
}
gMessageLib->SendSystemMessage(OutOfBand("base_player", "prose_consume_item", 0, this->getId(), 0), playerObject);
playerObject->getStomach()->incDrink(filling);
}
if(this->hasAttribute("duration"))
{
mDuration= static_cast<uint32>(this->getAttribute<float>("duration"));
}
if(mDuration >0)
{
_handleBuff(playerObject);
} else {
_handleInstant(playerObject);
}
// play sounds
playerObject->playFoodSound(food, drink);
//when empty delete
if(toDelete)
{
//the db
gObjectFactory->deleteObjectFromDB(this);
//destroy it in the client
gMessageLib->sendDestroyObject(this->getId(),playerObject);
//delete it out of the inventory
uint64 now = Anh_Utils::Clock::getSingleton()->getLocalTime();
playerObject->getController()->addEvent(new ItemDeleteEvent(now+100,this->getId()),100);
return;
}
return;
}
示例3: handleObjectMenuSelect
void CampTerminal::handleObjectMenuSelect(uint8 messageType,Object* srcObject)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(srcObject);
if(!playerObject || !playerObject->isConnected() || playerObject->getSamplingState() || playerObject->isIncapacitated() || playerObject->isDead()|| playerObject->checkState(CreatureState_Combat))
{
return;
}
if(messageType == radId_serverTerminalManagementDestroy)
{
CampRegion* region = dynamic_cast<CampRegion*>(gWorldManager->getObjectById(this->mCampRegionId));
region->despawnCamp();
return;
}
if(messageType == radId_serverTerminalManagementStatus)
{
mAttributesMenu.clear();
//Camp* camp = dynamic_cast<Camp*>(gWorldManager->getObjectById(this->mCampId));
CampRegion* region = dynamic_cast<CampRegion*>(gWorldManager->getObjectById(this->mCampRegionId));
int8 text[64];
sprintf(text,"Owner: %s",region->getCampOwnerName().getAnsi());
mAttributesMenu.push_back(text);
uint32 time = static_cast<uint32>(region->getUpTime());
uint32 hours = (uint32)time/3600;
time -=(hours*3600);
uint32 minutes = (uint32)(time)/60;
time -=(minutes*60);
uint32 seconds = (uint32)time;
sprintf(text,"Up-Time: %u hours, %u minutes and %u seconds",hours, minutes, seconds);
mAttributesMenu.push_back(text);
sprintf(text,"Total Visitors: %u ", region->getVisitors());
mAttributesMenu.push_back(text);
sprintf(text,"Current Visitors: %u ", region->getCurrentVisitors());
mAttributesMenu.push_back(text);
//sprintf(text,"Healing Modifier: %f ", camp->getHealingModifier());
sprintf(text,"Healing Modifier: 0.65 ");
mAttributesMenu.push_back(text);
gUIManager->createNewListBox(this,"handleMainMenu","Camp status","Below is a summary of the status of the camp.", mAttributesMenu,playerObject,SUI_Window_ListBox);
return;
}
gLogger->logMsgF("CampTerminal: Unhandled MenuSelect: %u",MSG_HIGH,messageType);
}
示例4: handleUIEvent
void PlayerStructureTerminal::handleUIEvent(uint32 action,int32 element,string inputStr,UIWindow* window)
{
// gLogger->logMsgF("InsuranceTerminal::handleUIEvent You are here!",MSG_NORMAL);
if(window == NULL)
{
return;
}
PlayerObject* playerObject = window->getOwner(); // window owner
if(playerObject == NULL || !playerObject->isConnected() || playerObject->getSamplingState() || playerObject->isIncapacitated() || playerObject->isDead())
{
return;
}
/*
switch(window->getWindowType())
{
default:
{
}
break;
}
*/
// gLogger->logMsgF("CloningTerminal::handleUIEvent You sure handled this UI-event!, Action = %d",MSG_NORMAL, action);
}
示例5: handleUIEvent
void InsuranceTerminal::handleUIEvent(uint32 action,int32 element,string inputStr,UIWindow* window)
{
// gLogger->logMsgF("InsuranceTerminal::handleUIEvent You are here!",MSG_NORMAL);
if(window == NULL)
{
return;
}
PlayerObject* playerObject = window->getOwner(); // window owner
if(playerObject == NULL || !playerObject->isConnected() || playerObject->getSamplingState() || playerObject->isIncapacitated() || playerObject->isDead()|| playerObject->checkState(CreatureState_Combat))
{
return;
}
switch(window->getWindowType())
{
case SUI_Window_Insurance_Newbie_MessageBox: // Tried to insure item when still having free rounds left.
{
switch(action)
{
case 0: // Yes
{
// Player selected to continue with insurance of item even if no need for.
// gLogger->logMsgF("SUI_Window_Insurance_Newbie_MessageBox Yes",MSG_NORMAL);
// Build the items list and optional use error-messages if needed.
BStringVector insuranceList;
this->getUninsuredItems(playerObject, &insuranceList);
// We should display all uninsured items that can be insured, and that are wearing or carrying in our inventory.
// Items in backpackage or in other containers within our inventory shall also be handled.
gUIManager->createNewListBox(this,"insure","@sui:mnu_insure","Select an item to insure.",insuranceList,playerObject,SUI_Window_Insurance_ListBox, SUI_MB_OKCANCEL);
}
break;
case 1: // No
{
// Player selected to abort, since all items are still treated as insured.
// gLogger->logMsgF("SUI_Window_Insurance_Newbie_MessageBox No",MSG_NORMAL);
}
break;
default:
{
gLogger->logMsgF("SUI_Window_Insurance_Newbie_MessageBox Invalid selection!",MSG_NORMAL);
}
break;
}
}
break;
case SUI_Window_Insurance_ListBox:
{
switch (action)
{
case 0: // OK
{
// Insure one item.
// gLogger->logMsgF("SUI_Window_Insurance_ListBox OK",MSG_NORMAL);
Inventory* inventoryObject = dynamic_cast<Inventory*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory));
Bank* bankObject = dynamic_cast<Bank*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Bank));
if(!inventoryObject || !bankObject)
return;
int32 creditsInInventory = inventoryObject->getCredits();
int32 creditsAtBank = bankObject->getCredits();
if (mSortedInsuranceList.size() == 0)
{
// You have no insurable items.
gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "no_insurables");
}
else if (element > (int32)mSortedInsuranceList.size() - 1 || element < 0)
{
// Unable to process insure item request.
gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "bad_insure_request");
}
else
{
string selectedItemm((mSortedInsuranceList.at(element).first).getAnsi());
selectedItemm.convert(BSTRType_Unicode16);
Object* object = gWorldManager->getObjectById(mSortedInsuranceList.at(element).second);
if (!object)
{
// Invalid object.
// Insure attempt failed.
gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "insure_fail");
break;
}
TangibleObject* tangibleObject = dynamic_cast<TangibleObject*>(object);
if (!tangibleObject)
{
// Not a tangible object.
// Insure attempt failed.
gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "insure_fail");
//.........这里部分代码省略.........
示例6: handleUIEvent
void TicketCollector::handleUIEvent(uint32 action,int32 element,BString inputStr,UIWindow* window)
{
if (!action && element != -1 && mShuttle != NULL && mShuttle->availableInPort())
{
uint32 zoneId = gWorldManager->getZoneId();
PlayerObject* playerObject = window->getOwner();
if(playerObject->getSurveyState() || playerObject->getSamplingState() || playerObject->isIncapacitated() || playerObject->isDead())
{
return;
}
// in range check
if(playerObject->getParentId() != mParentId || (glm::distance(playerObject->mPosition, this->mPosition) > 10.0f))
{
gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "boarding_too_far"), playerObject);
return;
}
ObjectIDList* invObjects = dynamic_cast<Inventory*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory))->getObjects();
ObjectIDList::iterator it = invObjects->begin();
while(it != invObjects->end())
{
if(TravelTicket* ticket = dynamic_cast<TravelTicket*>(gWorldManager->getObjectById((*it))))
{
BString srcPoint = (int8*)((ticket->getAttribute<std::string>("travel_departure_point")).c_str());
BString dstPointStr = (int8*)((ticket->getAttribute<std::string>("travel_arrival_point")).c_str());
uint16 srcPlanetId = static_cast<uint16>(gWorldManager->getPlanetIdByName((int8*)((ticket->getAttribute<std::string>("travel_departure_planet")).c_str())));
uint16 dstPlanetId = static_cast<uint16>(gWorldManager->getPlanetIdByName((int8*)((ticket->getAttribute<std::string>("travel_arrival_planet")).c_str())));
BStringVector* items = (dynamic_cast<UIListBox*>(window))->getDataItems();
BString selectedDst = items->at(element);
selectedDst.convert(BSTRType_ANSI);
if(srcPlanetId == zoneId && (strcmp(srcPoint.getAnsi(),mPortDescriptor.getAnsi()) == 0)
&& (strcmp(dstPointStr.getAnsi(),selectedDst.getAnsi()) == 0))
{
if(TravelPoint* dstPoint = gTravelMapHandler->getTravelPoint(dstPlanetId,dstPointStr))
{
glm::vec3 destination;
// getRand(5) return 0-4, then sub 2, and you get equal of random values at both sides of zero. (-2, -1, 0, 1, 2)
destination.x = dstPoint->spawnX + (gRandom->getRand()%5 - 2);
destination.y = dstPoint->spawnY;
destination.z = dstPoint->spawnZ + (gRandom->getRand()%5 - 2);
// If it's on this planet, then just warp, otherwize zone
if(dstPlanetId == zoneId)
{
// only delete the ticket if we are warping on this planet.
TangibleObject* tO = dynamic_cast<TangibleObject*>(gWorldManager->getObjectById(ticket->getParentId()));
gContainerManager->deleteObject(ticket, tO);
gWorldManager->warpPlanet(playerObject,destination,0);
}
else
{
gMessageLib->sendClusterZoneTransferRequestByTicket(playerObject, ticket->getId(), dstPoint->planetId);
}
}
else
{
DLOG(info) << "TicketCollector: Error getting TravelPoint";
}
break;
}
}
++it;
}
}
}
示例7: handleObjectMenuSelect
void ElevatorTerminal::handleObjectMenuSelect(uint8 messageType,Object* srcObject)
{
PlayerObject* playerObject = dynamic_cast<PlayerObject*>(srcObject);
if(!playerObject || !playerObject->isConnected() || playerObject->getSamplingState() || playerObject->isIncapacitated() || playerObject->isDead())
{
return;
}
if(messageType == radId_elevatorUp)
{
gMessageLib->sendPlayClientEffectObjectMessage(gWorldManager->getClientEffect(mEffectUp),"",playerObject);
// remove player from current position, elevators can only be inside
CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(playerObject->getParentId()));
if(cell)
{
cell->removeObject(playerObject);
}
else
{
gLogger->logMsgF("could not find cell %"PRIu64"",MSG_HIGH,playerObject->getParentId());
}
// put him into new one
playerObject->mDirection = mDstDirUp;
playerObject->mPosition = mDstPosUp;
playerObject->setParentId(mDstCellUp);
cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(mDstCellUp));
if(cell)
{
cell->addObjectSecure(playerObject);
}
else
{
gLogger->logMsgF("could not find cell %"PRIu64"",MSG_HIGH,mDstCellUp);
}
gMessageLib->sendDataTransformWithParent(playerObject);
}
else if(messageType == radId_elevatorDown)
{
gMessageLib->sendPlayClientEffectObjectMessage(gWorldManager->getClientEffect(mEffectDown),"",playerObject);
// remove player from current position, elevators can only be inside
CellObject* cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(playerObject->getParentId()));
if(cell)
{
cell->removeObject(playerObject);
}
else
{
gLogger->logMsgF("could not find cell %"PRIu64"",MSG_HIGH,playerObject->getParentId());
}
// put him into new one
playerObject->mDirection = mDstDirDown;
playerObject->mPosition = mDstPosDown;
playerObject->setParentId(mDstCellDown);
cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(mDstCellDown));
if(cell)
{
cell->addObjectSecure(playerObject);
}
else
{
gLogger->logMsgF("could not find cell %"PRIu64"",MSG_HIGH,mDstCellDown);
}
gMessageLib->sendDataTransformWithParent(playerObject);
}
else
{
gLogger->logMsgF("ElevatorTerminal: Unhandled MenuSelect: %u",MSG_HIGH,messageType);
}
}
示例8: handleUIEvent
void PlayerStructure::handleUIEvent(uint32 action,int32 element,BString inputStr,UIWindow* window)
{
PlayerObject* player = window->getOwner();
// action is zero for ok !!!
if(!player || (action) || player->isIncapacitated() || player->isDead())
{
return;
}
switch(window->getWindowType())
{
case SUI_Window_Factory_Schematics:
{
uint64 ManSchemId = 0;
//check for use schematic
BString b = window->getOption3();
b.convert(BSTRType_ANSI);
if(strcmp(b.getAnsi(),"false") == 0)
{
WindowAsyncContainerCommand* asyncContainer = (WindowAsyncContainerCommand*)window->getAsyncContainer();
if(!asyncContainer)
{
return;
}
if(asyncContainer->SortedList.size())
ManSchemId = asyncContainer->SortedList.at(element);
else
{
SAFE_DELETE(asyncContainer);
gMessageLib->SendSystemMessage(::common::OutOfBand("manf_station", "schematic_not_added"), player);
return;
}
SAFE_DELETE(asyncContainer);
StructureAsyncCommand command;
command.Command = Structure_Command_AddSchem;
command.PlayerId = player->getId();
command.StructureId = this->getId();
command.SchematicId = ManSchemId;
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"HOPPER",command);
}
else if(strcmp(b.getAnsi(),"true") == 0) //remove schematic pressed
{
WindowAsyncContainerCommand* asyncContainer = (WindowAsyncContainerCommand*)window->getAsyncContainer();
SAFE_DELETE(asyncContainer);
StructureAsyncCommand command;
command.Command = Structure_Command_RemoveSchem;
command.PlayerId = player->getId();
command.StructureId = this->getId();
command.SchematicId = ManSchemId;
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"HOPPER",command);
}
}
break;
case SUI_Window_Structure_Status:
{
//we want to refresh
StructureAsyncCommand command;
command.Command = Structure_Command_ViewStatus;
command.PlayerId = player->getId();
command.StructureId = this->getId();
gStructureManager->checkNameOnPermissionList(this->getId(),player->getId(),player->getFirstName().getAnsi(),"ADMIN",command);
}
break;
case SUI_Window_Structure_Delete:
{
gStructureManager->createNewStructureDeleteConfirmBox(player,this );
}
break;
case SUI_Window_Structure_Rename:
{
inputStr.convert(BSTRType_ANSI);
if(!inputStr.getLength())
{
//hmmm no answer - remain as it is?
return;
}
if(inputStr.getLength() > 68)
{
//hmmm no answer - remain as it is?
//.........这里部分代码省略.........
示例9: handleUIEvent
void BankTerminal::handleUIEvent(BString strInventoryCash, BString strBankCash, UIWindow* window)
{
if(window == NULL)
{
return;
}
PlayerObject* playerObject = window->getOwner(); // window owner
if(playerObject == NULL || !playerObject->isConnected() || playerObject->getSamplingState() || playerObject->isIncapacitated() || playerObject->isDead() || playerObject->checkState(CreatureState_Combat))
{
return;
}
// two money movement deltas stands for credits
// variations into bank & inventory.
// casting as signed cause one will be negative.
// when inventoryDelta + bankDelta is not equal to zero,
// that means player treasury has changed since
// the transfer window opened.
// we get the money deltas by parsing the string returned
// by the SUI window
strInventoryCash.convert(BSTRType_ANSI);
strBankCash.convert(BSTRType_ANSI);
int32 inventoryMoneyDelta = atoi(strInventoryCash.getAnsi()) - dynamic_cast<Inventory*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Inventory))->getCredits();
int32 bankMoneyDelta = atoi(strBankCash.getAnsi()) - dynamic_cast<Bank*>(playerObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Bank))->getCredits();
// the amount transfered must be greater than zero
if(bankMoneyDelta == 0 || inventoryMoneyDelta == 0)
{
return;
}
gTreasuryManager->bankTransfer(inventoryMoneyDelta, bankMoneyDelta, playerObject);
}