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; } } }
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(); }
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; } if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (uint32 eventId = events.GetEvent()) { switch (eventId) { case EVENT_BOLT: DoCastVictim(RAID_MODE(SPELL_FROST_BOLT, H_SPELL_FROST_BOLT)); events.RepeatEvent(urand(5000, 10000)); break; case EVENT_NOVA: DoCastAOE(RAID_MODE(SPELL_FROST_BOLT_AOE, H_SPELL_FROST_BOLT_AOE)); events.RepeatEvent(urand(15000, 30000)); break; case EVENT_CHAIN: { uint32 count = urand(1, 3); for (uint8 i = 1; i <= count; i++) { Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 200, true); if (target && !target->isCharmed() && (chained.find(target->GetGUID()) == chained.end())) { DoCast(target, SPELL_CHAINS_OF_KELTHUZAD); float scale = target->GetFloatValue(OBJECT_FIELD_SCALE_X); chained.insert(std::make_pair(target->GetGUID(), scale)); target->SetFloatValue(OBJECT_FIELD_SCALE_X, scale * 2); events.ScheduleEvent(EVENT_CHAINED_SPELL, 2000); //core has 2000ms to set unit flag charm } } if (!chained.empty()) DoScriptText(RAND(SAY_CHAIN_1, SAY_CHAIN_2), me); events.RepeatEvent(urand(100000, 180000)); break; } case EVENT_CHAINED_SPELL: { std::map<uint64, float>::iterator itr; for (itr = chained.begin(); itr != chained.end();) { if (Unit* player = Unit::GetPlayer(*me, (*itr).first)) { if (!player->isCharmed()) { player->SetFloatValue(OBJECT_FIELD_SCALE_X, (*itr).second); std::map<uint64, float>::iterator next = itr; ++next; chained.erase(itr); itr = next; continue; } if (Unit* target = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, NotCharmedTargetSelector())) { switch (player->getClass()) { case CLASS_DRUID: if (urand(0, 1)) player->CastSpell(target, SPELL_MOONFIRE, false); else player->CastSpell(me, SPELL_LIFEBLOOM, false); break; case CLASS_HUNTER: player->CastSpell(target, RAND(SPELL_MULTI_SHOT, SPELL_VOLLEY), false); break; case CLASS_MAGE: player->CastSpell(target, RAND(SPELL_FROST_FIREBOLT, SPELL_ARCANE_MISSILES), false); break; case CLASS_WARLOCK: player->CastSpell(target, RAND(SPELL_CURSE_OF_AGONY, SPELL_SHADOW_BOLT), true); break; case CLASS_WARRIOR: player->CastSpell(target, RAND(SPELL_BLADESTORM, SPELL_CLEAVE), false); break; case CLASS_PALADIN: if (urand(0, 1)) player->CastSpell(target, SPELL_HAMMER_OF_JUSTICE, false); else player->CastSpell(me, SPELL_HOLY_SHOCK, false); break; case CLASS_PRIEST: if (urand(0, 1)) player->CastSpell(target, SPELL_VAMPIRIC_TOUCH, false); else player->CastSpell(me, SPELL_RENEW, false); break; case CLASS_SHAMAN: if (urand(0, 1)) player->CastSpell(target, SPELL_EARTH_SHOCK, false); else player->CastSpell(me, SPELL_HEALING_WAVE, false); break; case CLASS_ROGUE: player->CastSpell(target, RAND(SPELL_HEMORRHAGE, SPELL_MUTILATE), false); break; case CLASS_DEATH_KNIGHT: if (urand(0, 1)) player->CastSpell(target, SPELL_PLAGUE_STRIKE, true); else player->CastSpell(target, SPELL_HOWLING_BLAST, true); break; } } } ++itr; } if (chained.empty()) events.PopEvent(); else events.RepeatEvent(5000); break; } case EVENT_DETONATE: { std::vector<Unit*> unitList; std::list<HostileReference*> *threatList = &me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = threatList->begin(); itr != threatList->end(); ++itr) { if ((*itr)->getTarget()->GetTypeId() == TYPEID_PLAYER && (*itr)->getTarget()->getPowerType() == POWER_MANA && (*itr)->getTarget()->GetPower(POWER_MANA)) unitList.push_back((*itr)->getTarget()); } if (!unitList.empty()) { std::vector<Unit*>::const_iterator itr = unitList.begin(); advance(itr, rand()%unitList.size()); DoCast(*itr, SPELL_MANA_DETONATION); DoScriptText(RAND(SAY_SPECIAL_1, SAY_SPECIAL_2, SAY_SPECIAL_3), me); } events.RepeatEvent(urand(20000, 50000)); break; } case EVENT_FISSURE: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(target, SPELL_SHADOW_FISURE); events.RepeatEvent(urand(10000, 45000)); break; case EVENT_BLAST: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, RAID_MODE(1, 0), 0, true)) DoCast(target, SPELL_FROST_BLAST); if (rand()%2) DoScriptText(SAY_FROST_BLAST, me); events.RepeatEvent(urand(30000, 90000)); break; default: events.PopEvent(); break; } } DoMeleeAttackIfReady(); } }
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)) { me->CastStop(); me->AttackStop(); me->StopMoving(); me->SetReactState(REACT_PASSIVE); me->getThreatManager().resetAllAggro(); DoCastAOE(_lastTeleportDead ? SPELL_TELEPORT_LIVE : SPELL_TELEPORT_DEAD); _lastTeleportDead = !_lastTeleportDead; events.CancelEvent(EVENT_BOLT); events.ScheduleEvent(EVENT_TELEPORT, 20 * IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_RESUME_ATTACK, 2 * IN_MILLISECONDS, 0, PHASE_TWO); } break; case EVENT_HARVEST: DoCastAOE(SPELL_HARVEST_SOUL, true); // triggered allows this to go "through" shadow bolt events.ScheduleEvent(EVENT_HARVEST, 15 * IN_MILLISECONDS, 0, PHASE_TWO); break; case EVENT_RESUME_ATTACK: me->SetReactState(REACT_AGGRESSIVE); events.ScheduleEvent(EVENT_BOLT, 0, 0, PHASE_TWO); // return to the start of this method so victim side etc is re-evaluated return UpdateAI(0u); // tail recursion for efficiency case EVENT_BOLT: DoCastVictim(SPELL_SHADOW_BOLT); events.ScheduleEvent(EVENT_BOLT, 1 * IN_MILLISECONDS, 0, PHASE_TWO); break; case EVENT_INTRO_2: Talk(SAY_INTRO_2); break; case EVENT_INTRO_3: Talk(SAY_INTRO_3); break; case EVENT_INTRO_4: Talk(SAY_INTRO_4); break; } } }
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; }
/* 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()); }
/** * @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; }
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(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; switch (getStage()) { case 0: //GROUND if (m_uiFlameBreathTimer <= diff) { if (GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) DoCast(SPELL_FLAME_BREATH_25); else DoCast(SPELL_FLAME_BREATH_10); m_uiFlameBreathTimer = urand(12*IN_MILLISECONDS,13*IN_MILLISECONDS); } else m_uiFlameBreathTimer -= diff; if (m_uiEnrage <= diff) { DoCast(SPELL_ENRAGE); m_uiEnrage = urand(17*IN_MILLISECONDS,20*IN_MILLISECONDS); DoScriptText(-1666404,me); } else m_uiEnrage -= diff; if (m_uiBeakonTimer <= diff) { doBeacon(true); setStage(1); m_uiBeakonTimer = urand(30*IN_MILLISECONDS,31*IN_MILLISECONDS); } else m_uiBeakonTimer -= diff; break; case 1: //Air phase start SetCombatMovement(false); me->InterruptNonMeleeSpells(true); SetFly(true); doBeacon(true); StartMovement(1); setStage(2); break; case 2: // Wait for movement if (MovementStarted) return; DoCast(SPELL_CONFLAGATION); DoScriptText(-1666403,me); setStage(3); break; case 3: // Wait for cast finish if (!me->IsNonMeleeSpellCasted(false)) { doBeacon(false); setStage(4); } break; case 4: // Air phase // if (m_uiConflagrateTimer <= diff) // { // if (conflagated) // { //DoCast(SPELL_CONFLAGATION_1); doBeacon(false); // } setStage(5); // m_uiConflagrateTimer = 5*IN_MILLISECONDS; // } else m_uiConflagrateTimer -= diff; break; case 5: //Air phase end StartMovement(0); setStage(6); break; case 6: // Wait for movement if (MovementStarted) return; SetFly(false); SetCombatMovement(true); me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MoveChase(me->getVictim()); for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { Unit *pTemp = (*itr); me->CastSpell(pTemp, SPELL_CONFLAGATION_2, true); } // DoCast(SPELL_CONFLAGATION_2); playerList.clear(); setStage(0); break; default: break; } DoMeleeAttackIfReady(); }
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; } } }
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 += ">◄ </a>"; Content += _("Block"); Content += " "; Content += itostr(pBlock->nHeight); Content += "<a class=\"nav\" href="; Content += itostr(pBlock->nHeight + 1); Content += "> ►</a></h2>"; Content += BlockContent; Content += "</br>"; /* if (block.nHeight > getThirdHardforkBlock()) { std::vector<std::string> votes[2]; for (int i = 0; i < 2; i++) { for (unsigned int j = 0; j < block.vvotes[i].size(); j++) { votes[i].push_back(block.vvotes[i][j].hash.ToString() + ':' + itostr(block.vvotes[i][j].n)); } } Content += "<h3>" + _("Votes +") + "</h3>"; Content += makeHTMLTable(&votes[1][0], votes[1].size(), 1); Content += "</br>"; Content += "<h3>" + _("Votes -") + "</h3>"; Content += makeHTMLTable(&votes[0][0], votes[0].size(), 1); Content += "</br>"; } */ Content += "<h2>" + _("Transactions") + "</h2>"; Content += TxContent; return Content; }
void UpdateAI(uint32 diff) { if (killtimer>=diff) killtimer -= diff; if (!UpdateVictim()) return; events.Update(diff); while (uint32 eventid = events.ExecuteEvent()) { switch (eventid) { case EVENT_BLAZE_OF_GLORY: me->CastSpell(me->getVictim(), SPELL_BLAZE_OF_GLORY, false); me->CastSpell(me, SPELL_INCENDIARY_SOUL, false); events.ScheduleEvent(EVENT_BLAZE_OF_GLORY, urand(8000, 14000)); break; case EVENT_SHARDS_OF_TORMENT: if (roll_chance_i(33)) { me->MonsterYell(SAY_SHARD, 0, 0); DoPlaySoundToSet(me, SOU_SHARD); } if(Unit* targetFirst = SelectTarget(SELECT_TARGET_RANDOM, 0)) me->CastSpell(targetFirst, SPELL_SUMMON_SHARDS_OF_TORMENT, false); if(GetDifficulty() == RAID_DIFFICULTY_25MAN_NORMAL || GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC) if(Unit* targetSecond = SelectTarget(SELECT_TARGET_RANDOM, 0)) me->CastSpell(targetSecond, SPELL_SUMMON_SHARDS_OF_TORMENT, false); me->CastSpell(me, SPELL_SHARDS_OF_TORMENT, false); events.ScheduleEvent(EVENT_SHARDS_OF_TORMENT, 35000); break; case EVENT_INFERNO_BLADE: me->MonsterYell(SAY_INFER, 0, 0); DoPlaySoundToSet(me, SOU_INFER); me->CastSpell(me, SPELL_INFERNO_BLADE, false); events.ScheduleEvent(EVENT_DECIMATION_BLADE, 45000); break; case EVENT_DECIMATION_BLADE: me->MonsterYell(SAY_DECIM, 0, 0); DoPlaySoundToSet(me, SOU_DECIM); me->CastSpell(me, SPELL_DECIMATION_BLADE, false); events.ScheduleEvent(EVENT_DECIMATING_STRIKE, 4000); events.ScheduleEvent(EVENT_INFERNO_BLADE, 45000); break; case EVENT_DECIMATING_STRIKE: if(me->HasAura(SPELL_DECIMATION_BLADE)) { me->CastSpell(me->getVictim(), SPELL_DECIMATING_STRIKE, false); events.ScheduleEvent(EVENT_DECIMATING_STRIKE, 5000); } else events.CancelEvent(EVENT_DECIMATING_STRIKE); break; case EVENT_COUNTDOWN: if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true)) { me->CastSpell(target, SPELL_COUNTDOWN, false); target->CastSpell(target, SPELL_COUNTDOWN_LINK, false); if(Unit* targetLink = SelectTarget(SELECT_TARGET_RANDOM, 0, 0, true, -SPELL_COUNTDOWN)) { me->CastSpell(targetLink, SPELL_COUNTDOWN, false); target->CastSpell(targetLink, SPELL_COUNTDOWN_LINK, false); } } events.ScheduleEvent(EVENT_COUNTDOWN, 45000); break; case EVENT_BERSERK: me->CastSpell(me, SPELL_BERSERK, false); me->MonsterYell(SAY_ENRAG, 0, 0); DoPlaySoundToSet(me, SOU_ENRAG); break; } } DoMeleeAttackIfReady(); }
void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; if (m_uiSummonInfernalEruptionTimer <= uiDiff) { DoScriptText(EMOTE_INFERNAL_ERUPTION, me); DoScriptText(SAY_INFERNAL_ERUPTION, me); uint8 i = urand(2, 3); me->SummonCreature(NPC_INFERNAL_VOLCANO, JaraxxusLoc[i].GetPositionX(), JaraxxusLoc[i].GetPositionY(), JaraxxusLoc[i].GetPositionZ(), TEMPSUMMON_CORPSE_DESPAWN); m_uiSummonInfernalEruptionTimer = 2*MINUTE*IN_MILLISECONDS; } else m_uiSummonInfernalEruptionTimer -= uiDiff; if (m_uiSummonNetherPortalTimer <= uiDiff) { DoScriptText(EMOTE_NETHER_PORTAL, me); DoScriptText(SAY_NETHER_PORTAL, me); uint8 i = urand(2, 3); me->SummonCreature(NPC_NETHER_PORTAL, JaraxxusLoc[i].GetPositionX(), JaraxxusLoc[i].GetPositionY(), JaraxxusLoc[i].GetPositionZ(), TEMPSUMMON_CORPSE_DESPAWN); 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* pTarget = SelectTarget(SELECT_TARGET_RANDOM)) DoCast(pTarget, SPELL_FEL_LIGHTING); m_uiFelLightningTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); } else m_uiFelLightningTimer -= uiDiff; if (m_uiIncinerateFleshTimer <= uiDiff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true)) { DoScriptText(EMOTE_INCINERATE, me, pTarget); DoScriptText(SAY_INCINERATE, me); DoCast(pTarget, SPELL_INCINERATE_FLESH); } m_uiIncinerateFleshTimer = urand(20*IN_MILLISECONDS, 25*IN_MILLISECONDS); } else m_uiIncinerateFleshTimer -= uiDiff; if (m_uiNetherPowerTimer <= uiDiff) { DoCast(me, SPELL_NETHER_POWER); m_uiNetherPowerTimer = 40*IN_MILLISECONDS; } else m_uiNetherPowerTimer -= uiDiff; if (m_uiLegionFlameTimer <= uiDiff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true)) { DoScriptText(EMOTE_LEGION_FLAME, me, pTarget); DoCast(pTarget, SPELL_LEGION_FLAME); } m_uiLegionFlameTimer = 30*IN_MILLISECONDS; } else m_uiLegionFlameTimer -= uiDiff; if (GetDifficulty() == RAID_DIFFICULTY_25MAN_HEROIC && m_uiTouchOfJaraxxusTimer <= uiDiff) { if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0)) DoCast(pTarget, SPELL_TOUCH_OF_JARAXXUS); m_uiTouchOfJaraxxusTimer = urand(10*IN_MILLISECONDS, 15*IN_MILLISECONDS); } else m_uiTouchOfJaraxxusTimer -= uiDiff; DoMeleeAttackIfReady(); }
bool CBaseBot::FindEnemy() { // check if the health is decreased bool fHealthDecreased = m_iPrevHealth > GetHealth(); m_iPrevHealth = GetHealth(); // store away the current health value float cur_dist; if (m_pEnemy && (!m_pEnemy->IsValid() || !m_pEnemy->IsAlive())) m_pEnemy = NULL; // null out the enemy pointer as it's no longer valid Vector vecHisPos; unsigned char cHit; // see if we can still see the current enemy... if (m_pEnemy) { if (FBoxVisible(m_pEnemy, &vecHisPos, &cHit)) { m_vecEnemy = vecHisPos; m_ucVisibility = cHit; } else { m_pEnemy = NULL; // we can no longer see this enemy } } // if we already have an enemy... if (m_pEnemy) { // don't discard important enemies (bomb/flag/hostage carrier, VIP, etc) if (g_pServer->ClientIsImportant(EnemyClient())) return false; // calculate the distance to the enemy cur_dist = (m_pEnemy->GetOrigin() - GetOrigin()).Length(); } else { cur_dist = FLT_MAX; // just some crazy value } // loop through all the clients... for (int i = 0; i < g_pServer->GetMaxClients(); i++) { if (i == entindex() - 1 || (m_pEnemy && i == m_pEnemy->entindex() - 1)) continue; // skip myself and the current enemy CClient *pClient = g_pServer->m_rgpClients[i]; if (!pClient || !pClient->IsValid() || !pClient->IsAlive()) continue; float dist = (pClient->GetOrigin() - GetOrigin()).Length(); // if this enemy is further away than the current one... if (dist > cur_dist && !g_pServer->ClientIsImportant(pClient)) continue; // skip it if (dist > 900 + 4000 * ((GetDifficulty() - 1) / 4.0)) continue; // enemy is too far if (g_pServer->IsTeamplay() && GetTeam() == g_pServer->GetTeam(pClient)) continue; // skip our teammates float fov; // if the bot's health decreased or the enemy is shooting if (!m_pEnemy && (fHealthDecreased || pClient->IsShooting())) fov = 360; else fov = GetFov() * 2 - (GetFov() - (dist > GetFov() * 9 ? GetFov() * 9 : dist) / 9); // check if enemy is in the view cone if (!FInViewCone(pClient, fov)) continue; // enemy isn't in bot's view cone // check if enemy is visible if (!FBoxVisible(pClient, &vecHisPos, &cHit)) { continue; // skip this enemy } // if the enemy is quite far away, not shooting and the bot is not damaged if (!m_pEnemy && dist > 200 && !fHealthDecreased && !pClient->IsShooting()) { // if the bot isn't in the fov of the enemy and the bot doesn't really want to fight if (!pClient->FInViewCone(this, 120) /*&& BotWantsToRetreat()*/) continue; // skip this enemy } m_pEnemy = pClient; // found a new enemy m_vecEnemy = vecHisPos; m_ucVisibility = cHit; DebugMsg(DEBUG_BOTCOMBAT, "Found new enemy: %s", m_pEnemy->GetNetName()); return true; } return false; // no new enemy is found }
/* Called from AddPersistentState */ void DungeonPersistentState::SaveToDB() { // state instance data too std::string data; if (Map* map = GetMap()) { InstanceData* iData = map->GetInstanceData(); if (iData && iData->Save()) { data = iData->Save(); CharacterDatabase.escape_string(data); } } CharacterDatabase.PExecute("INSERT INTO instance VALUES ('%u', '%u', '" UI64FMTD "', '%u', '%u', '%s')", GetInstanceId(), GetMapId(), (uint64)GetResetTimeForDB(), GetDifficulty(), GetCompletedEncountersMask(), data.c_str()); }
void ProfitExplorerPage::loadStakeChart(bool firstRun) { if(fShutdown) return; nTimeData.clear(); netStakeData.clear(); myStakeData.clear(); difficultyData.clear(); velTimeData.clear(); velAmountData.clear(); // go back this many blocks max int max = ui->spinBox->value(); int i = 0; //BOOST_REVERSE_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& b, mapBlockIndex) //{ // if(i >= max) // break; CBlockIndex* pindex = pindexBest; while(i < max && pindex != NULL) { //CBlockIndex* pindex = b.second; if(pindex->IsProofOfStake()) { nTimeData.append(pindex->nTime); netStakeData.append(pindex->nMint / COIN); // Read the block in and check if the coinstake is ours CBlock block; block.ReadFromDisk(pindex, true); if(block.IsProofOfStake()) // this should always be true here { velTimeData.append(pindex->nTime); double blockOutAmount = 0; for(int j=0; j<block.vtx.size(); j++) { blockOutAmount += block.vtx[j].GetValueOut() / COIN; } velAmountData.append(blockOutAmount); difficultyData.append(GetDifficulty(pindex)); if(pwalletMain->IsMine(block.vtx[1])) { myStakeData.append(pindex->nMint / COIN); } else { myStakeData.append(0); } } else { myStakeData.append(0); // should never happen } i = i + 1; } pindex = pindex->pprev; //++i; } if(!firstRun) { uint64_t nMinWeight = 0, nMaxWeight = 0, nWeight = 0; pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight); uint64_t nNetworkWeight = 0; if(pindexBest) nNetworkWeight = GetPoSKernelPS(); bool staking = nLastCoinStakeSearchInterval && nWeight; int nExpectedTime = staking ? (nTargetSpacing * nNetworkWeight / nWeight) : -1; ui->stakingLabel->setText(staking ? "Enabled" : "Disabled"); if(pindexBest) ui->difficultyLabel->setText(QString::number(GetDifficulty(GetLastBlockIndex(pindexBest, true)))); ui->weightLabel->setText(QString::number(nWeight)); ui->netWeightLabel->setText(QString::number(nNetworkWeight)); ui->timeToStakeLabel->setText(QString::number(nExpectedTime) + " secs"); } //qDebug() << "Stake blocks processed:"; //qDebug() << i; ui->customPlot->clearPlottables(); ui->customPlot->clearGraphs(); ui->customPlot->clearItems(); ui->customPlot->addGraph(); ui->customPlot->graph(0)->setPen(QPen(QColor(206, 206, 206))); // line color green for first graph ui->customPlot->graph(0)->setBrush(QBrush(QColor(206, 206, 206, 20))); // first graph will be filled with translucent green ui->customPlot->addGraph(); ui->customPlot->graph(1)->setPen(QPen(QColor(76, 255, 0))); // line color red for second graph ui->customPlot->graph(1)->setBrush(QBrush(QColor(76, 255, 0, 20))); if(ui->networkCheckBox->isChecked()) ui->customPlot->graph(0)->setData(nTimeData, netStakeData); ui->customPlot->graph(1)->setData(nTimeData, myStakeData); //ui->customPlot->xAxis->setRangeLower(nTimeData.first()); //ui->customPlot->xAxis->setRangeUpper(nTimeData.last()); QLinearGradient plotGradient; plotGradient.setStart(0, 0); plotGradient.setFinalStop(0, 350); plotGradient.setColorAt(0, QColor(10, 10, 10)); plotGradient.setColorAt(1, QColor(0, 0, 0)); ui->customPlot->setBackground(plotGradient); ui->customPlot->xAxis->grid()->setVisible(false); ui->customPlot->yAxis->grid()->setVisible(false); ui->customPlot->xAxis->grid()->setSubGridVisible(false); ui->customPlot->yAxis->grid()->setSubGridVisible(false); ui->customPlot->xAxis->setAutoTickStep(true); ui->customPlot->xAxis->setTickStep(3600 * 24); // 24 hr tickstep ui->customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime); ui->customPlot->xAxis->setDateTimeSpec(Qt::UTC); ui->customPlot->xAxis->setDateTimeFormat("dd. MMM hh:mm"); ui->customPlot->xAxis->setTickLabelRotation(15); ui->customPlot->xAxis->setTickLabelColor(QColor(137, 140, 146)); ui->customPlot->yAxis->setTickLabelColor(QColor(137, 140, 146)); ui->customPlot->rescaleAxes(); ui->customPlot->xAxis->setLabelColor(QColor(137, 140, 146)); ui->customPlot->yAxis->setLabelColor(QColor(137, 140, 146)); ui->customPlot->yAxis->setLabel("$XQN Minted"); ui->customPlot->xAxis->setLabel("Stake Block Generation Time"); ui->customPlot->replot(); ui->difficultyPlot->clearPlottables(); ui->difficultyPlot->clearGraphs(); ui->difficultyPlot->clearItems(); ui->difficultyPlot->addGraph(); ui->difficultyPlot->graph(0)->setPen(QPen(QColor(76, 255, 0))); // line color green for first graph ui->difficultyPlot->graph(0)->setBrush(QBrush(QColor(76, 255, 0, 20))); // first graph will be filled with translucent green ui->difficultyPlot->graph(0)->setData(nTimeData, difficultyData); ui->difficultyPlot->xAxis->setRangeLower(nTimeData.first()); ui->difficultyPlot->xAxis->setRangeUpper(nTimeData.last()); QLinearGradient diffPlotGradient; diffPlotGradient.setStart(0, 0); diffPlotGradient.setFinalStop(0, 350); diffPlotGradient.setColorAt(0, QColor(10, 10, 10)); diffPlotGradient.setColorAt(1, QColor(0, 0, 0)); ui->difficultyPlot->setBackground(diffPlotGradient); ui->difficultyPlot->xAxis->grid()->setVisible(false); ui->difficultyPlot->yAxis->grid()->setVisible(false); ui->difficultyPlot->xAxis->grid()->setSubGridVisible(false); ui->difficultyPlot->yAxis->grid()->setSubGridVisible(false); ui->difficultyPlot->xAxis->setAutoTickStep(false); ui->difficultyPlot->xAxis->setTickStep(3600 * 24); // 24 hr tickstep ui->difficultyPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime); ui->difficultyPlot->xAxis->setDateTimeSpec(Qt::UTC); ui->difficultyPlot->xAxis->setDateTimeFormat("dd. MMM hh:mm"); ui->difficultyPlot->xAxis->setTickLabelRotation(15); ui->difficultyPlot->xAxis->setTickLabelColor(QColor(137, 140, 146)); ui->difficultyPlot->yAxis->setTickLabelColor(QColor(137, 140, 146)); ui->difficultyPlot->rescaleAxes(); ui->difficultyPlot->yAxis->setTickStep(0.00005); ui->difficultyPlot->xAxis->setLabelColor(QColor(137, 140, 146)); ui->difficultyPlot->yAxis->setLabelColor(QColor(137, 140, 146)); ui->difficultyPlot->yAxis->setLabel("Difficulty"); ui->difficultyPlot->xAxis->setTickLabels(false); //ui->difficultyPlot->xAxis->setLabel("Stake Block Generation Time"); ui->difficultyPlot->replot(); ui->velocityPlot->clearPlottables(); ui->velocityPlot->clearGraphs(); ui->velocityPlot->clearItems(); ui->velocityPlot->addGraph(); ui->velocityPlot->graph(0)->setPen(QPen(QColor(76, 255, 0))); // line color green for first graph ui->velocityPlot->graph(0)->setBrush(QBrush(QColor(76, 255, 0, 20))); // first graph will be filled with translucent green ui->velocityPlot->graph(0)->setData(velTimeData, velAmountData); ui->velocityPlot->xAxis->setRangeLower(velTimeData.first()); ui->velocityPlot->xAxis->setRangeUpper(velTimeData.last()); QLinearGradient velPlotGradient; velPlotGradient.setStart(0, 0); velPlotGradient.setFinalStop(0, 150); velPlotGradient.setColorAt(0, QColor(10, 10, 10)); velPlotGradient.setColorAt(1, QColor(0, 0, 0)); ui->velocityPlot->setBackground(velPlotGradient); ui->velocityPlot->xAxis->grid()->setVisible(false); ui->velocityPlot->yAxis->grid()->setVisible(false); ui->velocityPlot->xAxis->grid()->setSubGridVisible(false); ui->velocityPlot->yAxis->grid()->setSubGridVisible(false); ui->velocityPlot->xAxis->setAutoTickStep(false); ui->velocityPlot->xAxis->setTickStep(3600 * 24); // 24 hr tickstep ui->velocityPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime); ui->velocityPlot->xAxis->setDateTimeSpec(Qt::UTC); ui->velocityPlot->xAxis->setDateTimeFormat("dd. MMM hh:mm"); ui->velocityPlot->xAxis->setTickLabelRotation(15); ui->velocityPlot->xAxis->setTickLabelColor(QColor(137, 140, 146)); ui->velocityPlot->yAxis->setTickLabelColor(QColor(137, 140, 146)); ui->velocityPlot->yAxis->setScaleType(QCPAxis::stLogarithmic); ui->velocityPlot->yAxis->setTickStep(1000); ui->velocityPlot->xAxis->setLabelColor(QColor(137, 140, 146)); ui->velocityPlot->yAxis->setLabelColor(QColor(137, 140, 146)); ui->velocityPlot->yAxis->setLabel("$XQN"); ui->velocityPlot->xAxis->setTickLabels(false); ui->velocityPlot->xAxis->setLabel("Financial Velocity"); ui->velocityPlot->rescaleAxes(); ui->velocityPlot->replot(); }
void UpdateAI(const uint32 diff) { if (!UpdateVictim()) return; if (me->GetDistance(me->GetHomePosition()) > 150.0f) { EnterEvadeMode(); return; } events.Update(diff); if (me->HasUnitState(UNIT_STATE_CASTING)) return; if (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CHECK_DISTANCE: if (me->GetDistance(me->GetHomePosition()) > 150.0f) { events.Reset(); EnterEvadeMode(); return; } events.ScheduleEvent(EVENT_CHECK_DISTANCE, 5000); break; case EVENT_BERSERK: DoCast(me, SPELL_BERSERK); break; case EVENT_FOCUSED_ANGER: DoCast(me, SPELL_FOCUSED_ANGER); events.ScheduleEvent(EVENT_FOCUSED_ANGER, 6500); break; case EVENT_PSYCHIC_DRAIN: DoCastVictim(SPELL_PSYCHIC_DRAIN); events.ScheduleEvent(EVENT_PSYCHIC_DRAIN, urand(20000, 25000)); break; case EVENT_DISRUPTING_SHADOWS: Talk(SAY_SHADOWS); Talk(SAY_SHADOWS_1); me->CastCustomSpell(SPELL_DISRUPTING_SHADOWS, SPELLVALUE_MAX_TARGETS, RAID_MODE(3, 8, 3, 8), me); events.ScheduleEvent(EVENT_DISRUPTING_SHADOWS, urand(25000, 30000)); break; case EVENT_VOID_OF_THE_UNMAKING: summons.DespawnEntry(NPC_VOID_OF_THE_UNMAKING_1); Talk(SAY_VOID); Talk(SAY_VOID_1); DoCast(me, SPELL_VOID_OF_THE_UNMAKING_SUMMON_1); events.ScheduleEvent(EVENT_VOID_OF_THE_UNMAKING, 90300); break; case EVENT_TANTRUM_1: me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->NearTeleportTo(centerPos.GetPositionX(), centerPos.GetPositionY(), centerPos.GetPositionZ(), centerPos.GetOrientation()); events.ScheduleEvent(EVENT_TANTRUM_2, 3000); break; case EVENT_TANTRUM_2: Talk(SAY_BLOOD); Talk(SAY_BLOOD_1); DoCast(me, SPELL_DARKNESS, true); if (!IsHeroic()) DoCast(me, SPELL_BLACK_BLOOD_OF_GORATH_SELF, true); DoCast(me, SPELL_TANTRUM); switch (GetDifficulty()) { case MAN10_DIFFICULTY: SpawnRandomTentacles(4, 0, 0); break; case MAN25_DIFFICULTY: SpawnRandomTentacles(8, 0, 0); break; case MAN10_HEROIC_DIFFICULTY: SpawnRandomTentacles(4, 2, 1); break; case MAN25_HEROIC_DIFFICULTY: SpawnRandomTentacles(8, 4, 2); break; default: break; } events.ScheduleEvent(EVENT_END_TANTRUM_1, 11000); events.ScheduleEvent(EVENT_END_TANTRUM_2, 30000); break; case EVENT_END_TANTRUM_1: me->SetReactState(REACT_AGGRESSIVE); AttackStart(me->getVictim()); break; case EVENT_END_TANTRUM_2: if (!IsHeroic()) summons.DespawnEntry(NPC_EYE_OF_GORATH); me->RemoveAura(RAID_MODE(SPELL_VOID_OF_THE_UNMAKING_PREVENT, SPELL_VOID_OF_THE_UNMAKING_PREVENT_25, SPELL_VOID_OF_THE_UNMAKING_PREVENT_10H, SPELL_VOID_OF_THE_UNMAKING_PREVENT_25H)); events.ScheduleEvent(EVENT_VOID_OF_THE_UNMAKING, urand(13000, 14000)); events.ScheduleEvent(EVENT_FOCUSED_ANGER, 6000); events.ScheduleEvent(EVENT_DISRUPTING_SHADOWS, 6000); events.ScheduleEvent(EVENT_PSYCHIC_DRAIN, 21000); break; default: break; } } DoMeleeAttackIfReady(); }
double ClientModel::getDifficulty(bool PoS) { return(GetDifficulty(GetPrevBlockIndex(pindexBest, 0, PoS))); }
void Group::ResetInstances(InstanceResetMethod method, bool isRaid, Player* SendMsgTo) { if (isBGGroup()) return; // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND // we assume that when the difficulty changes, all instances that can be reset will be Difficulty diff = GetDifficulty(isRaid); typedef std::set<uint32> OfflineMapSet; OfflineMapSet mapsWithOfflinePlayer; // to store map of offline players if (method != INSTANCE_RESET_GROUP_DISBAND) { // Store maps in which are offline members for instance reset check. for (member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr) { if (!ObjectAccessor::FindPlayer(itr->guid)) mapsWithOfflinePlayer.insert(itr->lastMap); // add last map from offline player } } for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { DungeonPersistentState* state = itr->second.state; const MapEntry* entry = sMapStore.LookupEntry(itr->first); if (!entry || entry->IsRaid() != isRaid || (!state->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)) { ++itr; continue; } if (method == INSTANCE_RESET_ALL) { // the "reset all instances" method can only reset normal maps if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC) { ++itr; continue; } } bool isEmpty = true; // check if there are offline members on the map if (method != INSTANCE_RESET_GROUP_DISBAND && mapsWithOfflinePlayer.find(state->GetMapId()) != mapsWithOfflinePlayer.end()) isEmpty = false; // if the map is loaded, reset it if can if (isEmpty && entry->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !state->CanReset())) if (Map* map = sMapMgr.FindMap(state->GetMapId(), state->GetInstanceId())) isEmpty = ((DungeonMap*)map)->Reset(method); if (SendMsgTo) { if (isEmpty) SendMsgTo->SendResetInstanceSuccess(state->GetMapId()); else SendMsgTo->SendResetInstanceFailed(0, state->GetMapId()); } // TODO - Adapt here when clear how difficulty changes must be handled if (isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY) { // do not reset the instance, just unbind if others are permanently bound to it if (state->CanReset()) state->DeleteFromDB(); else CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", state->GetInstanceId()); // i don't know for sure if hash_map iterators m_boundInstances[diff].erase(itr); itr = m_boundInstances[diff].begin(); // this unloads the instance save unless online players are bound to it // (eg. permanent binds or GM solo binds) state->RemoveGroup(this); } else ++itr; } }
void StatsExplorer::loadStakeChart(bool firstRun) { // if(fShutdown) // return; nTimeData.clear(); netStakeData.clear(); myStakeData.clear(); difficultyData.clear(); velTimeData.clear(); velAmountData.clear(); // go back this many blocks max int max = ui->spinBox->value(); int i = 0; int64_t diffMax = 0; // int64_t hashMax = 0; double velMax = 0; BOOST_FOREACH(const PAIRTYPE(uint256, CBlockIndex*)& item, mapBlockIndex) { if(i >= max) break; CBlockIndex* pindex = item.second; nTimeData.append(pindex->nTime); netStakeData.append(0); velTimeData.append(pindex->nTime); // if(pindex->IsProofOfStake()) if (true) { // netStakeData.append(pindex->nMint / COIN); netStakeData.append(0); // Read the block in and check if the coinstake is ours CBlock block; ReadBlockFromDisk(block, pindex, Params().GetConsensus()); // if(block.IsProofOfStake()) // this should always be true here if(true) // this should always be true here { velTimeData.append(pindex->nTime); double blockOutAmount = 0; for(uint j=0; j<block.vtx.size(); j++) { // FIXME: check dereferencing CTransaction vtx = *block.vtx[j]; blockOutAmount += vtx.GetValueOut() / COIN; } velMax = std::max<double>(velMax, blockOutAmount); velAmountData.append(blockOutAmount); int64_t d = GetDifficulty(pindex); diffMax = std::max<int64_t>(diffMax, d); difficultyData.append(d); // if(IsMine(block.vtx[1])) if(false) { // myStakeData.append(pindex->nMint / COIN); myStakeData.append(0); } else { myStakeData.append(0); } } else { myStakeData.append(0); // should never happen } } ++i; } if(!firstRun) { uint64_t nMinWeight = 0, nMaxWeight = 0; // uint64_t nWeight = 0; // nWeight = nMinWeight * nMaxWeight; // pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight); // uint64_t nNetworkWeight = 0; // if(pindexBest) // nNetworkWeight = GetPoSKernelPS(); // bool staking = nLastCoinStakeSearchInterval && nWeight; // bool staking = false; // int nExpectedTime = staking ? (nTargetSpacing * nNetworkWeight / nWeight) : -1; /* ui->stakingLabel->setText(staking ? "Enabled" : "Disabled"); bool pindexBest = true; if(pindexBest) ui->difficultyLabel->setText(QString::number(GetDifficulty(mapBlockIndex[chainActive.Tip()->GetBlockHash()]))); ui->weightLabel->setText(QString::number(nWeight)); ui->netWeightLabel->setText(QString::number(nNetworkWeight)); ui->timeToStakeLabel->setText(QString::number(nExpectedTime) + " secs"); */ } QLinearGradient plotGradient; plotGradient.setStart(0, 0); plotGradient.setFinalStop(0, 350); plotGradient.setColorAt(0, QColor(10, 10, 10)); plotGradient.setColorAt(1, QColor(0, 0, 0)); QLinearGradient diffPlotGradient; diffPlotGradient.setStart(0, 0); diffPlotGradient.setFinalStop(0, 350); diffPlotGradient.setColorAt(0, QColor(10, 10, 10)); diffPlotGradient.setColorAt(1, QColor(0, 0, 0)); QLinearGradient velPlotGradient; velPlotGradient.setStart(0, 0); velPlotGradient.setFinalStop(0, 150); velPlotGradient.setColorAt(0, QColor(10, 10, 10)); velPlotGradient.setColorAt(1, QColor(0, 0, 0)); ui->difficultyPlot->clearPlottables(); ui->difficultyPlot->clearGraphs(); ui->difficultyPlot->clearItems(); ui->difficultyPlot->addGraph(); ui->difficultyPlot->graph(0)->setPen(QPen(QColor(43, 239, 209))); // line color orange for first graph ui->difficultyPlot->graph(0)->setBrush(QBrush(QColor(43, 239, 209, 20))); // first orange will be filled with translucent green ui->difficultyPlot->graph(0)->setData(nTimeData, difficultyData); ui->difficultyPlot->setBackground(diffPlotGradient); // ui->difficultyPlot->xAxis->setRangeLower(nTimeData.first()); // ui->difficultyPlot->xAxis->setRangeUpper(nTimeData.last()); ui->difficultyPlot->yAxis->setRangeLower(0); ui->difficultyPlot->yAxis->setRangeUpper(diffMax+(diffMax/10)); ui->difficultyPlot->xAxis->grid()->setVisible(false); ui->difficultyPlot->yAxis->grid()->setVisible(false); ui->difficultyPlot->xAxis->grid()->setSubGridVisible(false); ui->difficultyPlot->yAxis->grid()->setSubGridVisible(false); ui->difficultyPlot->xAxis->setAutoTickStep(false); ui->difficultyPlot->xAxis->setTickStep(3600 * 24); // 24 hr tickstep ui->difficultyPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime); ui->difficultyPlot->xAxis->setDateTimeSpec(Qt::UTC); ui->difficultyPlot->xAxis->setDateTimeFormat("dd MMM"); ui->difficultyPlot->xAxis->setTickLabelRotation(33); ui->difficultyPlot->xAxis->setTickLabelColor(QColor(43, 239, 209, 95)); ui->difficultyPlot->yAxis->setTickLabelColor(QColor(43, 239, 209, 95)); ui->difficultyPlot->rescaleAxes(); ui->difficultyPlot->yAxis->setTickStep(0.00005); ui->difficultyPlot->xAxis->setLabelColor(QColor(43, 239, 209, 95)); ui->difficultyPlot->yAxis->setLabelColor(QColor(43, 239, 209, 95)); ui->difficultyPlot->yAxis->setLabel("Difficulty"); ui->difficultyPlot->xAxis->setTickLabels(true); //ui->difficultyPlot->xAxis->setLabel("Time"); ui->difficultyPlot->replot(); /* ui->customPlot->clearPlottables(); ui->customPlot->clearGraphs(); ui->customPlot->clearItems(); ui->customPlot->addGraph(); ui->customPlot->graph(0)->setPen(QPen(QColor(43, 239, 209))); // line color cream for first graph ui->customPlot->graph(0)->setBrush(QBrush(QColor(0, 255, 139, 20))); // first graph will be filled with translucent cream ui->customPlot->addGraph(); ui->customPlot->graph(1)->setPen(QPen(QColor(43, 239, 209))); // line color orange for second graph ui->customPlot->graph(1)->setBrush(QBrush(QColor(0, 255, 139, 20))); if(ui->networkCheckBox->isChecked()) ui->customPlot->graph(0)->setData(nTimeData, netStakeData); ui->customPlot->graph(1)->setData(nTimeData, myStakeData); ui->customPlot->setBackground(plotGradient); ui->customPlot->xAxis->setRangeLower(nTimeData.first()); ui->customPlot->xAxis->setRangeUpper(nTimeData.last()); ui->customPlot->xAxis->grid()->setVisible(false); ui->customPlot->yAxis->grid()->setVisible(false); ui->customPlot->xAxis->grid()->setSubGridVisible(false); ui->customPlot->yAxis->grid()->setSubGridVisible(false); ui->customPlot->xAxis->setAutoTickStep(false); ui->customPlot->xAxis->setTickStep(3600 * 24); // 24 hr tickstep ui->customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime); ui->customPlot->xAxis->setDateTimeSpec(Qt::UTC); ui->customPlot->xAxis->setDateTimeFormat("dd. MMM hh:mm"); ui->customPlot->xAxis->setTickLabelRotation(33); ui->customPlot->xAxis->setTickLabelColor(QColor(43, 239, 209, 95)); ui->customPlot->yAxis->setTickLabelColor(QColor(43, 239, 209, 95)); ui->customPlot->rescaleAxes(); ui->customPlot->xAxis->setLabelColor(QColor(43, 239, 209, 95)); ui->customPlot->yAxis->setLabelColor(QColor(43, 239, 209, 95)); ui->customPlot->yAxis->setLabel("VCN Minted"); ui->customPlot->xAxis->setLabel("Stake Block Generation Time"); ui->customPlot->replot(); */ ui->velocityPlot->clearPlottables(); ui->velocityPlot->clearGraphs(); ui->velocityPlot->clearItems(); ui->velocityPlot->addGraph(); ui->velocityPlot->graph(0)->setPen(QPen(QColor(43, 239, 209))); // line color orange for first graph ui->velocityPlot->graph(0)->setBrush(QBrush(QColor(43, 239, 209, 20))); // first graph will be filled with translucent orange ui->velocityPlot->graph(0)->setData(velTimeData, velAmountData); ui->velocityPlot->setBackground(velPlotGradient); // ui->velocityPlot->xAxis->setRangeLower(velTimeData.first()); // ui->velocityPlot->xAxis->setRangeUpper(velTimeData.last()); ui->velocityPlot->yAxis->setRangeLower(0); ui->velocityPlot->yAxis->setRangeUpper(velMax+(velMax/10)); ui->velocityPlot->xAxis->grid()->setVisible(false); ui->velocityPlot->yAxis->grid()->setVisible(false); ui->velocityPlot->xAxis->grid()->setSubGridVisible(false); ui->velocityPlot->yAxis->grid()->setSubGridVisible(false); ui->velocityPlot->xAxis->setAutoTickStep(false); ui->velocityPlot->xAxis->setTickStep(3600 * 24); // 24 hr tickstep ui->velocityPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime); ui->velocityPlot->xAxis->setDateTimeSpec(Qt::UTC); ui->velocityPlot->xAxis->setDateTimeFormat("dd MMM"); ui->velocityPlot->xAxis->setTickLabelRotation(33); ui->velocityPlot->xAxis->setTickLabelColor(QColor(43, 239, 209, 95)); ui->velocityPlot->yAxis->setTickLabelColor(QColor(43, 239, 209, 95)); ui->velocityPlot->yAxis->setScaleType(QCPAxis::stLogarithmic); ui->velocityPlot->yAxis->setTickStep(1000); ui->velocityPlot->xAxis->setLabelColor(QColor(43, 239, 209, 95)); ui->velocityPlot->yAxis->setLabelColor(QColor(43, 239, 209, 95)); ui->velocityPlot->yAxis->setLabel("VCN"); ui->velocityPlot->xAxis->setTickLabels(true); //ui->velocityPlot->xAxis->setLabel("Financial Velocity"); ui->velocityPlot->rescaleAxes(); ui->velocityPlot->replot(); }
void Group::ResetInstances(InstanceResetMethod method, Player* SendMsgTo) { if (isBGGroup()) return; // method can be INSTANCE_RESET_ALL, INSTANCE_RESET_CHANGE_DIFFICULTY, INSTANCE_RESET_GROUP_DISBAND // we assume that when the difficulty changes, all instances that can be reset will be Difficulty diff = GetDifficulty(); for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { DungeonPersistentState* state = itr->second.state; const MapEntry* entry = sMapStore.LookupEntry(itr->first); if (!entry || (!state->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)) { ++itr; continue; } if (method == INSTANCE_RESET_ALL) { // the "reset all instances" method can only reset normal maps if (entry->map_type == MAP_RAID || diff == DUNGEON_DIFFICULTY_HEROIC) { ++itr; continue; } } bool isEmpty = true; // if the map is loaded, reset it if (Map* map = sMapMgr.FindMap(state->GetMapId(), state->GetInstanceId())) if (map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !state->CanReset())) isEmpty = ((DungeonMap*)map)->Reset(method); if (SendMsgTo) { if (isEmpty) SendMsgTo->SendResetInstanceSuccess(state->GetMapId()); else SendMsgTo->SendResetInstanceFailed(0, state->GetMapId()); } if (isEmpty || method == INSTANCE_RESET_GROUP_DISBAND || method == INSTANCE_RESET_CHANGE_DIFFICULTY) { // do not reset the instance, just unbind if others are permanently bound to it if (state->CanReset()) state->DeleteFromDB(); else CharacterDatabase.PExecute("DELETE FROM group_instance WHERE instance = '%u'", state->GetInstanceId()); // i don't know for sure if hash_map iterators m_boundInstances[diff].erase(itr); itr = m_boundInstances[diff].begin(); // this unloads the instance save unless online players are bound to it // (eg. permanent binds or GM solo binds) state->RemoveGroup(this); } else ++itr; } }
/* Called from AddInstanceSave */ void InstanceSave::SaveToDB() { // save instance data too std::string data; uint32 completedEncounters = 0; Map* map = sMapMgr->FindMap(GetMapId(), m_instanceid); if (map) { ASSERT(map->IsDungeon()); if (InstanceScript* instanceScript = ((InstanceMap*)map)->GetInstanceScript()) { data = instanceScript->GetSaveData(); completedEncounters = instanceScript->GetCompletedEncounterMask(); } } CharacterDatabase.PQuery("INSERT INTO instance (id, map, resettime, difficulty, completedEncounters, data) VALUES ('%u', '%u', '%u', '%u', '%u', '%s')", m_instanceid, GetMapId(), uint32(GetResetTimeForDB()), uint8(GetDifficulty()), completedEncounters, data.c_str()); }
void JustDied(Unit* /*killer*/) { if (_instance && GetDifficulty() == RAID_DIFFICULTY_10MAN_NORMAL) if (Creature* faerlina = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_FAERLINA))) DoCast(faerlina, SPELL_WIDOWS_EMBRACE); }
static duk_ret_t API__getinfo ( duk_context * ctx ) { duk_idx_t idx; idx = duk_push_object(ctx); duk_push_string ( ctx, FormatFullVersion().c_str() ); duk_put_prop_string ( ctx, idx, "version" ); duk_push_int ( ctx, PROTOCOL_VERSION ); duk_put_prop_string ( ctx, idx, "protocolversion" ); duk_push_int ( ctx, pwalletMain->GetVersion() ); duk_put_prop_string ( ctx, idx, "walletversion" ); duk_push_number ( ctx, (double) pwalletMain->GetBalance() / COIN ); duk_put_prop_string ( ctx, idx, "balance" ); duk_push_number ( ctx, (double) pwalletMain->GetNewMint() / COIN ); duk_put_prop_string ( ctx, idx, "newmint" ); duk_push_number ( ctx, (double) pwalletMain->GetStake() / COIN ); duk_put_prop_string ( ctx, idx, "stake" ); duk_push_int ( ctx, nBestHeight ); duk_put_prop_string ( ctx, idx, "blocks" ); duk_push_number ( ctx, (double) pindexBest->nMoneySupply / COIN ); duk_put_prop_string ( ctx, idx, "moneysupply" ); duk_push_int ( ctx, vNodes.size() ); duk_put_prop_string ( ctx, idx, "connections" ); duk_push_string ( ctx, (fUseProxy ? addrProxy.ToStringIPPort().c_str() : "") ); duk_put_prop_string ( ctx, idx, "proxy" ); duk_push_string ( ctx, addrSeenByPeer.ToStringIP().c_str() ); duk_put_prop_string ( ctx, idx, "ip" ); duk_push_number ( ctx, GetDifficulty(NULL) ); duk_put_prop_string ( ctx, idx, "difficulty" ); duk_push_boolean ( ctx, fTestNet ); duk_put_prop_string ( ctx, idx, "testnet" ); duk_push_number ( ctx, pwalletMain->GetOldestKeyPoolTime() ); duk_put_prop_string ( ctx, idx, "keypoololdest" ); duk_push_int ( ctx, pwalletMain->GetKeyPoolSize() ); duk_put_prop_string ( ctx, idx, "keypoolsize" ); duk_push_number ( ctx, nTransactionFee ); duk_put_prop_string ( ctx, idx, "paytxfee" ); if (pwalletMain->IsCrypted()) { duk_push_int ( ctx, nWalletUnlockTime / 1000 ); duk_put_prop_string ( ctx, idx, "unlocked_until" ); } duk_push_string ( ctx, GetWarnings("statusbar").c_str() ); duk_put_prop_string ( ctx, idx, "errors" ); return 1; }