本文整理汇总了C++中BStringVector类的典型用法代码示例。如果您正苦于以下问题:C++ BStringVector类的具体用法?C++ BStringVector怎么用?C++ BStringVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BStringVector类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _processIsmGroupLootMasterResponse
void GroupManager::_processIsmGroupLootMasterResponse(Message* message)
{
gLogger->logMsg("_processIsmGroupLootMasterResponse");
PlayerObject* playerObject = gWorldManager->getPlayerByAccId(message->getUint32()); // the player whos group_id has changed
if(playerObject == NULL)
{
gLogger->logMsg("GroupManager::_processIsmGroupLootMasterResponse PlayerAccId not found");
return;
}
//send the SUI
gLogger->logMsg("ok\n");
PlayerList inRangeMembers = playerObject->getInRangeGroupMembers(true);
PlayerList::iterator it = inRangeMembers.begin();
BStringVector namesArray;
while(it != inRangeMembers.end())
{
namesArray.push_back((*it)->getFirstName().getAnsi());
++it;
}
gUIManager->createNewPlayerSelectListBox(playerObject,"handleSetLootMaster","@group:master_looter_sui_title","@group:set_loot_type_text",namesArray,inRangeMembers,playerObject);
}
示例2: _createTicketSelectMenu
void TicketCollector::_createTicketSelectMenu(PlayerObject* playerObject)
{
BStringVector availableTickets;
uint32 zoneId = gWorldManager->getZoneId();
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());
uint16 srcPlanetId = static_cast<uint16>(gWorldManager->getPlanetIdByName((int8*)((ticket->getAttribute<std::string>("travel_departure_planet")).c_str())));
if(srcPlanetId == zoneId && strcmp(srcPoint.getAnsi(),mPortDescriptor.getAnsi()) == 0)
{
BString dstPoint = (int8*)((ticket->getAttribute<std::string>("travel_arrival_point")).c_str());
availableTickets.push_back(dstPoint.getAnsi());
}
}
++it;
}
gUIManager->createNewListBox(this,"handleticketselect","select destination","Select destination",availableTickets,playerObject);
}
示例3: int
bool ArtisanManager::setupSampleEvent(PlayerObject* player, CurrentResource* resource, SurveyTool* tool)
{
//EVENT WINDOW CASE
int32 eventRoll = int(gRandom->getRand()%2)+1;
//eventRoll = 2;
//do event 1 or event 2 based on roll
if(eventRoll == 1)
{
// setup gamble event
//GAMBLE Event
WindowAsyncContainerCommand* asyncContainer = new WindowAsyncContainerCommand(Window_Query_Radioactive_Sample);
asyncContainer->PlayerId = player->getId();
asyncContainer->ToolId = tool->getId();
asyncContainer->CurrentResource = resource;
BStringVector items;
items.push_back("Ignore the concentration and continue working.");
items.push_back("Attempt to recover the resources. (300 Action)");
gUIManager->createNewListBox(this,"gambleSample","@survey:gnode_t","@survey:gnode_d",items,player,SUI_Window_SmplGamble_ListBox,SUI_LB_OKCANCEL,0,0,asyncContainer);
player->getSampleData()->mPendingSample = false;
return true;
}
else
{
WindowAsyncContainerCommand* asyncContainer = new WindowAsyncContainerCommand(Window_Query_Radioactive_Sample);
asyncContainer->PlayerId = player->getId();
asyncContainer->ToolId = tool->getId();
asyncContainer->CurrentResource = resource;
//WAYP CONCENTRATION
BStringVector items;
items.push_back("Ignore the concentration and continue working.");
items.push_back("Focus the device on the concentration");
gUIManager->createNewListBox(this,"waypNodeSample","@survey:cnode_t","@survey:cnode_d",items,player,SUI_Window_SmplWaypNode_ListBox,SUI_LB_OKCANCEL,0,0,asyncContainer);
//Pause sampling
player->getSampleData()->mPendingSample = false;
player->getSampleData()->mSampleEventFlag = true;
return true;
}
return false;
}
示例4: _processIsmGroupLootModeResponse
void GroupManager::_processIsmGroupLootModeResponse(Message* message)
{
gLogger->logMsg("_processIsmGroupLootModeResponse");
PlayerObject* playerObject = gWorldManager->getPlayerByAccId(message->getUint32()); // the player whos group_id has changed
if(playerObject == NULL)
{
gLogger->logMsg("GroupManager::processIsmGroupLootModeResponse PlayerAccId not found");
return;
}
//send the SUI
BStringVector availableLootModes;
availableLootModes.push_back("Free for all");
availableLootModes.push_back("Master Looter");
availableLootModes.push_back("Lottery");
availableLootModes.push_back("Random");
gUIManager->createNewListBox(playerObject,"handleSetLootMode","@group:set_loot_type_title","@group:set_loot_type_text",availableLootModes,playerObject,SUI_Window_SelectGroupLootMode_Listbox);
}
示例5: return
bool MessageLib::sendBanList(PlayerStructure* structure, PlayerObject* playerObject)
{
if(!(playerObject->isConnected()))
return(false);
Message* newMessage;
mMessageFactory->StartMessage();
mMessageFactory->addUint32(opSendPermissionList);
mMessageFactory->addUint32(structure->getStrucureBanList().size() );
BString name;
BStringVector vector = structure->getStrucureBanList();
BStringVector::iterator it = vector.begin();
while(it != vector.end())
{
name = (*it);
name.convert(BSTRType_Unicode16);
mMessageFactory->addString(name);
it++;
}
mMessageFactory->addUint32(0); // ???
//mMessageFactory->addUint16(0); // unknown
name = "BAN";
name.convert(BSTRType_Unicode16);
mMessageFactory->addString(name);
mMessageFactory->addUint32(0); // ???
newMessage = mMessageFactory->EndMessage();
(playerObject->getClient())->SendChannelA(newMessage, playerObject->getAccountId(), CR_Client, 5);
structure->resetStructureAdminList();
return(true);
}
示例6: _processSearchKnowledgeBaseMessage
void CSRManager::_processSearchKnowledgeBaseMessage(Message *message, DispatchClient* client)
{
BString search;
message->getStringUnicode16(search);
search.convert(BSTRType_ANSI);
BStringVector splitstring;
search.split(splitstring, ' ');
BStringVector::iterator iter = splitstring.begin();
BString sql = "%";
while (iter != splitstring.end())
{
int8 cleanSearchString[4000];
mDatabase->Escape_String(cleanSearchString, (*iter).getAnsi(), (*iter).getLength());
sql << cleanSearchString;
sql << "%";
++iter;
}
CSRAsyncContainer* asynccontainer = new CSRAsyncContainer(CSRQuery_SearchKB);
asynccontainer->mClient = client;
mDatabase->ExecuteProcedureAsync(this, asynccontainer, "CALL sp_CSRKnowledgeBaseArticleFind ('%s');", sql.getAnsi());
}
示例7: setLastConversationTarget
bool Trainer::preProcessfilterConversation(ActiveConversation* av,Conversation* conversation,PlayerObject* player)
{
bool continueConversation = true;
ConversationPage *page = conversation->getPage(2); // Page 2 is where WE have the interesting skill-options to check.
// gLogger->log(LogManager::DEBUG,"Trainer::preProcessfilterConversation: page->mId = %u",page->mId);
setLastConversationTarget(player->getId());
std::vector<ConversationOption*>::iterator optionIt = page->mOptions.begin();
switch(page->mId)
{
// Lets see if we have the requriments met by this trainer.
case 2:
{
bool noviceSkill = false;
bool gotAllSkills = true; // As long as we have not detected any missing skills.
uint32 skillsToLearn = 0;
BStringVector skillsRequired;
bool gotRequirementsForSomeSkill = false;
while (optionIt != page->mOptions.end())
{
Skill* skill = gSkillManager->getSkillByName((*optionIt)->mStfVariable);
// requirementsMet = false;
// its no skill option
if (!skill)
{
// gLogger->log(LogManager::DEBUG,"Trainer::preProcessfilterConversation: Its no skill option");
}
// see if we have it already and check xp
// Note: We do not handle lack of SP as an error now... that's done later in this chain of events.
else if (player->checkSkill(skill->mId))
{
// We already have this skill.
// gLogger->log(LogManager::DEBUG,"Trainer::preProcessfilterConversation: We already have this skill");
}
else if (!skill->mSkillsRequired.size())
{
// No skill requirements, we got a "Novice" skill from a basic profession.
// gLogger->log(LogManager::DEBUG,"Trainer::preProcessfilterConversation: Novice");
skillsToLearn++;
gotAllSkills = false; // Do not have all skills if we end up here.
noviceSkill = true;
}
else
{
// gLogger->log(LogManager::DEBUG,"Trainer::preProcessfilterConversation: Do not have all skills if we end up here");
gotAllSkills = false; // Do not have all skills if we end up here.
// see if we got the required skills
SkillsRequiredList::iterator reqSkillIt = skill->mSkillsRequired.begin();
bool requirementsMet = true;
skillsToLearn++;
int8 str[128];
while (reqSkillIt != skill->mSkillsRequired.end())
{
if (!player->checkSkill(*reqSkillIt))
{
// we don't have the requirements
// gLogger->log(LogManager::DEBUG,"Trainer::preProcessfilterConversation: We don't have the requirements");
requirementsMet = false;
// We should only add requirements for Novice skills (and then only for Elite Professions).
if (strstr(gSkillManager->getSkillById(skill->mId)->mName.getAnsi(),"novice"))
{
// add it to our list
sprintf(str,"@%s:%s","skl_n", gSkillManager->getSkillById(*reqSkillIt)->mName.getAnsi());
// gLogger->log(LogManager::DEBUG,"Trainer::conversationEvent: Skills missing = %u %s", *reqSkillIt, gSkillManager->getSkillById(*reqSkillIt)->mName.getAnsi());
skillsRequired.push_back(str);
}
else
{
break;
}
}
++reqSkillIt;
}
if (requirementsMet)
{
// gLogger->log(LogManager::DEBUG,"Trainer::preProcessfilterConversation: We DO have the requirements, check if we have the xp for next level");
gotRequirementsForSomeSkill = true;
// We DO have the requirements, check if we have the xp for next level.
if (player->getXpAmount(skill->mXpType) < skill->mXpCost)
{
// We do not have enough of XP for training this skill.
// gLogger->log(LogManager::DEBUG,"Trainer::conversationEvent: Missing XP");
skillsToLearn--;
}
}
else
{
//.........这里部分代码省略.........
示例8: switch
//.........这里部分代码省略.........
// We don't have the requirements
if (!player->checkSkill(*reqSkillIt))
{
// This is a system failure.
failed = true;
break;
}
++reqSkillIt;
}
}
if (!failed)
{
// We do not charge any cost for training in the Tutorial.
}
else
{
// This is a system error.
gMessageLib->SendSystemMessage(::common::OutOfBand("teaching", "learning_failed"), player);
// gLogger->log(LogManager::DEBUG,"Trainer::conversationEvent: Error verifying credits");
pageLink = 0;
}
}
break;
case 7:
{
// Selected more info about this skill.
Skill* skill = gSkillManager->getSkillByName(av->getTOStfVariable());
if (skill)
{
int8 str[800];
BStringVector populatedListBox;
int8 strCaption[128];
sprintf(strCaption,"@%s:%s","skl_n", skill->mName.getAnsi());
sprintf(str,"MONETARY COST");
populatedListBox.push_back(str);
if (gWorldConfig->isTutorial() && (!skill->mSkillsRequired.size()))
{
sprintf(str,"%u credits", 0);
}
else
{
sprintf(str,"%u credits", skill->mMoneyRequired);
}
populatedListBox.push_back(str);
sprintf(str,"SKILL POINT COST");
populatedListBox.push_back(str);
sprintf(str,"%u points", skill->mSkillPointsRequired);
populatedListBox.push_back(str);
sprintf(str,"REQUIRED SKILLS");
populatedListBox.push_back(str);
SkillsRequiredList::iterator reqSkillIt = skill->mSkillsRequired.begin();
while (reqSkillIt != skill->mSkillsRequired.end())
{
// Add all skills required.
// if (!player->checkSkill(*reqSkillIt))
{
// We don't have this required skill
示例9: handleObjectMenuSelect
void InsuranceTerminal::handleObjectMenuSelect(uint8 messageType,Object* srcObject)
{
PlayerObject* playerObject = (PlayerObject*)srcObject;
if (playerObject && playerObject->isConnected())
{
// Fetch all items that can be insured.
BStringVector insuranceList;
this->getUninsuredItems(playerObject, &insuranceList);
if (gWorldConfig->isTutorial())
{
// We do a simpleified version of insurance when using the terminal in the Tutorial.
if (this->getParentId() && gWorldManager->getObjectById(this->getParentId())->getParentId())
{
// We are located inside a building.
// Insure all insurable items.
if (mSortedInsuranceList.size() == 0)
{
// You do not have any items that can be insured. BUT.. we ignore this for now when running the tutorial.
// gMessageLib->sendSystemMessage(playerObject, L"", "terminal_ui", "no_insurable_items");
}
else
{
// Insure all the items.
// Let's warn about the fatal error conditions first (object destroyed or invalid type),
SortedInventoryItemList::iterator it = mSortedInsuranceList.begin();
while (it != mSortedInsuranceList.end())
{
string selectedItemm = (*it).first;
selectedItemm.convert(BSTRType_Unicode16);
Object* object = gWorldManager->getObjectById((*it).second);
if (!object)
{
// Invalid object, we send a warning about this error.
gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "insure_fail");
}
else
{
TangibleObject* tangibleObject = dynamic_cast<TangibleObject*>(object);
if (!tangibleObject)
{
// Not a tangible object, we send a warning about this error.
gMessageLib->sendSystemMessage(playerObject, L"", "error_message", "insure_fail");
}
else if (!tangibleObject->hasInternalAttribute("insured"))
{
// This is not a fatal error, but should never happen.
// [Insurance] Item uninsurable: %TT.
gMessageLib->sendSystemMessage(playerObject,L"","error_message","prose_item_uninsurable", "","", L"", 0, "", "", selectedItemm);
}
else if (tangibleObject->getInternalAttribute<bool>("insured"))
{
// This is not a fatal error, but should never happen.
// [Insurance] Item already insured: %TT.
gMessageLib->sendSystemMessage(playerObject,L"","error_message","prose_item_already_insured", "","", L"", 0, "", "", selectedItemm);
}
else
{
// Update attribute.
tangibleObject->setInternalAttribute("insured","1");
gWorldManager->getDatabase()->ExecuteSqlAsync(NULL,NULL,"UPDATE item_attributes SET value=1 WHERE item_id=%"PRIu64" AND attribute_id=%u",tangibleObject->getId(), 1270);
tangibleObject->setTypeOptions(tangibleObject->getTypeOptions() | 4);
// Update insurance status.
(void)gMessageLib->sendUpdateTypeOption(tangibleObject, playerObject);
}
}
it++;
}
}
// Always display success when doing the tutorial.
// Insurance transaction successfully completed.
gMessageLib->sendSystemMessage(playerObject,L"","base_player","insure_success");
// Inform Tutorial about the insurance.
playerObject->getTutorial()->tutorialResponse("insureItemsDone");
}
}
else
{
switch(messageType)
{
case radId_itemUse:
{
if (playerObject->getNewPlayerExemptions())
{
// player have free deatchs left.
gUIManager->createNewMessageBox(this,"","@base_player:noob_confirm_insure_title","@base_player:noob_confirm_insure_prompt",playerObject, SUI_Window_Insurance_Newbie_MessageBox, SUI_MB_YESNO);
}
else
{
// We should display all uninsured items that can be insured, and that are wearing or carrying in our inventory.
//.........这里部分代码省略.........
示例10: switch
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");
//.........这里部分代码省略.........
示例11: while
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;
}
}
}
示例12: updateMovementProperties
void CreatureObject::die()
{
mIncapCount = 0;
mCurrentIncapTime = 0;
mFirstIncapTime = 0;
// gLogger->logMsg("CreatureObject::die I'm dead");
gMessageLib->sendIncapTimerUpdate(this);
if(PlayerObject* player = dynamic_cast<PlayerObject*>(this))
{
gMessageLib->sendSystemMessage(player,L"","base_player","victim_dead");
player->disableAutoAttack();
}
mPosture = CreaturePosture_Dead;
// reset ham regeneration
mHam.updateRegenRates();
gWorldManager->removeCreatureHamToProcess(mHam.getTaskId());
mHam.setTaskId(0);
updateMovementProperties();
// clear states
mState = 0;
gMessageLib->sendPostureAndStateUpdate(this);
if(PlayerObject* player = dynamic_cast<PlayerObject*>(this))
{
gMessageLib->sendUpdateMovementProperties(player);
gMessageLib->sendSelfPostureUpdate(player);
// update duel lists
PlayerList::iterator duelIt = player->getDuelList()->begin();
while(duelIt != player->getDuelList()->end())
{
if((*duelIt)->checkDuelList(player))
{
PlayerObject* duelPlayer = (*duelIt);
duelPlayer->removeFromDuelList(player);
gMessageLib->sendUpdatePvpStatus(player,duelPlayer);
gMessageLib->sendUpdatePvpStatus(duelPlayer,player);
}
++duelIt;
}
player->getDuelList()->clear();
// update defender lists
ObjectIDList::iterator defenderIt = mDefenders.begin();
while (defenderIt != mDefenders.end())
{
if (CreatureObject* defenderCreature = dynamic_cast<CreatureObject*>(gWorldManager->getObjectById((*defenderIt))))
{
defenderCreature->removeDefenderAndUpdateList(this->getId());
if (PlayerObject* defenderPlayer = dynamic_cast<PlayerObject*>(defenderCreature))
{
gMessageLib->sendUpdatePvpStatus(this,defenderPlayer);
// gMessageLib->sendDefenderUpdate(defenderPlayer,0,0,this->getId());
}
// Defender not hostile to me any more.
gMessageLib->sendUpdatePvpStatus(defenderCreature, player);
// if no more defenders, clear combat state
if (!defenderCreature->getDefenders()->size())
{
defenderCreature->toggleStateOff((CreatureState)(CreatureState_Combat + CreatureState_CombatAttitudeNormal));
gMessageLib->sendStateUpdate(defenderCreature);
}
}
// If we remove self from all defenders, then we should remove all defenders from self. Remember, we are dead.
defenderIt = mDefenders.erase(defenderIt);
}
// bring up the clone selection window
ObjectSet inRangeBuildings;
BStringVector buildingNames;
std::vector<BuildingObject*> buildings;
BuildingObject* nearestBuilding = NULL;
BuildingObject* preDesignatedBuilding = NULL;
// Search for cloning facilities.
gWorldManager->getSI()->getObjectsInRange(this,&inRangeBuildings,ObjType_Building,8192);
ObjectSet::iterator buildingIt = inRangeBuildings.begin();
while (buildingIt != inRangeBuildings.end())
{
BuildingObject* building = dynamic_cast<BuildingObject*>(*buildingIt);
if (building)
{
// Do we have any personal clone location?
//.........这里部分代码省略.........
示例13: while
void TravelMapHandler::handleUIEvent(uint32 action,int32 element,BString inputStr,UIWindow* window)
{
if(!action && element != -1 )
{
uint32 zoneId = gWorldManager->getZoneId();
PlayerObject* playerObject = window->getOwner();
UITicketSelectListBox* listBox = dynamic_cast<UITicketSelectListBox*>(window);
if(playerObject->getSurveyState() || playerObject->getSamplingState() || !listBox)
return;
Shuttle* shuttle = listBox->getShuttle();
if(!shuttle)
{
return;
}
if (!shuttle->availableInPort())
{
gMessageLib->SendSystemMessage(::common::OutOfBand("travel", "shuttle_not_available"), playerObject);
return;
}
if((playerObject->getParentId() != shuttle->getParentId()) || (glm::distance(playerObject->mPosition, shuttle->mPosition) > 25.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())
{
TravelTicket* ticket = dynamic_cast<TravelTicket*>(gWorldManager->getObjectById((*it)));
if(ticket)
{
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<uint8>(gWorldManager->getPlanetIdByName((int8*)((ticket->getAttribute<std::string>("travel_departure_planet")).c_str())));
uint16 dstPlanetId = static_cast<uint8>(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(dstPointStr.getAnsi(),selectedDst.getAnsi()) == 0)&&(strcmp(srcPoint.getAnsi(),listBox->getPort().getAnsi()) == 0))
{
TravelPoint* dstPoint = gTravelMapHandler->getTravelPoint(dstPlanetId,dstPointStr);
if(dstPoint != NULL)
{
glm::vec3 destination;
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
{
}
break;
}
}
++it;
}
}
}
示例14: createNewDiagnoseListBox
//======================================================================================================================
void UIManager::createNewDiagnoseListBox(UICallback* callback,PlayerObject* Medic, PlayerObject* Patient)
{
BStringVector attributesMenu;
BString FirstName = Patient->getFirstName(); FirstName.toUpper();
BString LastName = Patient->getLastName(); LastName.toUpper();
int8 title[64];
sprintf(title,"PATIENT %s %s'S WOUNDS",FirstName.getAnsi(), LastName.getAnsi());
int8 desc[512];
sprintf(desc, "Below is a listing of the Wound and Battle Fatigue levels of %s %s. Wounds are healed through /tendWound or use of Wound Medpacks. High levels of Battle Fatigue can inhibit the healing process, and Battle Fatigue can only be healed by the patient choosing to watch performing entertainers",Patient->getFirstName().getAnsi(), Patient->getLastName().getAnsi());
int8 Health[32];
sprintf(Health,"Health -- %i",Patient->getHam()->mHealth.getWounds());
attributesMenu.push_back(Health);
int8 Strength[32];
sprintf(Strength,"Strength -- %i",Patient->getHam()->mStrength.getWounds());
attributesMenu.push_back(Strength);
int8 Constitution[32];
sprintf(Constitution,"Constitution -- %i",Patient->getHam()->mConstitution.getWounds());
attributesMenu.push_back(Constitution);
int8 Action[32];
sprintf(Action,"Action -- %i",Patient->getHam()->mAction.getWounds());
attributesMenu.push_back(Action);
int8 Quickness[32];
sprintf(Quickness,"Quickness -- %i",Patient->getHam()->mQuickness.getWounds());
attributesMenu.push_back(Quickness);
int8 Stamina[32];
sprintf(Stamina,"Stamina -- %i",Patient->getHam()->mStamina.getWounds());
attributesMenu.push_back(Stamina);
int8 Mind[32];
sprintf(Mind,"Mind -- %i",Patient->getHam()->mMind.getWounds());
attributesMenu.push_back(Mind);
int8 Focus[32];
sprintf(Focus,"Focus -- %i",Patient->getHam()->mFocus.getWounds());
attributesMenu.push_back(Focus);
int8 Willpower[32];
sprintf(Willpower,"Willpower -- %i",Patient->getHam()->mWillpower.getWounds());
attributesMenu.push_back(Willpower);
int8 BattleFatigue[32];
sprintf(BattleFatigue,"Battle Fatigue -- %i",Patient->getHam()->getBattleFatigue());
attributesMenu.push_back(BattleFatigue);
createNewListBox(callback,"handleDiagnoseMenu",title, desc, attributesMenu, Medic, SUI_Window_ListBox,SUI_LB_OK,Patient->getId());
}