Пример #1
0
void SpaceSpaceTypeVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
    if (modelObject.optionalCast<model::Space>()) {
        if (index == OS_SpaceFields::SpaceTypeName) {
            emit itemIds(makeVector());
        }
    } else if (modelObject.optionalCast<model::Building>()) {
        if (index == OS_BuildingFields::SpaceTypeName) {
            emit itemIds(makeVector());
        }
    }
}
void BuildingStoryUnassignedSpacesVectorController::onObjectAdded(const openstudio::model::ModelObject& modelObject, const openstudio::IddObjectType& iddObjectType, const openstudio::UUID& handle)
{
  if (modelObject.optionalCast<model::Space>()){
    attachOtherModelObject(modelObject);
    emit itemIds(makeVector());
  }
}
Пример #3
0
void SpaceSpaceInfiltrationDesignFlowRateVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
    if (modelObject.optionalCast<model::SpaceInfiltrationDesignFlowRate>()) {
        if (index == OS_SpaceInfiltration_DesignFlowRateFields::SpaceorSpaceTypeName) {
            emit itemIds(makeVector());
        }
    }
}
void BuildingStoryUnassignedSpacesVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  if (modelObject.optionalCast<model::Space>()){
    if (index == OS_SpaceFields::BuildingStoryName){
      emit itemIds(makeVector());
    }
  }
}
void UtilityBillFuelTypeListController::objectRemoved(boost::shared_ptr<openstudio::detail::WorkspaceObject_Impl> impl, const openstudio::IddObjectType& iddObjectType, const openstudio::UUID& handle)
{
  if (iddObjectType == m_iddObjectType){
    // in a ModelObjectTypeListView this is sufficient to say that a new item has been added to our list
    // however, in this case we need to also check the fuel type
    if (boost::dynamic_pointer_cast<model::detail::UtilityBill_Impl>(impl)){
      if (boost::dynamic_pointer_cast<model::detail::UtilityBill_Impl>(impl)->fuelType() == m_fuelType){

        emit itemIds(makeVector());
      }
    }
  }
}
void ModelObjectListController::objectAdded(std::shared_ptr<openstudio::detail::WorkspaceObject_Impl> impl, const openstudio::IddObjectType& iddObjectType, const openstudio::UUID& handle)
{
  if (iddObjectType == m_iddObjectType){
    std::vector<OSItemId> ids = this->makeVector();
    emit itemIds(ids);

    for (const OSItemId& id : ids){
      if (id.itemId() == impl->handle().toString()){
        emit selectedItemId(id);
        break;
      }
    }
  }
}
Пример #7
0
  void ScriptsVectorController::directoryChanged(const QString &t_path)
  {
    StringVector extsToIgnore;
    extsToIgnore.push_back("osp");
    extsToIgnore.push_back("osp-journal");
    extsToIgnore.push_back("db");
    extsToIgnore.push_back("db-journal");
    StringVector::const_iterator extsToIgnoreBegin = extsToIgnore.begin();
    StringVector::const_iterator extsToIgnoreEnd = extsToIgnore.end();

    openstudio::path path = openstudio::toPath(t_path);

    if (!m_fswatcher->directories().contains(toQString(m_path))
        && boost::filesystem::exists(m_path))
    {
      m_fswatcher->addPath(openstudio::toQString(m_path));
    }

    if (!m_fswatcher->directories().contains(toQString(m_path.parent_path()))
        && boost::filesystem::exists(m_path.parent_path()))
    {
      m_fswatcher->addPath(openstudio::toQString(m_path.parent_path()));
    }

 
    if (path == m_path) {
      // ooh, it was us.
      QStringList files = QDir(openstudio::toQString(m_path)).entryList(QDir::Files, QDir::Name);

      std::vector<OSItemId> items;
      for (QStringList::const_iterator itr = files.begin();
           itr != files.end();
           ++itr)
      {
        openstudio::path filePath = openstudio::toPath(*itr);
        std::string ext = getFileExtension(filePath);
        if (std::find(extsToIgnoreBegin,extsToIgnoreEnd,ext) == extsToIgnoreEnd) {
          items.push_back(scriptToItemId(m_path / filePath));
        }
      }

      m_items = items;
      std::reverse(m_items.begin(), m_items.end());

      emit itemIds(m_items);
    } else {
      LOG(Debug, "No match for FS Path: " << openstudio::toString(path) << " " << openstudio::toString(m_path));
    }
  }
Пример #8
0
void SpaceDesignSpecificationOutdoorAirVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
    if (modelObject.optionalCast<model::Space>()) {
        if (index == OS_SpaceFields::DesignSpecificationOutdoorAirObjectName) {
            emit itemIds(makeVector());
        } else if (index == OS_SpaceFields::SpaceTypeName) {
            detachOtherModelObjects();
            model::Space space = m_modelObject->cast<model::Space>();
            attachOtherModelObjects(space);
            emit itemIds(makeVector());
        }
    } else if (modelObject.optionalCast<model::Building>()) {
        if (index == OS_BuildingFields::SpaceTypeName) {
            detachOtherModelObjects();
            model::Space space = m_modelObject->cast<model::Space>();
            attachOtherModelObjects(space);
            emit itemIds(makeVector());
        }
    } else if (modelObject.optionalCast<model::SpaceType>()) {
        if (index == OS_SpaceTypeFields::DesignSpecificationOutdoorAirObjectName) {
            emit itemIds(makeVector());
        }
    }
}
void BuildingStoryDefaultScheduleSetVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  if (index == OS_BuildingStoryFields::DefaultScheduleSetName){
    emit itemIds(makeVector());
  }
}
void ModelObjectListController::objectRemoved(std::shared_ptr<openstudio::detail::WorkspaceObject_Impl> impl, const openstudio::IddObjectType& iddObjectType, const openstudio::UUID& handle)
{
  if (iddObjectType == m_iddObjectType){
    emit itemIds(makeVector());
  }
}
void ConstructionObjectVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  emit itemIds(makeVector());
}
Пример #12
0
void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
{
    Player* player = GetPlayer();

    // Read everything

    ObjectGuid npcGuid;

    recvData.ReadByteMask(npcGuid[1]);

    uint32 countDeposit = recvData.ReadBits(26);

    if (countDeposit > 9)
        return;

    std::vector<ObjectGuid> itemGuids(countDeposit);
    for (uint32 i = 0; i < countDeposit; ++i)
    {
        recvData
            .ReadByteMask(itemGuids[i][4])
            .ReadByteMask(itemGuids[i][6])
            .ReadByteMask(itemGuids[i][7])
            .ReadByteMask(itemGuids[i][0])
            .ReadByteMask(itemGuids[i][1])
            .ReadByteMask(itemGuids[i][5])
            .ReadByteMask(itemGuids[i][3])
            .ReadByteMask(itemGuids[i][2]);
    }

    recvData
        .ReadByteMask(npcGuid[2])
        .ReadByteMask(npcGuid[0])
        .ReadByteMask(npcGuid[3])
        .ReadByteMask(npcGuid[5])
        .ReadByteMask(npcGuid[6])
        .ReadByteMask(npcGuid[4]);

    uint32 countWithdraw = recvData.ReadBits(26);

    if (countWithdraw > 9)
        return;

    std::vector<ObjectGuid> itemIds(countWithdraw);
    for (uint32 i = 0; i < countWithdraw; ++i)
    {
        recvData
            .ReadByteMask(itemIds[i][4])
            .ReadByteMask(itemIds[i][7])
            .ReadByteMask(itemIds[i][1])
            .ReadByteMask(itemIds[i][0])
            .ReadByteMask(itemIds[i][2])
            .ReadByteMask(itemIds[i][3])
            .ReadByteMask(itemIds[i][5])
            .ReadByteMask(itemIds[i][6]);
    }

    recvData.ReadByteMask(npcGuid[7]);

    for (uint32 i = 0; i < countDeposit; ++i)
    {
        recvData
            .ReadByteSeq(itemGuids[i][6])
            .ReadByteSeq(itemGuids[i][1])
            .ReadByteSeq(itemGuids[i][0])
            .ReadByteSeq(itemGuids[i][2])
            .ReadByteSeq(itemGuids[i][4])
            .ReadByteSeq(itemGuids[i][5])
            .ReadByteSeq(itemGuids[i][3])
            .ReadByteSeq(itemGuids[i][7]);
    }

    recvData.ReadByteSeq(npcGuid[5]);
    recvData.ReadByteSeq(npcGuid[6]);

    for (uint32 i = 0; i < countWithdraw; ++i)
    {
        recvData
            .ReadByteSeq(itemIds[i][3])
            .ReadByteSeq(itemIds[i][0])
            .ReadByteSeq(itemIds[i][1])
            .ReadByteSeq(itemIds[i][6])
            .ReadByteSeq(itemIds[i][2])
            .ReadByteSeq(itemIds[i][7])
            .ReadByteSeq(itemIds[i][5])
            .ReadByteSeq(itemIds[i][4]);
    }

    recvData
        .ReadByteSeq(npcGuid[1])
        .ReadByteSeq(npcGuid[4])
        .ReadByteSeq(npcGuid[7])
        .ReadByteSeq(npcGuid[3])
        .ReadByteSeq(npcGuid[2])
        .ReadByteSeq(npcGuid[0]);

    Creature* unit = player->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_VAULTKEEPER);
    if (!unit)
        return;

    if (!player->IsVoidStorageUnlocked())
        return;

    if (itemGuids.size() > player->GetNumOfVoidStorageFreeSlots())
    {
        SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_FULL);
        return;
    }

    uint32 freeBagSlots = 0;
    if (itemIds.size() != 0)
    {
        // make this a Player function
        for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
            if (Bag* bag = player->GetBagByPos(i))
                freeBagSlots += bag->GetFreeSlots();
        for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
            if (!player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
                ++freeBagSlots;
    }

    if (itemIds.size() > freeBagSlots)
    {
        SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_INVENTORY_FULL);
        return;
    }

    if (!player->HasEnoughMoney(uint64(itemGuids.size() * VOID_STORAGE_STORE_ITEM)))
    {
        SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_NOT_ENOUGH_MONEY);
        return;
    }

    std::pair<VoidStorageItem, uint8> depositItems[VOID_STORAGE_MAX_DEPOSIT];
    uint8 depositCount = 0;
    for (std::vector<ObjectGuid>::iterator itr = itemGuids.begin(); itr != itemGuids.end(); ++itr)
    {
        Item* item = player->GetItemByGuid(*itr);
        if (!item)
            continue;

        VoidStorageItem itemVS(sObjectMgr->GenerateVoidStorageItemId(), item->GetEntry(), item->GetUInt64Value(ITEM_FIELD_CREATOR), item->GetItemRandomPropertyId(), item->GetItemSuffixFactor());

        uint8 slot = player->AddVoidStorageItem(itemVS);

        depositItems[depositCount++] = std::make_pair(itemVS, slot);

        player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
    }

    int64 cost = depositCount * VOID_STORAGE_STORE_ITEM;

    player->ModifyMoney(-cost);

    VoidStorageItem withdrawItems[VOID_STORAGE_MAX_WITHDRAW];
    uint8 withdrawCount = 0;
    for (std::vector<ObjectGuid>::iterator itr = itemIds.begin(); itr != itemIds.end(); ++itr)
    {
        uint8 slot;
        VoidStorageItem* itemVS = player->GetVoidStorageItem(*itr, slot);
        if (!itemVS)
            continue;

        ItemPosCountVec dest;
        InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemVS->ItemEntry, 1);
        if (msg != EQUIP_ERR_OK)
        {
            SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_INVENTORY_FULL);
            return;
        }

        Item* item = player->StoreNewItem(dest, itemVS->ItemEntry, true, itemVS->ItemRandomPropertyId);
        item->SetUInt64Value(ITEM_FIELD_CREATOR, uint64(itemVS->CreatorGuid));
        item->SetBinding(true);
        player->SendNewItem(item, 1, false, false, false);

        withdrawItems[withdrawCount++] = *itemVS;

        player->DeleteVoidStorageItem(slot);
    }

    WorldPacket data(SMSG_VOID_STORAGE_TRANSFER_CHANGES, ((5 + 5 + (7 + 7) * depositCount +
        7 * withdrawCount) / 8) + 7 * withdrawCount + (7 + 7 + 4 * 4) * depositCount);

    data.WriteBits(depositCount, 5);
    data.WriteBits(withdrawCount, 5);

    for (uint8 i = 0; i < depositCount; ++i)
    {
        ObjectGuid itemId = depositItems[i].first.ItemId;
        ObjectGuid creatorGuid = depositItems[i].first.CreatorGuid;
        data.WriteByteMask(creatorGuid[7]);
        data.WriteByteMask(itemId[7]);
        data.WriteByteMask(itemId[4]);
        data.WriteByteMask(creatorGuid[6]);
        data.WriteByteMask(creatorGuid[5]);
        data.WriteByteMask(itemId[3]);
        data.WriteByteMask(itemId[5]);
        data.WriteByteMask(creatorGuid[4]);
        data.WriteByteMask(creatorGuid[2]);
        data.WriteByteMask(creatorGuid[0]);
        data.WriteByteMask(creatorGuid[3]);
        data.WriteByteMask(creatorGuid[1]);
        data.WriteByteMask(itemId[2]);
        data.WriteByteMask(itemId[0]);
        data.WriteByteMask(itemId[1]);
        data.WriteByteMask(itemId[6]);
    }

    for (uint8 i = 0; i < withdrawCount; ++i)
    {
        ObjectGuid itemId = withdrawItems[i].ItemId;
        data.WriteByteMask(itemId[1]);
        data.WriteByteMask(itemId[7]);
        data.WriteByteMask(itemId[3]);
        data.WriteByteMask(itemId[5]);
        data.WriteByteMask(itemId[6]);
        data.WriteByteMask(itemId[2]);
        data.WriteByteMask(itemId[4]);
        data.WriteByteMask(itemId[0]);
    }

    for (uint8 i = 0; i < withdrawCount; ++i)
    {
        ObjectGuid itemId = withdrawItems[i].ItemId;
        data.WriteByteSeq(itemId[3]);
        data.WriteByteSeq(itemId[1]);
        data.WriteByteSeq(itemId[0]);
        data.WriteByteSeq(itemId[2]);
        data.WriteByteSeq(itemId[7]);
        data.WriteByteSeq(itemId[5]);
        data.WriteByteSeq(itemId[6]);
        data.WriteByteSeq(itemId[4]);
    }

    for (uint8 i = 0; i < depositCount; ++i)
    {
        ObjectGuid itemId = depositItems[i].first.ItemId;
        ObjectGuid creatorGuid = depositItems[i].first.CreatorGuid;

        data << uint32(depositItems[i].first.ItemSuffixFactor);

        data.WriteByteSeq(itemId[6]);
        data.WriteByteSeq(itemId[4]);
        data.WriteByteSeq(creatorGuid[4]);
        data.WriteByteSeq(itemId[2]);
        data.WriteByteSeq(creatorGuid[1]);
        data.WriteByteSeq(creatorGuid[3]);
        data.WriteByteSeq(itemId[3]);
        data.WriteByteSeq(creatorGuid[0]);
        data.WriteByteSeq(itemId[0]);
        data.WriteByteSeq(creatorGuid[6]);
        data.WriteByteSeq(itemId[5]);
        data.WriteByteSeq(creatorGuid[5]);
        data.WriteByteSeq(creatorGuid[7]);

        data << uint32(depositItems[i].first.ItemEntry);

        data.WriteByteSeq(itemId[1]);

        data << uint32(depositItems[i].second); // slot

        data.WriteByteSeq(creatorGuid[2]);
        data.WriteByteSeq(itemId[7]);

        data << uint32(depositItems[i].first.ItemRandomPropertyId);
    }

    SendPacket(&data);

    SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_NO_ERROR);
}
void SubSurfaceOutsideBoundaryConditionObjectVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  if (index == OS_SubSurfaceFields::OutsideBoundaryConditionObject){
    emit itemIds(makeVector());
  }
}
void SubSurfaceConstructionVectorController::onDataChange(const model::ModelObject& modelObject)
{
  if (m_modelObject && (modelObject.handle() == m_modelObject->handle())){
    emit itemIds(makeVector());
  }
}
Пример #15
0
void WorldSession::HandleVoidStorageTransfer(WorldPacket& recvData)
{
SF_LOG_DEBUG("network", "WORLD: Received CMSG_VOID_STORAGE_TRANSFER");
    Player* player = GetPlayer();

    ObjectGuid npcGuid;
    recvData.ReadGuidMask(npcGuid, 7, 4);

    uint32 countDeposit = recvData.ReadBits(24); //40

    if (countDeposit > 9)
    {
        SF_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - Player (GUID: %u, name: %s) wants to deposit more than 9 items (%u).", player->GetGUIDLow(), player->GetName().c_str(), countDeposit);
        return;
    }

    std::vector<ObjectGuid> itemGuids(countDeposit);
    for (uint32 i = 0; i < countDeposit; ++i)
    {
        recvData.ReadGuidMask(itemGuids[i], 0, 3, 6, 5, 4, 2, 1, 7);
    }

    uint32 countWithdraw = recvData.ReadBits(24);

    if (countWithdraw > 9)
    {
        SF_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - Player (GUID: %u, name: %s) wants to withdraw more than 9 items (%u).", player->GetGUIDLow(), player->GetName().c_str(), countWithdraw);
        return;
    }

    std::vector<ObjectGuid> itemIds(countWithdraw);
    for (uint32 i = 0; i < countWithdraw; ++i)
    {
        recvData.ReadGuidMask(itemIds[i], 4, 0, 5, 7, 6, 1, 2, 3);
    }

    recvData.ReadGuidMask(npcGuid, 6, 0, 3, 1, 2, 5);

    for (uint32 i = 0; i < countDeposit; ++i)
    {
        recvData.ReadGuidBytes(itemGuids[i], 5, 6, 3, 4, 1, 7, 2, 0);
    }

    recvData.ReadGuidBytes(npcGuid, 5);

    for (uint32 i = 0; i < countWithdraw; ++i)
    {
        recvData.ReadGuidBytes(itemIds[i], 0, 4, 1, 2, 6, 3, 7, 5);
    }

    recvData.ReadGuidBytes(npcGuid, 1, 7, 4, 3, 2, 0, 6);

    Creature* unit = player->GetNPCIfCanInteractWith(npcGuid, UNIT_NPC_FLAG_VAULTKEEPER);
    if (!unit)
    {
        SF_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - Unit (GUID: %u) not found or player can't interact with it.", GUID_LOPART(npcGuid));
        return;
    }

    if (!player->IsVoidStorageUnlocked())
    {
        SF_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - Player (GUID: %u, name: %s) queried void storage without unlocking it.", player->GetGUIDLow(), player->GetName().c_str());
        return;
    }

    if (itemGuids.size() > player->GetNumOfVoidStorageFreeSlots())
    {
        SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_FULL);
        return;
    }

    uint32 freeBagSlots = 0;
    if (itemIds.size() != 0)
    {
        // make this a Player function
        for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
            if (Bag* bag = player->GetBagByPos(i))
                freeBagSlots += bag->GetFreeSlots();
        for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++)
            if (!player->GetItemByPos(INVENTORY_SLOT_BAG_0, i))
                ++freeBagSlots;
    }

    if (itemIds.size() > freeBagSlots)
    {
        SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_INVENTORY_FULL);
        return;
    }

    if (!player->HasEnoughMoney(uint64(itemGuids.size() * VOID_STORAGE_STORE_ITEM)))
    {
        SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_NOT_ENOUGH_MONEY);
        return;
    }

    std::pair<VoidStorageItem, uint8> depositItems[VOID_STORAGE_MAX_DEPOSIT];
    uint8 depositCount = 0;
    for (std::vector<ObjectGuid>::iterator itr = itemGuids.begin(); itr != itemGuids.end(); ++itr)
    {
        Item* item = player->GetItemByGuid(*itr);
        if (!item)
        {
            SF_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - Player (GUID: %u, name: %s) wants to deposit an invalid item (item guid: " UI64FMTD ").", player->GetGUIDLow(), player->GetName().c_str(), uint64(*itr));
            continue;
        }

        VoidStorageItem itemVS(sObjectMgr->GenerateVoidStorageItemId(), item->GetEntry(), item->GetUInt64Value(ITEM_FIELD_CREATOR), item->GetItemRandomPropertyId(), item->GetItemSuffixFactor());

        uint8 slot = player->AddVoidStorageItem(itemVS);

        depositItems[depositCount++] = std::make_pair(itemVS, slot);

        player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
    }

    int64 cost = depositCount * VOID_STORAGE_STORE_ITEM;

    player->ModifyMoney(-cost);

    VoidStorageItem withdrawItems[VOID_STORAGE_MAX_WITHDRAW];
    uint8 withdrawCount = 0;
    for (std::vector<ObjectGuid>::iterator itr = itemIds.begin(); itr != itemIds.end(); ++itr)
    {
        uint8 slot;
        VoidStorageItem* itemVS = player->GetVoidStorageItem(*itr, slot);
        if (!itemVS)
        {
            SF_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - Player (GUID: %u, name: %s) tried to withdraw an invalid item (id: " UI64FMTD ")", player->GetGUIDLow(), player->GetName().c_str(), uint64(*itr));
            continue;
        }

        ItemPosCountVec dest;
        InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemVS->ItemEntry, 1);
        if (msg != EQUIP_ERR_OK)
        {
            SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_INVENTORY_FULL);
            SF_LOG_DEBUG("network", "WORLD: HandleVoidStorageTransfer - Player (GUID: %u, name: %s) couldn't withdraw item id " UI64FMTD " because inventory was full.", player->GetGUIDLow(), player->GetName().c_str(), uint64(*itr));
            return;
        }

        Item* item = player->StoreNewItem(dest, itemVS->ItemEntry, true, itemVS->ItemRandomPropertyId);
        item->SetUInt64Value(ITEM_FIELD_CREATOR, uint64(itemVS->CreatorGuid));
        item->SetBinding(true);
        player->SendNewItem(item, 1, false, false, false);

        withdrawItems[withdrawCount++] = *itemVS;

        player->DeleteVoidStorageItem(slot);
    }

    WorldPacket data(SMSG_VOID_STORAGE_TRANSFER_CHANGES, ((5 + 5 + (7 + 7) * depositCount +
        7 * withdrawCount) / 8) + 7 * withdrawCount + (7 + 7 + 4 * 4) * depositCount);

    data.WriteBits(withdrawCount, 4);

    for (uint8 i = 0; i < withdrawCount; ++i)
    {
        ObjectGuid itemId = withdrawItems[i].ItemId;
        data.WriteGuidMask(itemId, 1, 6, 7, 3, 2, 0, 4, 5);
    }

    data.WriteBits(depositCount, 4);

    for (uint8 i = 0; i < depositCount; ++i)
    {
        ObjectGuid itemId = depositItems[i].first.ItemId;
        ObjectGuid creatorGuid = depositItems[i].first.CreatorGuid;
        data.WriteGuidMask(itemId, 0);
        data.WriteGuidMask(creatorGuid, 6, 4);
        data.WriteGuidMask(itemId, 3);
        data.WriteGuidMask(creatorGuid, 3);
        data.WriteGuidMask(itemId, 5, 7);
        data.WriteGuidMask(creatorGuid, 0, 5, 7);
        data.WriteGuidMask(itemId, 6, 4);
        data.WriteGuidMask(creatorGuid, 1);
        data.WriteGuidMask(itemId, 1);
        data.WriteGuidMask(creatorGuid, 2);
    }

    data.FlushBits();

    for (uint8 i = 0; i < depositCount; ++i)
    {
        ObjectGuid itemId = depositItems[i].first.ItemId;
        ObjectGuid creatorGuid = depositItems[i].first.CreatorGuid;
        data << uint32(depositItems[i].second); // slot
        data.WriteGuidBytes(creatorGuid, 5);
        data << uint32(depositItems[i].first.ItemEntry);
        data.WriteGuidBytes(creatorGuid, 6, 3);
        data << uint32(depositItems[i].first.ItemSuffixFactor);
        data.WriteGuidBytes(creatorGuid, 2);
        data.WriteGuidBytes(itemId, 5);
        data << uint32(depositItems[i].first.ItemRandomPropertyId);
        data.WriteGuidBytes(itemId, 3);
        data.WriteGuidBytes(creatorGuid, 7, 4, 1);
        data.WriteGuidBytes(itemId, 0, 4, 6);
        data << uint32(0); // unk
        data.WriteGuidBytes(itemId, 1, 2);
        data.WriteGuidBytes(creatorGuid, 0);
        data.WriteGuidBytes(itemId, 7);
    }

    for (uint8 i = 0; i < withdrawCount; ++i)
    {
        ObjectGuid itemId = withdrawItems[i].ItemId;

        data.WriteGuidBytes(itemId, 7, 3, 1, 5, 4, 0, 6, 2);
    }
    SendPacket(&data);

    SendVoidStorageTransferResult(VOID_TRANSFER_ERROR_NO_ERROR);
}
void HotWaterEquipmentScheduleVC::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  if (index == OS_DefaultScheduleSetFields::HotWaterEquipmentScheduleName){
    emit itemIds(makeVector());
  }
}
Пример #17
0
void OSVectorController::reportItems()
{
  emit itemIds(this->makeVector());
}
Пример #18
0
void SpaceThermalZoneVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
    if (index == OS_SpaceFields::ThermalZoneName) {
        emit itemIds(makeVector());
    }
}
Пример #19
0
void SpaceDefaultConstructionSetVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
    if (index == OS_SpaceFields::DefaultConstructionSetName) {
        emit itemIds(makeVector());
    }
}
void NumberOfPeopleVC::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  if (index == OS_DefaultScheduleSetFields::NumberofPeopleScheduleName){
    emit itemIds(makeVector());
  }
}
void BuildingStorySpacesVectorController::onObjectRemoved(const openstudio::model::ModelObject& modelObject, const openstudio::IddObjectType& iddObjectType, const openstudio::UUID& handle)
{
  if (modelObject.optionalCast<model::Space>()){
    emit itemIds(makeVector());
  }
}
void TargetTemperatureScheduleVC::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  if (index == OS_WaterUse_Equipment_DefinitionFields::TargetTemperatureScheduleName){
    emit itemIds(makeVector());
  }
}
void SubSurfaceConstructionVectorController::onChangeRelationship(const model::ModelObject& modelObject, int index, Handle newHandle, Handle oldHandle)
{
  model::SubSurface subSurface = m_modelObject->cast<model::SubSurface>();

  if (modelObject.optionalCast<model::SubSurface>()){
    if (index == OS_SubSurfaceFields::ConstructionName){
      emit itemIds(makeVector());
    }else if (index == OS_SubSurfaceFields::SurfaceName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::Surface>()){
    if (index == OS_SurfaceFields::SpaceName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::Space>()){
    if (index == OS_SpaceFields::SpaceTypeName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }else if (index == OS_SpaceFields::BuildingStoryName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }else if (index == OS_SpaceFields::DefaultConstructionSetName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::SpaceType>()){
    if (index == OS_SpaceTypeFields::DefaultConstructionSetName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::Building>()){
    if (index == OS_BuildingFields::DefaultConstructionSetName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }else if (index == OS_BuildingFields::SpaceTypeName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::BuildingStory>()){
    if (index == OS_BuildingStoryFields::DefaultConstructionSetName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::DefaultConstructionSet>()){
    if (index == OS_DefaultConstructionSetFields::DefaultExteriorSubSurfaceConstructionsName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }else if (index == OS_DefaultConstructionSetFields::DefaultInteriorSubSurfaceConstructionsName){
      detachOtherModelObjects();
      attachOtherModelObjects(subSurface);
      emit itemIds(makeVector());
    }
  }else if (modelObject.optionalCast<model::DefaultSubSurfaceConstructions>()){
    emit itemIds(makeVector());
  }
}