本文整理汇总了C++中ManagedReference::containsActiveSession方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::containsActiveSession方法的具体用法?C++ ManagedReference::containsActiveSession怎么用?C++ ManagedReference::containsActiveSession使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagedReference
的用法示例。
在下文中一共展示了ManagedReference::containsActiveSession方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startSlicingSession
int LuaPlayerObject::startSlicingSession(lua_State* L) {
TangibleObject* objToSlice = (TangibleObject*) lua_touserdata(L, -2);
bool isKeypadSlice = lua_toboolean(L, -1);
if (objToSlice == nullptr)
return 0;
ManagedReference<CreatureObject*> player = realObject->getParentRecursively(SceneObjectType::PLAYERCREATURE).castTo<CreatureObject*>();
if (player == nullptr)
return 0;
if (player->containsActiveSession(SessionFacadeType::SLICING)) {
player->sendSystemMessage("@slicing/slicing:already_slicing");
return 0;
}
//Create Session
ManagedReference<SlicingSession*> session = new SlicingSession(player);
session->setKeypadSlice(isKeypadSlice);
session->initalizeSlicingMenu(player, objToSlice);
return 0;
}
示例2: initalizeSlicingMenu
void SlicingSessionImplementation::initalizeSlicingMenu(CreatureObject* pl, TangibleObject* obj) {
player = pl;
tangibleObject = obj;
ManagedReference<CreatureObject*> player = pl;
ManagedReference<TangibleObject*> tangibleObject = obj;
if (player == NULL || tangibleObject == NULL)
return;
if (!tangibleObject->isSliceable() && !isBaseSlice())
return;
if (tangibleObject->containsActiveSession(SessionFacadeType::SLICING)) {
player->sendSystemMessage("@slicing/slicing:slicing_underway");
return;
}
if (!hasPrecisionLaserKnife(false)) { // do not remove the item on inital window
player->sendSystemMessage("@slicing/slicing:no_knife");
return;
}
//bugfix 814,819
ManagedReference<SceneObject*> inventory = player->getSlottedObject("inventory");
if (inventory == NULL)
return;
if(!isBaseSlice()){
if (!inventory->hasObjectInContainer(tangibleObject->getObjectID()) && tangibleObject->getGameObjectType() != SceneObjectType::STATICLOOTCONTAINER
&& tangibleObject->getGameObjectType() != SceneObjectType::MISSIONTERMINAL ) {
player->sendSystemMessage("The object must be in your inventory in order to perform the slice.");
return;
}
if (tangibleObject->isWeaponObject() && !hasWeaponUpgradeKit()) {
player->sendSystemMessage("@slicing/slicing:no_weapon_kit");
return;
}
if (tangibleObject->isArmorObject() && !hasArmorUpgradeKit()) {
player->sendSystemMessage("@slicing/slicing:no_armor_kit");
return;
}
}
slicingSuiBox = new SuiListBox(player, SuiWindowType::SLICING_MENU, 2);
slicingSuiBox->setCallback(new SlicingSessionSuiCallback(player->getZoneServer()));
if (tangibleObject->getGameObjectType() == SceneObjectType::PLAYERLOOTCRATE)
// Don't close the window when we remove PlayerLootContainer from the player's inventory.
slicingSuiBox->setForceCloseDisabled();
slicingSuiBox->setPromptTitle("@slicing/slicing:title");
slicingSuiBox->setUsingObject(tangibleObject);
slicingSuiBox->setCancelButton(true, "@cancel");
generateSliceMenu(slicingSuiBox);
player->getPlayerObject()->addSuiBox(slicingSuiBox);
player->addActiveSession(SessionFacadeType::SLICING, _this.getReferenceUnsafeStaticCast());
tangibleObject->addActiveSession(SessionFacadeType::SLICING, _this.getReferenceUnsafeStaticCast());
}
示例3: initializeSession
int CreateVendorSessionImplementation::initializeSession() {
ManagedReference<CreatureObject*> player = this->player.get();
if (player == NULL)
return 0;
if (player->containsActiveSession(SessionFacadeType::CREATEVENDOR)) {
player->sendSystemMessage("@player_structure:already_creating"); // You are already creating a vendor.
return 0;
}
ManagedReference<PlayerObject*> ghost = player->getPlayerObject();
if (ghost == NULL) {
cancelSession();
return 0;
}
if (ghost->getVendorCount() >= player->getSkillMod("manage_vendor")) {
player->sendSystemMessage("@player_structure:full_vendors"); // You are already managing your maximum number of vendors. Fire someone or remove a terminal first!
cancelSession();
return 0;
}
SortedVector<unsigned long long>* ownedVendors = ghost->getOwnedVendors();
for (int i = 0; i < ownedVendors->size(); i++) {
ManagedReference<SceneObject*> vendor = player->getZoneServer()->getObject(ownedVendors->elementAt(i));
if (vendor == NULL)
continue;
DataObjectComponentReference* data = vendor->getDataObjectComponent();
if(data == NULL || data->get() == NULL || !data->get()->isVendorData())
continue;
VendorDataComponent* vendorData = cast<VendorDataComponent*>(data->get());
if(vendorData == NULL)
continue;
if (!vendorData->isInitialized()) {
player->sendSystemMessage("@player_structure:already_creating"); // You are already creating a vendor.
cancelSession();
return 0;
}
}
currentNode = VendorManager::instance()->getRootNode();
templatePath = "";
if (!currentNode->hasChildNode()) {
cancelSession();
error("Vendor Root node has no children");
return 0;
}
int hiringMod = player->getSkillMod("hiring");
suiSelectVendor = new SuiListBox(player, SuiWindowType::STRUCTURE_CREATE_VENDOR);
suiSelectVendor->setCallback(new CreateVendorSuiCallback(player->getZoneServer()));
suiSelectVendor->setCancelButton(true, "@cancel");
suiSelectVendor->setPromptTitle(currentNode->getSuiDisplay() + "t");
suiSelectVendor->setPromptText(currentNode->getSuiDisplay() + "d");
currentNode->addChildrenToListBox(suiSelectVendor, hiringMod);
player->getPlayerObject()->addSuiBox(suiSelectVendor);
player->sendMessage(suiSelectVendor->generateMessage());
player->addActiveSession(SessionFacadeType::CREATEVENDOR, _this.getReferenceUnsafeStaticCast());
return 0;
}