当前位置: 首页>>代码示例>>C++>>正文


C++ DungeonMap类代码示例

本文整理汇总了C++中DungeonMap的典型用法代码示例。如果您正苦于以下问题:C++ DungeonMap类的具体用法?C++ DungeonMap怎么用?C++ DungeonMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DungeonMap类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MANGOS_ASSERT

DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, Difficulty difficulty, DungeonPersistentState* save)
{
    // make sure we have a valid map id
    if (!sMapStore.LookupEntry(id))
    {
        sLog.outError("CreateDungeonMap: no entry for map %d", id);
        MANGOS_ASSERT(false);
    }
    if (!ObjectMgr::GetInstanceTemplate(id))
    {
        sLog.outError("CreateDungeonMap: no instance template for map %d", id);
        MANGOS_ASSERT(false);
    }

    // some instances only have one difficulty
    if (!GetMapDifficultyData(id, difficulty))
        difficulty = DUNGEON_DIFFICULTY_NORMAL;

    DEBUG_LOG("MapInstanced::CreateDungeonMap: %s map instance %d for %d created with difficulty %d", save ? "" : "new ", InstanceId, id, difficulty);

    DungeonMap* map = new DungeonMap(id, i_gridCleanUpDelay, InstanceId, difficulty);

    // Dungeons can have saved instance data
    bool load_data = save != nullptr;
    map->CreateInstanceData(load_data);

    return map;
}
开发者ID:ElunaLuaEngine,项目名称:ElunaMangosWotlk,代码行数:28,代码来源:MapManager.cpp

示例2: MANGOS_ASSERT

DungeonMap* MapManager::CreateDungeonMap(uint32 id, uint32 InstanceId, DungeonPersistentState *save)
{
    // make sure we have a valid map id
    const MapEntry* entry = sMapStore.LookupEntry(id);
    if (!entry)
    {
        sLog.outError("CreateDungeonMap: no entry for map %d", id);
        MANGOS_ASSERT(false);
    }
    if (!ObjectMgr::GetInstanceTemplate(id))
    {
        sLog.outError("CreateDungeonMap: no instance template for map %d", id);
        MANGOS_ASSERT(false);
    }

    DEBUG_LOG("MapInstanced::CreateInstanceMap: %s map instance %d for %d created", save?"":"new ", InstanceId, id);

    DungeonMap *map = new DungeonMap(id, i_gridCleanUpDelay, InstanceId);

    // Dungeons can have saved instance data
    bool load_data = save != NULL;
    map->CreateInstanceData(load_data);

    return map;
}
开发者ID:yyhhrr,项目名称:mangospriv,代码行数:25,代码来源:MapManager.cpp

示例3: GetDifficulty

void DungeonPersistentState::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Player* player)
{
    DungeonEncounterList const* encounterList = sObjectMgr.GetDungeonEncounterList(GetMapId(), GetDifficulty());

    if (!encounterList)
        return;

    for (DungeonEncounterList::const_iterator itr = encounterList->begin(); itr != encounterList->end(); ++itr)
    {
        if ((*itr)->creditType == type && (*itr)->creditEntry == creditEntry)
        {
            uint32 oldMask = m_completedEncountersMask;
            m_completedEncountersMask |= 1 << (*itr)->dbcEntry->encounterIndex;
            if ( m_completedEncountersMask != oldMask)
            {
                CharacterDatabase.PExecute("UPDATE instance SET encountersMask = '%u' WHERE id = '%u'", m_completedEncountersMask, GetInstanceId());

                DEBUG_LOG("DungeonPersistentState: Dungeon %s (Id %u) completed encounter %s", GetMap()->GetMapName(), GetInstanceId(), (*itr)->dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);

                if (uint32 dungeonId = (*itr)->lastEncounterDungeon)
                {
                    DEBUG_LOG("DungeonPersistentState:: Dungeon %s (Id %u) completed last encounter %s", GetMap()->GetMapName(), GetInstanceId(), (*itr)->dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);
                    // Place LFG reward there!
                }

                DungeonMap* dungeon = (DungeonMap*)GetMap();

                if (dungeon && player)
                    dungeon->PermBindAllPlayers(player, dungeon->IsRaidOrHeroicDungeon());
                SaveToDB();
            }
            return;
        }
    }
}
开发者ID:GlassFace,项目名称:core-1,代码行数:35,代码来源:MapPersistentStateMgr.cpp

示例4: GetInstanceId

void DungeonPersistentState::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry)
{
    DungeonEncounterMapBounds bounds = sObjectMgr.GetDungeonEncounterBounds(creditEntry);

    for (DungeonEncounterMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
    {
        DungeonEncounterEntry const* dbcEntry = itr->second->dbcEntry;

        if (itr->second->creditType == type && dbcEntry->Difficulty == GetDifficulty() && dbcEntry->mapId == GetMapId())
        {
            uint32 oldMask = m_completedEncountersMask;
            m_completedEncountersMask |= 1 << dbcEntry->encounterIndex;

            if ( m_completedEncountersMask != oldMask)
            {
                CharacterDatabase.PExecute("UPDATE instance SET encountersMask = '%u' WHERE id = '%u'", m_completedEncountersMask, GetInstanceId());

                DEBUG_LOG("DungeonPersistentState: Dungeon %s (Id %u) completed encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);

                uint32 dungeonId = itr->second->lastEncounterDungeon;

                if (dungeonId)
                    DEBUG_LOG("DungeonPersistentState:: Dungeon %s (Id %u) completed last encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);

                DungeonMap* dungeon = (DungeonMap*)GetMap();

                if (!dungeon || dungeon->GetPlayers().isEmpty())
                    return;

                Player* player = dungeon->GetPlayers().begin()->getSource();

                if (dungeon && player)
                    dungeon->PermBindAllPlayers(player, dungeon->IsRaidOrHeroicDungeon());

                SaveToDB();

                if (dungeon && player->GetGroup() && player->GetGroup()->isLFGGroup())
                {
                    sLFGMgr.DungeonEncounterReached(player->GetGroup());

                    if ((sWorld.getConfig(CONFIG_BOOL_LFG_ONLYLASTENCOUNTER) && dungeonId)
                            || IsCompleted())
                        sLFGMgr.SendLFGRewards(player->GetGroup());
                }
            }
            return;
        }
    }
}
开发者ID:,项目名称:,代码行数:49,代码来源:

示例5: SendSpecialEncounterState

void DungeonPersistentState::SendSpecialEncounterState(ObjectGuid guid)
{
    // Possible need move this method to DungeonMap class
    DungeonMap* dungeon = (DungeonMap*)GetMap();
    if (!dungeon || guid.IsEmpty())
        return;

    SpecialEncountersMap::iterator itr = m_specialEncountersMap.find(guid);

    if (itr == m_specialEncountersMap.end())
        return;

    SpecialEncounterState* state = &itr->second;

    if (!state || state->lastCommand >= ENCOUNTER_FRAME_MAX)
        return;

    // size of this packet is at most 15 (usually less)
    WorldPacket data(SMSG_INSTANCE_ENCOUNTER, 15);

    data << uint32(state->lastCommand);

    switch (state->lastCommand)
    {
        case ENCOUNTER_FRAME_ENGAGE:
        case ENCOUNTER_FRAME_DISENGAGE:
        case ENCOUNTER_FRAME_UPDATE_PRIORITY:
            data << state->guid.WriteAsPacked();
            data << uint8(state->data1);
            break;
        case ENCOUNTER_FRAME_ADD_TIMER:
        case ENCOUNTER_FRAME_ENABLE_OBJECTIVE:
        case ENCOUNTER_FRAME_DISABLE_OBJECTIVE:
            data << uint8(state->data1);
            break;
        case ENCOUNTER_FRAME_UPDATE_OBJECTIVE:
            data << uint8(state->data1);
            data << uint8(state->data2);
            break;
        case ENCOUNTER_FRAME_UNK7:
        default:
            break;
    }

    dungeon->SendToPlayers(&data);
}
开发者ID:klyxmaster,项目名称:mangos,代码行数:46,代码来源:MapPersistentStateMgr.cpp

示例6: getCurrentTile

void ZombieDarkEntity::findNextRandomGoal()
{
  currentTile = getCurrentTile();

  DungeonMap* dMap = game().getCurrentMap();

  int backDirection = 0;
  switch (currentDirection)
  {
    case 4: backDirection = 6; break;
    case 6: backDirection = 4; break;
    case 2: backDirection = 8; break;
    case 8: backDirection = 2; break;
    default: break;
  }

  bool ok = false;
  {
    int r = 0;
    while (!ok)
    {
      r++;
      if (r == 150) // watchdog
        ok = true;
      else if (r == 40)
      {
        backDirection = 5;
      }

      int newDir = rand() % 4;
      if (newDir == 0)
      {
        if (backDirection != 4 && currentTile.x > 1 && (currentTile.y % 2 != 0) && dMap->isWalkable(currentTile.x - 1, currentTile.y))
        {
          currentDirection = 4;
          targetTile = IntCoord(currentTile.x - 1, currentTile.y);
          ok = true;
        }
      }
      else if (newDir == 1)
      {
        if (backDirection != 6 && currentTile.x < MAP_WIDTH - 2 && (currentTile.y % 2 != 0) && dMap->isWalkable(currentTile.x + 1, currentTile.y))
        {
          currentDirection = 6;
          targetTile = IntCoord(currentTile.x + 1, currentTile.y);
          ok = true;
        }
      }
      else if (newDir == 2)
      {
        if (backDirection != 8 && currentTile.y > 1 && (currentTile.x % 2 != 0) && dMap->isWalkable(currentTile.x, currentTile.y - 1))
        {
          currentDirection = 8;
          targetTile = IntCoord(currentTile.x, currentTile.y - 1);
          ok = true;
        }
      }
      else
      {
        if (backDirection != 2 && currentTile.y < MAP_HEIGHT - 2 && (currentTile.x % 2 != 0) && dMap->isWalkable(currentTile.x, currentTile.y + 1))
        {
          currentDirection = 2;
          targetTile = IntCoord(currentTile.x, currentTile.y + 1);
          ok = true;
        }
      }
    }
  }

  switch (currentDirection)
  {
    case 4: velocity.x = - creatureSpeed; velocity.y = 0.0f; break;
    case 6: velocity.x = + creatureSpeed; velocity.y = 0.0f; break;
    case 2: velocity.y = + creatureSpeed; velocity.x = 0.0f; break;
    case 8: velocity.y = - creatureSpeed; velocity.x = 0.0f; break;
    default: break;
  }

  nextFacingDirection = currentDirection;
}
开发者ID:Cirrus-Minor,项目名称:witchblast,代码行数:80,代码来源:ZombieDarkEntity.cpp

示例7: main

int main()
{
    DungeonMap dm;
    dm.printMap();
    return 0;
}
开发者ID:Shalmezad,项目名称:DungeonMaker,代码行数:6,代码来源:main.cpp


注:本文中的DungeonMap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。