當前位置: 首頁>>代碼示例>>C++>>正文


C++ Difficulty函數代碼示例

本文整理匯總了C++中Difficulty函數的典型用法代碼示例。如果您正苦於以下問題:C++ Difficulty函數的具體用法?C++ Difficulty怎麽用?C++ Difficulty使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Difficulty函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: CreatureAI

ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature),
    me(pCreature),
    IsFleeing(false),
    m_bCombatMovement(true),
    m_uiEvadeCheckCooldown(2500)
{
    m_heroicMode = me->GetMap()->IsHeroic();
    m_difficulty = Difficulty(me->GetMap()->GetSpawnMode());
}
開發者ID:AwkwardDev,項目名稱:StrawberryCore,代碼行數:9,代碼來源:ScriptedCreature.cpp

示例2: CreatureAI

ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature),
    me(pCreature),
    IsFleeing(false),
    _evadeCheckCooldown(2500),
    _isCombatMovementAllowed(true)
{
    _isHeroic = me->GetMap()->IsHeroic();
    _difficulty = Difficulty(me->GetMap()->GetSpawnMode());
}
開發者ID:Akenyshka,項目名稱:MythCore,代碼行數:9,代碼來源:ScriptedCreature.cpp

示例3: SetDifficulties

void DifficultyDisplay::SetDifficulties( const Song* pSong, StepsType curType )
{
	for( int diff = DIFFICULTY_BEGINNER; diff <= DIFFICULTY_CHALLENGE; ++diff )
	{
		if( pSong->HasStepsTypeAndDifficulty( curType, Difficulty(diff) ) )
			m_difficulty[diff].Command( ICONONCOMMAND );
		else
			m_difficulty[diff].Command( ICONOFFCOMMAND );
	}
}
開發者ID:Fighter19,項目名稱:PSPMania,代碼行數:10,代碼來源:DifficultyDisplay.cpp

示例4: HandleInstanceUnbindSelfCommand

    static bool HandleInstanceUnbindSelfCommand(ChatHandler* handler, char const* args)
    {
        if (!*args)
            return false;

        Player* player = handler->GetSession()->GetPlayer();

        char* pMap = strtok((char*)args, " ");
        char* pDiff = strtok(NULL, " ");
        int8 diff = -1;
        if (pDiff)
            diff = atoi(pDiff);
        uint16 counter = 0;
        uint16 MapId = 0;

        if (strcmp(pMap, "all"))
        {
            MapId = uint16(atoi(pMap));
            if (!MapId)
                return false;
        }

        for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
        {
            Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
            for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
            {
                InstanceSave *save = itr->second.save;
                if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
                {
                    std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
                    handler->PSendSysMessage("unbinding map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
                    player->UnbindInstance(itr, Difficulty(i));
                    counter++;
                }
                else
                    ++itr;
            }
        }
        handler->PSendSysMessage("instances unbound: %d", counter);
        return true;
    }
開發者ID:redlaine,項目名稱:TrinityCore,代碼行數:42,代碼來源:cs_instance.cpp

示例5: CheckAchievementCriteriaMeet

 bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0)
 {
     switch(criteria_id)
     {
         case 12564:  // Criteria for achievement 4402: More Dots! (10 player) 5min kill
             if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (uiOnyxiaKillTimer > 0))
                 return true;
             return false;
         case 12565:  // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s
             if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (bAchievManyWhelpsHandleIt))
                 return true;
             return false;
         case 12566:  // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath
             if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (bAchievSheDeepBreathMore))
                 return true;
             return false;
         case 12567:  // Criteria for achievement 4405: More Dots! (25 player) 5min kill
             if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (uiOnyxiaKillTimer > 0))
                 return true;
             return false;
         case 12568:  // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s
             if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (bAchievManyWhelpsHandleIt))
                 return true;
             return false;
         case 12569:  // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath
             if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (bAchievSheDeepBreathMore))
                 return true;
             return false;
     }
     return false;
 }
開發者ID:Asandru,項目名稱:Script-Land,代碼行數:31,代碼來源:instance_onyxias_lair.cpp

示例6: HandleInstanceListBindsCommand

    static bool HandleInstanceListBindsCommand(ChatHandler* handler, char const* /*args*/)
    {
        Player* player = handler->getSelectedPlayer();
        if (!player)
            player = handler->GetSession()->GetPlayer();

        uint32 counter = 0;
        for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
        {
            Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
            for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
            {
                InstanceSave* save = itr->second.save;
                std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
                handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no",  save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
                counter++;
            }
        }
        handler->PSendSysMessage("player binds: %d", counter);

        counter = 0;
        if (Group* group = player->GetGroup())
        {
            for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
            {
                Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i));
                for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
                {
                    InstanceSave* save = itr->second.save;
                    std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL));
                    handler->PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no",  save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
                    counter++;
                }
            }
        }
        handler->PSendSysMessage("group binds: %d", counter);

        return true;
    }
開發者ID:AtVirus,項目名稱:SkyFireEMU,代碼行數:39,代碼來源:cs_instance.cpp

示例7: GetDownscaledMapDifficultyData

MapDifficultyEntry const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
{
    DifficultyEntry const* diffEntry = sDifficultyStore.LookupEntry(difficulty);
    if (!diffEntry)
        return GetDefaultMapDifficulty(mapId, &difficulty);

    uint32 tmpDiff = difficulty;
    MapDifficultyEntry const* mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff));
    while (!mapDiff)
    {
        tmpDiff = diffEntry->FallbackDifficultyID;
        diffEntry = sDifficultyStore.LookupEntry(tmpDiff);
        if (!diffEntry)
            return GetDefaultMapDifficulty(mapId, &difficulty);

        // pull new data
        mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); // we are 10 normal or 25 normal
    }

    difficulty = Difficulty(tmpDiff);
    return mapDiff;
}
開發者ID:gearsofdeath,項目名稱:DeathCore_6.x-1,代碼行數:22,代碼來源:DBCStores.cpp

示例8: ObjectGuid

bool Group::LoadGroupFromDB(Field* fields)
{
    //                                          0         1              2           3           4              5      6      7      8      9      10     11     12     13         14          15              16          17
    // result = CharacterDatabase.Query("SELECT mainTank, mainAssistant, lootMethod, looterGuid, lootThreshold, icon1, icon2, icon3, icon4, icon5, icon6, icon7, icon8, groupType, difficulty, raiddifficulty, leaderGuid, groupId FROM groups");

    m_Id = fields[17].GetUInt32();
    m_leaderGuid = ObjectGuid(HIGHGUID_PLAYER, fields[16].GetUInt32());

    // group leader not exist
    if (!sObjectMgr.GetPlayerNameByGUID(m_leaderGuid, m_leaderName))
        return false;

    m_groupType  = GroupType(fields[13].GetUInt8());

    if (m_groupType & GROUPTYPE_RAID)
        _initRaidSubGroupsCounter();

    uint32 diff = fields[14].GetUInt8();
    if (diff >= MAX_DUNGEON_DIFFICULTY)
        diff = DUNGEON_DIFFICULTY_NORMAL;
    m_dungeonDifficulty = Difficulty(diff);

    uint32 r_diff = fields[15].GetUInt8();
    if (r_diff >= MAX_RAID_DIFFICULTY)
        r_diff = RAID_DIFFICULTY_10MAN_NORMAL;
    m_raidDifficulty = Difficulty(r_diff);

    m_mainTankGuid = ObjectGuid(HIGHGUID_PLAYER, fields[0].GetUInt32());
    m_mainAssistantGuid = ObjectGuid(HIGHGUID_PLAYER, fields[1].GetUInt32());
    m_lootMethod = LootMethod(fields[2].GetUInt8());
    m_masterLooterGuid = ObjectGuid(HIGHGUID_PLAYER, fields[3].GetUInt32());
    m_lootThreshold = ItemQualities(fields[4].GetUInt16());

    for (int i = 0; i < TARGET_ICON_COUNT; ++i)
        m_targetIcons[i] = ObjectGuid(fields[5 + i].GetUInt64());

    m_currentLooterGuid = m_masterLooterGuid;
    return true;
}
開發者ID:HerrTrigger,項目名稱:mangos-wotlk,代碼行數:39,代碼來源:Group.cpp

示例9: CheckAchievementCriteriaMeet

 bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target = NULL*/, uint32 /*miscvalue1 = 0*/)
 {
     switch (criteria_id)
     {
         case 7600:  // Criteria for achievement 2176: And They Would All Go Down Together 15sec of each other 10-man
             if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15)
                 return true;
             return false;
         case 7601:  // Criteria for achievement 2177: And They Would All Go Down Together 15sec of each other 25-man
             if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15)
                 return true;
             return false;
         // Difficulty checks are done on DB.
         // Criteria for achievement 2186: The Immortal (25-man)
         case 13233: // The Four Horsemen
         case 13234: // Maexxna
         case 13235: // Thaddius
         case 13236: // Loatheb
         case 7616:  // Kel'Thuzad
         // Criteria for achievement 2187: The Undying (10-man)
         case 13237: // The Four Horsemen
         case 13238: // Maexxna
         case 13239: // Loatheb
         case 13240: // Thaddius
         case 7617:  // Kel'Thuzad
             if (AreAllEncoutersDone() && !playerDied)
                 return true;
             return false;
         // Criteria for achievement 2178: Shocking! (10-man)
         case 7604:
         // Criteria for achievement 2179: Shocking! (25-man)
         case 7605:
             if (!PolaritySwitch)
                 return true;
             return false;
     }
     return false;
 }
開發者ID:lijinglue,項目名稱:TrinityCore,代碼行數:38,代碼來源:instance_naxxramas.cpp

示例10: GetDownscaledMapDifficultyData

MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &difficulty)
{
    uint32 tmpDiff = difficulty;
    MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff));
    if (!mapDiff)
    {
        if (tmpDiff > RAID_DIFFICULTY_25MAN_NORMAL) // heroic, downscale to normal
            tmpDiff -= 2;
        else
            tmpDiff -= 1;   // any non-normal mode for raids like tbc (only one mode)

        // pull new data
        mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); // we are 10 normal or 25 normal
        if (!mapDiff)
        {
            tmpDiff -= 1;
            mapDiff = GetMapDifficultyData(mapId, Difficulty(tmpDiff)); // 10 normal
        }
    }

    difficulty = Difficulty(tmpDiff);
    return mapDiff;
}
開發者ID:lasyan3,項目名稱:TrinityCore,代碼行數:23,代碼來源:DBCStores.cpp

示例11: OnUse

	bool OnUse(Player* pPlayer, Item* pItem, SpellCastTargets const& scTargets)
	{
			
			if (pPlayer->HasItemCount(pItem->GetEntry(), 1))
			pPlayer->DestroyItemCount(pItem->GetEntry(), 1, true);

			for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
			{
				Player::BoundInstancesMap &binds = pPlayer->GetBoundInstances(Difficulty(i));
				for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
				{
					InstanceSave* save = itr->second.save;
					if (itr->first != pPlayer->GetMapId())
					{
						pPlayer->UnbindInstance(itr, Difficulty(i));
					}
					else
						++itr;
				}
			}
			pPlayer->Say("시간을 지배하는 자!",LANG_UNIVERSAL);
		return true;
	}
開發者ID:Kimbanjang,項目名稱:Mong2Core,代碼行數:23,代碼來源:Mong2_Master_Book.cpp

示例12: GetLFGDungeon

/// Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple dungeons use the same map (such as Scarlet Monastery)
LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty)
{
    for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
    {
        LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
        if (!dungeon)
            continue;

        if (dungeon->map == int32(mapId) && Difficulty(dungeon->difficulty) == difficulty)
            return dungeon;
    }

    return nullptr;
}
開發者ID:lasyan3,項目名稱:TrinityCore,代碼行數:15,代碼來源:DBCStores.cpp

示例13: Difficulty

void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
{
    uint32 mapId, difficulty;
    uint8 toggleExtend;
    recvData >> mapId >> difficulty >> toggleExtend;
    sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_SET_SAVED_INSTANCE_EXTEND - MapId: %u, Difficulty: %u, ToggleExtend: %s", mapId, difficulty, toggleExtend ? "On" : "Off");

    InstancePlayerBind* instanceBind = _player->GetBoundInstance(mapId, Difficulty(difficulty));
    if (!instanceBind || !instanceBind->save)
        return;

    InstanceSave* save = instanceBind->save;
    // http://www.wowwiki.com/Instance_Lock_Extension
    // SendCalendarRaidLockoutUpdated(save);
}
開發者ID:Lbniese,項目名稱:WoWCircle434,代碼行數:15,代碼來源:CalendarHandler.cpp

示例14: OnGossipSelect

	bool OnGossipSelect(Player *player, Creature *creature, uint32 sender, uint32 uiAction)
	{
		int8 diff = -1;
		uint16 MapId = 0;

		if (sender == GOSSIP_SENDER_MAIN)
		{
			player->PlayerTalkClass->ClearMenus();
			switch(uiAction)
			{
			case 1:// [Reset Cooldowns]
				player->RemoveAllSpellCooldown();
				creature->MonsterWhisper("Your cooldowns were cleaned!", player->GetGUID());
				player->CLOSE_GOSSIP_MENU();
				break;

			case 2:// [Reset Instances]
				for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
				{
					Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i));
					for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();)
					{
						player->UnbindInstance(itr, Difficulty(i));
					}
				}
				creature->MonsterWhisper("Your instances were cleaned!", player->GetGUID());
				player->CLOSE_GOSSIP_MENU();
				break;

			case 3:// Close Window
				player->CLOSE_GOSSIP_MENU();
				break; 
			}
		}
		return true;
	}
開發者ID:Finest,項目名稱:MMOCoreEvo,代碼行數:36,代碼來源:npc_reset_cooldown_instance.cpp

示例15: HandleInstanceUnbindCommand

    static bool HandleInstanceUnbindCommand(ChatHandler* handler, char const* args)
    {
        if (!*args)
            return false;

        Player* player = handler->getSelectedPlayer();
        if (!player)
            player = handler->GetSession()->GetPlayer();

        char* map = strtok((char*)args, " ");
        char* pDiff = strtok(NULL, " ");
        int8 diff = -1;
        if (pDiff)
            diff = atoi(pDiff);
        uint16 counter = 0;
        uint16 MapId = 0;

        if (strcmp(map, "all"))
        {
            MapId = uint16(atoi(map));
            if (!MapId)
                return false;
        }

        for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
        {
            BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(player->GetGUIDLow(), Difficulty(i));
            for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end();)
            {
                InstanceSave* save = itr->second.save;
                if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
                {
					uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
					uint32 ttr = (resetTime >= time(NULL) ? resetTime - time(NULL) : 0);
                    std::string timeleft = GetTimeString(ttr);
                    handler->PSendSysMessage("unbinding map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
					sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player);
					itr = m_boundInstances.begin();
                    counter++;
                }
                else
                    ++itr;
            }
        }
        handler->PSendSysMessage("instances unbound: %d", counter);

        return true;
    }
開發者ID:Cryostorm,項目名稱:SunwellCore,代碼行數:48,代碼來源:cs_instance.cpp


注:本文中的Difficulty函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。