您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetDifficulty函数代码示例

51自学网 2021-06-01 21:06:38
  C++
这篇教程C++ GetDifficulty函数代码示例写得很实用,希望能帮到您。

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

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

示例1: UpdateEncounterState

void DungeonPersistentState::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry){    DungeonEncounterMapBounds bounds = sObjectMgr.GetDungeonEncounterBounds(creditEntry);    for (DungeonEncounterMap::const_iterator iter = bounds.first; iter != bounds.second; ++iter)    {        DungeonEncounterEntry const* dbcEntry = iter->second->dbcEntry;        if (iter->second->creditType == type && Difficulty(dbcEntry->Difficulty) == GetDifficulty() && dbcEntry->mapId == GetMapId())        {            m_completedEncountersMask |= 1 << dbcEntry->encounterIndex;            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()]);            if (/*uint32 dungeonId =*/ iter->second->lastEncounterDungeon)            {                DEBUG_LOG("DungeonPersistentState:: Dungeon %s (Instance-Id %u) completed last encounter %s", GetMap()->GetMapName(), GetInstanceId(), dbcEntry->encounterName[sWorld.GetDefaultDbcLocale()]);                // Place LFG reward here            }            return;        }    }}
开发者ID:Adeer,项目名称:server,代码行数:24,


示例2: UpdateAI

        void UpdateAI(const uint32 uiDiff)        {            if (!UpdateVictim())                return;            if (m_uiSummonInfernalEruptionTimer <= uiDiff)            {                DoScriptText(EMOTE_INFERNAL_ERUPTION, me);                DoScriptText(SAY_INFERNAL_ERUPTION, me);                DoCast(SPELL_INFERNAL_ERUPTION);                m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS;            } else m_uiSummonInfernalEruptionTimer -= uiDiff;            if (m_uiSummonNetherPortalTimer <= uiDiff)            {                DoScriptText(EMOTE_NETHER_PORTAL, me);                DoScriptText(SAY_NETHER_PORTAL, me);                DoCast(SPELL_NETHER_PORTAL);                m_uiSummonNetherPortalTimer = 2*MINUTE*IN_MILLISECONDS;            } else m_uiSummonNetherPortalTimer -= uiDiff;            if (m_uiFelFireballTimer <= uiDiff)            {                DoCastVictim(SPELL_FEL_FIREBALL);                m_uiFelFireballTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);            } else m_uiFelFireballTimer -= uiDiff;            if (m_uiFelLightningTimer <= uiDiff)            {                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM))                    DoCast(target, SPELL_FEL_LIGHTING);                m_uiFelLightningTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);            } else m_uiFelLightningTimer -= uiDiff;            if (m_uiIncinerateFleshTimer <= uiDiff)            {                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true))                {                    DoScriptText(EMOTE_INCINERATE, me, target);                    DoScriptText(SAY_INCINERATE, me);                    DoCast(target, SPELL_INCINERATE_FLESH);                }                m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS);            } else m_uiIncinerateFleshTimer -= uiDiff;            if (m_uiNetherPowerTimer <= uiDiff)            {                me->CastCustomSpell(SPELL_NETHER_POWER, SPELLVALUE_AURA_STACK, RAID_MODE<uint32>(5,10,5,10), me, true);                m_uiNetherPowerTimer = 40*IN_MILLISECONDS;            } else m_uiNetherPowerTimer -= uiDiff;            if (m_uiLegionFlameTimer <= uiDiff)            {                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true))                {                    DoScriptText(EMOTE_LEGION_FLAME, me, target);                    DoCast(target, SPELL_LEGION_FLAME);                }                m_uiLegionFlameTimer = 30*IN_MILLISECONDS;            } else m_uiLegionFlameTimer -= uiDiff;            if (GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC && m_uiTouchOfJaraxxusTimer <= uiDiff)            {                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))                    DoCast(target, SPELL_TOUCH_OF_JARAXXUS);                m_uiTouchOfJaraxxusTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS);            } else m_uiTouchOfJaraxxusTimer -= uiDiff;            DoMeleeAttackIfReady();        }
开发者ID:Bes666,项目名称:TrilliumEMU,代码行数:70,


示例3: UpdateAI

        void UpdateAI(const uint32 diff)        {            if (!UpdateVictim())                return;            events.Update(diff);            if (Phase == 1)            {                while (uint32 eventId = events.GetEvent())                {                    switch (eventId)                    {                        case EVENT_WASTE:                            DoSummon(NPC_WASTE, Pos[RAND(0, 3, 6, 9)]);                            events.RepeatEvent(urand(2000, 5000));                            break;                        case EVENT_ABOMIN:                            if (nAbomination < 8)                            {                                DoSummon(NPC_ABOMINATION, Pos[RAND(1, 4, 7, 10)]);                                nAbomination++;                                events.RepeatEvent(20000);                            }                            else                                events.PopEvent();                            break;                        case EVENT_WEAVER:                            if (nWeaver < 8)                            {                                DoSummon(NPC_WEAVER, Pos[RAND(0, 3, 6, 9)]);                                nWeaver++;                                events.RepeatEvent(25000);                            }                            else                                events.PopEvent();                            break;                        case EVENT_TRIGGER:                            if (GameObject* pKTTrigger = me->GetMap()->GetGameObject(KTTriggerGUID))                                pKTTrigger->SetPhaseMask(2, true);                            events.PopEvent();                            break;                        case EVENT_PHASE:                            events.Reset();                            DoScriptText(RAND(SAY_AGGRO_1, SAY_AGGRO_2, SAY_AGGRO_3), me);                            spawns.DespawnAll();                            me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_NOT_SELECTABLE);                            me->CastStop();                            DoStartMovement(me->getVictim());                            events.ScheduleEvent(EVENT_BOLT, urand(5000, 10000));                            events.ScheduleEvent(EVENT_NOVA, 15000);                            events.ScheduleEvent(EVENT_DETONATE, urand(30000, 40000));                            events.ScheduleEvent(EVENT_FISSURE, urand(10000, 30000));                            events.ScheduleEvent(EVENT_BLAST, urand(60000, 120000));                            if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL)                                events.ScheduleEvent(EVENT_CHAIN, urand(30000, 60000));                            Phase = 2;                            break;                        default:                            events.PopEvent();                            break;                    }                }            }            else            {                //start phase 3 when we are 45% health                if (Phase != 3)                {                    if (HealthBelowPct(45))                    {                        Phase = 3;                        DoScriptText(SAY_REQUEST_AID, me);                        //here Lich King should respond to KelThuzad but I don't know which Creature to make talk                        //so for now just make Kelthuzad says it.                        DoScriptText(SAY_ANSWER_REQUEST, me);                        for (uint8 i = 0; i <= 3; ++i)                        {                            if (GameObject* pPortal = me->GetMap()->GetGameObject(PortalsGUID[i]))                            {                                if (pPortal->getLootState() == GO_READY)                                    pPortal->UseDoorOrButton();                            }                        }                    }                }                else if (nGuardiansOfIcecrownCount < RAID_MODE(2, 4))                {                    if (uiGuardiansOfIcecrownTimer <= diff)                    {                        // TODO : Add missing text                        if (Creature* pGuardian = DoSummon(NPC_ICECROWN, Pos[RAND(2, 5, 8, 11)]))                            pGuardian->SetFloatValue(UNIT_FIELD_COMBATREACH, 2);                        ++nGuardiansOfIcecrownCount;                        uiGuardiansOfIcecrownTimer = 5000;                    }                    else uiGuardiansOfIcecrownTimer -= diff;                }//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:FreyaCore,代码行数:101,


示例4: UpdateAI

            void UpdateAI(uint32 diff) override            {                if (!UpdateVictim())                    return;                if (me->HasReactState(REACT_AGGRESSIVE) && !_gateIsOpen && !IsOnSameSide(me, me->GetVictim()))                {                    // NBD: this should only happen in practice if there is nobody left alive on our side (we should open gate)                    // thus we only do a cursory check to make sure (edge cases?)                    if (Player* newTarget = FindEligibleTarget(me, _gateIsOpen))                    {                        me->getThreatManager().resetAllAggro();                        me->AddThreat(newTarget, 1.0f);                        AttackStart(newTarget);                    }                    else                        OpenGate();                }                events.Update(diff);                if (!_gateIsOpen && HealthBelowPct(30) && events.IsInPhase(PHASE_TWO))                    OpenGate();                while (uint32 eventId = events.ExecuteEvent())                {                    switch (eventId)                    {                        case EVENT_SUMMON:                        {                            if (RAID_MODE(waves10,waves25).size() <= _waveCount) // bounds check                            {                                TC_LOG_INFO("scripts", "GothikAI: Wave count %d is out of range for difficulty %d.", _waveCount, GetDifficulty());                                break;                            }                                                        std::list<Creature*> triggers;                            me->GetCreatureListWithEntryInGrid(triggers, NPC_TRIGGER, 150.0f);                            for (GothikWaveEntry entry : RAID_MODE(waves10, waves25)[_waveCount].first)                                for (uint8 i = 0; i < entry.second; ++i)                                {                                    // GUID layout is as follows:                                    // CGUID+4: center (back of platform) - primary rider spawn                                    // CGUID+5: north (back of platform) - primary knight spawn                                    // CGUID+6: center (front of platform) - second spawn                                    // CGUID+7: south (front of platform) - primary trainee spawn                                    uint32 targetDBGuid;                                    switch (entry.first)                                    {                                        case NPC_LIVE_RIDER: // only spawns from center (back) > north                                            targetDBGuid = (CGUID_TRIGGER + 4) + (i % 2);                                            break;                                        case NPC_LIVE_KNIGHT: // spawns north > center (front) > south                                            targetDBGuid = (CGUID_TRIGGER + 5) + (i % 3);                                            break;                                        case NPC_LIVE_TRAINEE: // spawns south > center (front) > north                                            targetDBGuid = (CGUID_TRIGGER + 7) - (i % 3);                                            break;                                        default:                                            targetDBGuid = 0;                                    }                                                                    for (Creature* trigger : triggers)                                        if (trigger && trigger->GetSpawnId() == targetDBGuid)                                        {                                            DoSummon(entry.first, trigger, 1.0f, 15 * IN_MILLISECONDS, TEMPSUMMON_CORPSE_TIMED_DESPAWN);                                            break;                                        }                                }                            if (uint8 timeToNext = RAID_MODE(waves10, waves25)[_waveCount].second)                                events.ScheduleEvent(EVENT_SUMMON, timeToNext * IN_MILLISECONDS, 0, PHASE_ONE);                            ++_waveCount;                            break;                        }                        case EVENT_DOORS_UNLOCK:                            _gateCanOpen = true;                            for (ObjectGuid summonGuid : summons)                                if (Creature* summon = ObjectAccessor::GetCreature(*me, summonGuid))                                    if (summon->IsAlive() && (!summon->IsInCombat() || summon->IsInEvadeMode()))                                    {                                        OpenGate();                                        break;                                    }                            break;                        case EVENT_PHASE_TWO:                            events.SetPhase(PHASE_TWO);                            events.ScheduleEvent(EVENT_TELEPORT, 20 * IN_MILLISECONDS, 0, PHASE_TWO);                            events.ScheduleEvent(EVENT_HARVEST, 15 * IN_MILLISECONDS, 0, PHASE_TWO);                            events.ScheduleEvent(EVENT_RESUME_ATTACK, 2 * IN_MILLISECONDS, 0, PHASE_TWO);                            Talk(SAY_PHASE_TWO);                            Talk(EMOTE_PHASE_TWO);                            me->SetReactState(REACT_PASSIVE);                            me->getThreatManager().resetAllAggro();                            DoCastAOE(SPELL_TELEPORT_LIVE);                            break;                        case EVENT_TELEPORT:                            if (!HealthBelowPct(30))                            {//.........这里部分代码省略.........
开发者ID:AwkwardDev,项目名称:RE,代码行数:101,


示例5: GetDifficulty

bool DungeonPersistentState::IsCompleted(){    DungeonEncounterList const* encounterList = sObjectMgr.GetDungeonEncounterList(GetMapId(), GetDifficulty());    if (!encounterList)        return false;    for (DungeonEncounterList::const_iterator itr = encounterList->begin(); itr != encounterList->end(); ++itr)    {        if (!(m_completedEncountersMask & ( 1 << (*itr)->dbcEntry->encounterIndex)))            return false;    }    return true;}
开发者ID:AwkwardDev,项目名称:mangos,代码行数:14,


示例6: ASSERT

/*    Called from AddInstanceSave*/void InstanceSave::SaveToDB(){    // save instance data too    std::string data;    Map *map = MapManager::Instance().FindMap(GetMapId(),m_instanceid);    if (map)    {        ASSERT(map->IsDungeon());        if (InstanceData *iData = ((InstanceMap*)map)->GetInstanceData())        {            data = iData->GetSaveData();            if (!data.empty())                CharacterDatabase.escape_string(data);        }    }    CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '" UI64FMTD "', '%u', '%s')", m_instanceid, GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), data.c_str());}
开发者ID:Amara1231,项目名称:blizzlikecore,代码行数:22,


示例7: getinfo

/** * @note Do not add or change anything in the information returned by this * method. `getinfo` exists for backwards-compatibility only. It combines * information from wildly different sources in the program, which is a mess, * and is thus planned to be deprecated eventually. * * Based on the source of the information, new information should be added to: * - `getblockchaininfo`, * - `getnetworkinfo` or * - `getwalletinfo` * * Or alternatively, create a specific query method for the information. **/UniValue getinfo(const JSONRPCRequest& request){    if (request.fHelp || request.params.size() != 0)        throw std::runtime_error(            "getinfo/n"            "/nDEPRECATED. Returns an object containing various state info./n"            "/nResult:/n"            "{/n"            "  /"deprecation-warning/": /".../" (string) warning that the getinfo command is deprecated and will be removed in 0.16/n"            "  /"version/": xxxxx,           (numeric) the server version/n"            "  /"protocolversion/": xxxxx,   (numeric) the protocol version/n"            "  /"walletversion/": xxxxx,     (numeric) the wallet version/n"            "  /"balance/": xxxxxxx,         (numeric) the total bitcoin balance of the wallet/n"            "  /"blocks/": xxxxxx,           (numeric) the current number of blocks processed in the server/n"            "  /"timeoffset/": xxxxx,        (numeric) the time offset/n"            "  /"connections/": xxxxx,       (numeric) the number of connections/n"            "  /"proxy/": /"host:port/",       (string, optional) the proxy used by the server/n"            "  /"difficulty/": xxxxxx,       (numeric) the current difficulty/n"            "  /"testnet/": true|false,      (boolean) if the server is using testnet or not/n"            "  /"keypoololdest/": xxxxxx,    (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool/n"            "  /"keypoolsize/": xxxx,        (numeric) how many new keys are pre-generated/n"            "  /"unlocked_until/": ttt,      (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked/n"            "  /"paytxfee/": x.xxxx,         (numeric) the transaction fee set in " + CURRENCY_UNIT + "/kB/n"            "  /"relayfee/": x.xxxx,         (numeric) minimum relay fee for transactions in " + CURRENCY_UNIT + "/kB/n"            "  /"errors/": /".../"             (string) any error messages/n"            "}/n"            "/nExamples:/n"            + HelpExampleCli("getinfo", "")            + HelpExampleRpc("getinfo", "")        );#ifdef ENABLE_WALLET    CWallet * const pwallet = GetWalletForJSONRPCRequest(request);    LOCK2(cs_main, pwallet ? &pwallet->cs_wallet : NULL);#else    LOCK(cs_main);#endif    proxyType proxy;    GetProxy(NET_IPV4, proxy);    UniValue obj(UniValue::VOBJ);    obj.push_back(Pair("deprecation-warning", "WARNING: getinfo is deprecated and will be fully removed in 0.16."        " Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16"));    obj.push_back(Pair("version", CLIENT_VERSION));    obj.push_back(Pair("protocolversion", PROTOCOL_VERSION));#ifdef ENABLE_WALLET    if (pwallet) {        obj.push_back(Pair("walletversion", pwallet->GetVersion()));        obj.push_back(Pair("balance",       ValueFromAmount(pwallet->GetBalance())));    }#endif    obj.push_back(Pair("blocks",        (int)chainActive.Height()));    obj.push_back(Pair("timeoffset",    GetTimeOffset()));    if(g_connman)        obj.push_back(Pair("connections",   (int)g_connman->GetNodeCount(CConnman::CONNECTIONS_ALL)));    obj.push_back(Pair("proxy",         (proxy.IsValid() ? proxy.proxy.ToStringIPPort() : std::string())));    obj.push_back(Pair("difficulty",    (double)GetDifficulty()));    obj.push_back(Pair("testnet",       Params().NetworkIDString() == CBaseChainParams::TESTNET));#ifdef ENABLE_WALLET    if (pwallet) {        obj.push_back(Pair("keypoololdest", pwallet->GetOldestKeyPoolTime()));        obj.push_back(Pair("keypoolsize",   (int)pwallet->GetKeyPoolSize()));    }    if (pwallet && pwallet->IsCrypted()) {        obj.push_back(Pair("unlocked_until", pwallet->nRelockTime));    }    obj.push_back(Pair("paytxfee",      ValueFromAmount(payTxFee.GetFeePerK())));#endif    obj.push_back(Pair("relayfee",      ValueFromAmount(::minRelayTxFee.GetFeePerK())));    obj.push_back(Pair("errors",        GetWarnings("statusbar")));    return obj;}
开发者ID:fametrano,项目名称:bitcoin,代码行数:87,


示例8: UpdateAI

            void UpdateAI(uint32 diff) override            {                if (!UpdateVictim() || !CheckInRoom())                    return;                events.Update(diff);                if (!thirtyPercentReached && HealthBelowPct(30) && phaseTwo)                {                    thirtyPercentReached = true;                    instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);                }                if (me->HasUnitState(UNIT_STATE_CASTING))                    return;                while (uint32 eventId = events.ExecuteEvent())                {                    switch (eventId)                    {                        case EVENT_SUMMON:                            if (waves[waveCount].entry)                            {                                if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))                                   DoGothikSummon(waves[waveCount].entry);                                else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))                                    DoGothikSummon(waves[waveCount].entry);                                else if (waves[waveCount].mode == 1)                                    DoGothikSummon(waves[waveCount].entry);                                // if group is not splitted, open gate and merge both sides at ~ 2 minutes (wave 11)                                if (waveCount == 11)                                {                                    if (!CheckGroupSplitted())                                    {                                        instance->SetData(DATA_GOTHIK_GATE, GO_STATE_ACTIVE);                                        DummyEntryCheckPredicate pred;                                        summons.DoAction(0, pred);  //! Magic numbers fail                                        summons.DoZoneInCombat();                                        mergedSides = true;                                    }                                }                                if (waves[waveCount].mode == 1)                                    events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);                                else if ((waves[waveCount].mode == 2) && (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL))                                    events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);                                else if ((waves[waveCount].mode == 0) && (GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL))                                    events.ScheduleEvent(EVENT_SUMMON, waves[waveCount].time);                                else                                    events.ScheduleEvent(EVENT_SUMMON, 0);                                ++waveCount;                            }                            else                            {                                phaseTwo = true;                                Talk(SAY_TELEPORT);                                DoTeleportTo(PosGroundLiveSide);                                me->SetReactState(REACT_AGGRESSIVE);                                DummyEntryCheckPredicate pred;                                summons.DoAction(0, pred);  //! Magic numbers fail                                summons.DoZoneInCombat();                                events.ScheduleEvent(EVENT_BOLT, 1000);                                events.ScheduleEvent(EVENT_HARVEST, urand(3000, 15000));                                events.ScheduleEvent(EVENT_TELEPORT, 20000);                            }                            break;                        case EVENT_BOLT:                            DoCastVictim(SPELL_SHADOW_BOLT);                            events.ScheduleEvent(EVENT_BOLT, 1000);                            break;                        case EVENT_HARVEST:                            DoCastVictim(SPELL_HARVEST_SOUL, true);                            events.ScheduleEvent(EVENT_HARVEST, urand(20000, 25000));                            break;                        case EVENT_TELEPORT:                            if (!thirtyPercentReached)                            {                                me->AttackStop();                                if (IN_LIVE_SIDE(me))                                    DoTeleportTo(PosGroundDeadSide);                                else                                    DoTeleportTo(PosGroundLiveSide);                                me->getThreatManager().resetAggro(NotOnSameSide(me));                                if (Unit* target = SelectTarget(SELECT_TARGET_NEAREST, 0))                                {                                    me->getThreatManager().addThreat(target, 100.0f);                                    AttackStart(target);                                }                                events.ScheduleEvent(EVENT_TELEPORT, 20000);                            }                            break;                    }                }                if (!phaseTwo)                    DoMeleeAttackIfReady();//.........这里部分代码省略.........
开发者ID:AllThing,项目名称:TrinityCore,代码行数:101,


示例9: 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,


示例10: BlockToString

std::string BlockToString(CBlockIndex* pBlock){    if (!pBlock)        return "";    CBlock block;    ReadBlockFromDisk(block, pBlock);    CAmount Fees = 0;    CAmount OutVolume = 0;    CAmount Reward = 0;    std::string TxLabels[] = {_("Hash"), _("From"), _("Amount"), _("To"), _("Amount")};    std::string TxContent = table + makeHTMLTableRow(TxLabels, sizeof(TxLabels) / sizeof(std::string));    for (unsigned int i = 0; i < block.vtx.size(); i++) {        const CTransaction& tx = block.vtx[i];        TxContent += TxToRow(tx);        CAmount In = getTxIn(tx);        CAmount Out = tx.GetValueOut();        if (tx.IsCoinBase())            Reward += Out;        else if (In < 0)            Fees = -Params().MaxMoneyOut();        else {            Fees += In - Out;            OutVolume += Out;        }    }    TxContent += "</table>";    CAmount Generated;    if (pBlock->nHeight == 0)        Generated = OutVolume;    else        Generated = GetBlockValue(pBlock->nHeight - 1);    std::string BlockContentCells[] =        {            _("Height"), itostr(pBlock->nHeight),            _("Size"), itostr(GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)),            _("Number of Transactions"), itostr(block.vtx.size()),            _("Value Out"), ValueToString(OutVolume),            _("Fees"), ValueToString(Fees),            _("Generated"), ValueToString(Generated),            _("Timestamp"), TimeToString(block.nTime),            _("Difficulty"), strprintf("%.4f", GetDifficulty(pBlock)),            _("Bits"), utostr(block.nBits),            _("Nonce"), utostr(block.nNonce),            _("Version"), itostr(block.nVersion),            _("Hash"), "<pre>" + block.GetHash().GetHex() + "</pre>",            _("Merkle Root"), "<pre>" + block.hashMerkleRoot.GetHex() + "</pre>",            // _("Hash Whole Block"), "<pre>" + block.hashWholeBlock.GetHex() + "</pre>"            // _("Miner Signature"), "<pre>" + block.MinerSignature.ToString() + "</pre>"        };    std::string BlockContent = makeHTMLTable(BlockContentCells, sizeof(BlockContentCells) / (2 * sizeof(std::string)), 2);    std::string Content;    Content += "<h2><a class=/"nav/" href=";    Content += itostr(pBlock->nHeight - 1);    Content += ">
C++ GetDim函数代码示例
C++ GetDialogBaseUnits函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。