From 3c5c46ff33da45b7da1ea0e6293aa9625f632238 Mon Sep 17 00:00:00 2001 From: mik1893 Date: Mon, 1 Sep 2014 11:15:16 +0200 Subject: Core/Spells: Stormstrike should stack for different casters Solve issue when 2 enhancement shamans are attacking same target --- src/server/game/Spells/SpellMgr.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 8e0c8c8bd01..3e835f8dd91 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -3312,6 +3312,9 @@ void SpellMgr::LoadSpellInfoCorrections() case 59630: // Black Magic spellInfo->Attributes |= SPELL_ATTR0_PASSIVE; break; + case 17364: // Stormstrike + spellInfo->AttributesEx3 |= SPELL_ATTR3_STACK_FOR_DIFF_CASTERS; + break; // ULDUAR SPELLS // case 62374: // Pursued (Flame Leviathan) -- cgit v1.2.3 From cfc0c50b5e3bc84310417c5146ce0d5901e39fc5 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sun, 7 Sep 2014 21:03:25 +0200 Subject: Core/Misc: dropped obsolete GameObject::GetGameObject method --- src/server/game/Entities/GameObject/GameObject.cpp | 5 -- src/server/game/Entities/GameObject/GameObject.h | 1 - .../EasternKingdoms/Deadmines/boss_mr_smite.cpp | 2 +- .../EasternKingdoms/Gnomeregan/gnomeregan.cpp | 44 +++++------- .../Scholomance/boss_darkmaster_gandling.cpp | 79 +++++++++++++--------- .../TrialOfTheChampion/trial_of_the_champion.cpp | 2 +- .../instance_trial_of_the_crusader.cpp | 5 +- .../TrialOfTheCrusader/trial_of_the_crusader.cpp | 4 +- .../IcecrownCitadel/boss_deathbringer_saurfang.cpp | 6 -- .../Northrend/IcecrownCitadel/icecrown_citadel.cpp | 9 +-- .../IcecrownCitadel/instance_icecrown_citadel.cpp | 25 +++---- .../scripts/Northrend/Naxxramas/boss_sapphiron.cpp | 2 +- 12 files changed, 83 insertions(+), 101 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 3c33159cf1e..f45d3a071e1 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -892,11 +892,6 @@ void GameObject::DeleteFromDB() WorldDatabase.Execute(stmt); } -GameObject* GameObject::GetGameObject(WorldObject& object, uint64 guid) -{ - return object.GetMap()->GetGameObject(guid); -} - /*********************************************************/ /*** QUEST SYSTEM ***/ /*********************************************************/ diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index f551ab2046c..6807fbf9387 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -643,7 +643,6 @@ class GameObject : public WorldObject, public GridObject, public Map bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0); void Update(uint32 p_time) override; - static GameObject* GetGameObject(WorldObject& object, uint64 guid); GameObjectTemplate const* GetGOInfo() const { return m_goInfo; } GameObjectData const* GetGOData() const { return m_goData; } GameObjectValue const* GetGOValue() const { return &m_goValue; } diff --git a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp index b0222413513..7338620a8b2 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/boss_mr_smite.cpp @@ -133,7 +133,7 @@ public: ++uiHealth; DoCastAOE(SPELL_SMITE_STOMP, false); SetCombatMovement(false); - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_SMITE_CHEST))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_SMITE_CHEST))) { me->GetMotionMaster()->Clear(); me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 3.0f, go->GetPositionY(), go->GetPositionZ()); diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp index 220cf0c92b4..d009986651a 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.cpp @@ -142,56 +142,48 @@ public: uiPhase = uiPhaseStep; } - void CaveDestruction(bool bBool) + void CaveDestruction(bool isRight) { if (GoSummonList.empty()) return; for (std::list::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) { - if (GameObject* go = GameObject::GetGameObject(*me, *itr)) - { - if (go) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr)) + { + if (Creature* trigger = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, 1)) { - if (Creature* trigger = go->SummonTrigger(go->GetPositionX(), go->GetPositionY(), go->GetPositionZ(), 0, 1)) - { - //visual effects are not working! - trigger->CastSpell(trigger, 11542, true); - trigger->CastSpell(trigger, 35470, true); - } - go->RemoveFromWorld(); - //go->CastSpell(me, 12158); makes all die?! + //visual effects are not working! + trigger->CastSpell(trigger, 11542, true); + trigger->CastSpell(trigger, 35470, true); } - } + go->RemoveFromWorld(); + //go->CastSpell(me, 12158); makes all die?! + } } - if (bBool) - { - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) - instance->HandleGameObject(0, false, go); - }else - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) - instance->HandleGameObject(0, false, go); + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT))) + instance->HandleGameObject(0, false, go); } void SetInFace(bool isRight) { - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(isRight ? DATA_GO_CAVE_IN_RIGHT : DATA_GO_CAVE_IN_LEFT))) me->SetFacingToObject(go); } void RestoreAll() { - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) instance->HandleGameObject(0, false, go); - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) instance->HandleGameObject(0, false, go); if (!GoSummonList.empty()) for (std::list::const_iterator itr = GoSummonList.begin(); itr != GoSummonList.end(); ++itr) { - if (GameObject* go = GameObject::GetGameObject(*me, *itr)) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, *itr)) go->RemoveFromWorld(); } @@ -406,7 +398,7 @@ public: SetInFace(true); Talk(SAY_BLASTMASTER_5); Summon(1); - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_RIGHT))) instance->HandleGameObject(0, true, go); NextStep(3000, true); break; @@ -452,7 +444,7 @@ public: case 16: Talk(SAY_BLASTMASTER_14); SetInFace(false); - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_GO_CAVE_IN_LEFT))) instance->HandleGameObject(0, true, go); NextStep(2000, true); break; diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp index 9a1f8f14557..0386341ed0c 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_darkmaster_gandling.cpp @@ -162,52 +162,58 @@ class spell_shadow_portal : public SpellScriptLoader { PrepareSpellScript(spell_shadow_portal_SpellScript); + bool Load() override + { + _instance = GetCaster()->GetInstanceScript(); + return _instance != nullptr; + } + void HandleCast(SpellEffIndex /*effIndex*/) { - Creature* caster = GetCaster()->ToCreature(); - int8 attempts = 0; - int32 spell_to_cast =0; + Unit* caster = GetCaster(); + uint8 attempts = 0; + uint32 spellId = 0; - while (!spell_to_cast) + while (!spellId) { if (attempts++ >= 6) break; switch (urand(0, 5)) { case ROOM_HALL_OF_SECRETS: - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_RAVENIAN))->GetGoState() == GO_STATE_ACTIVE) - spell_to_cast = SPELL_SHADOW_PORTAL_HALLOFSECRETS; + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_RAVENIAN))) + if (go->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_HALLOFSECRETS; break; case ROOM_HALL_OF_THE_DAMNED: - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_THEOLEN))->GetGoState() == GO_STATE_ACTIVE) - spell_to_cast = SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED; + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_THEOLEN))) + if (go->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_HALLOFTHEDAMNED; break; case ROOM_THE_COVEN: - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_MALICIA))->GetGoState() == GO_STATE_ACTIVE) - spell_to_cast = SPELL_SHADOW_PORTAL_THECOVEN; + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_MALICIA))) + if (go->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_THECOVEN; break; case ROOM_THE_SHADOW_VAULT: - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_ILLUCIA))->GetGoState() == GO_STATE_ACTIVE) - spell_to_cast = SPELL_SHADOW_PORTAL_THESHADOWVAULT; + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_ILLUCIA))) + if (go->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_THESHADOWVAULT; break; case ROOM_BAROV_FAMILY_VAULT: - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_BAROV))->GetGoState() == GO_STATE_ACTIVE) - spell_to_cast = SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT; + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_BAROV))) + if (go->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_BAROVFAMILYVAULT; break; case ROOM_VAULT_OF_THE_RAVENIAN: - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (GameObject::GetGameObject(*caster, instance->GetData64(GO_GATE_POLKELT))->GetGoState() == GO_STATE_ACTIVE) - spell_to_cast = SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN; + if (GameObject* go = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(GO_GATE_POLKELT))) + if (go->GetGoState() == GO_STATE_ACTIVE) + spellId = SPELL_SHADOW_PORTAL_VAULTOFTHERAVENIAN; break; } - if (spell_to_cast) - GetHitUnit()->CastSpell(GetHitUnit(), spell_to_cast); + if (spellId) + GetHitUnit()->CastSpell(GetHitUnit(), spellId); } } @@ -215,6 +221,9 @@ class spell_shadow_portal : public SpellScriptLoader { OnEffectHitTarget += SpellEffectFn(spell_shadow_portal_SpellScript::HandleCast, EFFECT_0, SPELL_EFFECT_DUMMY); } + + private: + InstanceScript* _instance; }; SpellScript* GetSpellScript() const override @@ -276,12 +285,17 @@ class spell_shadow_portal_rooms : public SpellScriptLoader { PrepareSpellScript(spell_shadow_portal_rooms_SpellScript); + bool Load() override + { + _instance = GetCaster()->GetInstanceScript(); + return _instance != nullptr; + } + void HandleSendEvent(SpellEffIndex effIndex) { // If only one player in threat list fail spell - Creature* Summoned = NULL; - Creature* caster = GetCaster()->ToCreature(); + Unit* caster = GetCaster(); int8 pos_to_summon = 0; int8 phase_to_set = 0; @@ -323,21 +337,19 @@ class spell_shadow_portal_rooms : public SpellScriptLoader break; } - if (gate_to_close && (GetCaster()->GetMap()->GetId() == 289)) + if (gate_to_close && (caster->GetMap()->GetId() == 289)) { for (uint8 i = 0; i < 3; ++i) { - Summoned = GetCaster()->SummonCreature(NPC_RISEN_GUARDIAN, SummonPos[pos_to_summon++], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); - if (Summoned) + if (Creature* Summoned = caster->SummonCreature(NPC_RISEN_GUARDIAN, SummonPos[pos_to_summon++], TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) { Summoned->GetMotionMaster()->MoveRandom(5); Summoned->AI()->SetData(0, phase_to_set); } } - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) - if (GameObject* gate = GameObject::GetGameObject(*caster, instance->GetData64(gate_to_close))) - gate->SetGoState(GO_STATE_READY); + if (GameObject* gate = ObjectAccessor::GetGameObject(*caster, _instance->GetData64(gate_to_close))) + gate->SetGoState(GO_STATE_READY); } } @@ -345,6 +357,9 @@ class spell_shadow_portal_rooms : public SpellScriptLoader { OnEffectHit += SpellEffectFn(spell_shadow_portal_rooms_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT); } + + private: + InstanceScript* _instance; }; SpellScript* GetSpellScript() const override diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index e073d08ef1d..f601f06e16c 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -138,7 +138,7 @@ public: break; case DATA_IN_POSITION: //movement done. me->GetMotionMaster()->MovePoint(1, 735.81f, 661.92f, 412.39f); - if (GameObject* go = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE))) instance->HandleGameObject(go->GetGUID(), false); NextStep(10000, false, 3); break; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index 3b919a778b3..949ee652d81 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -96,11 +96,10 @@ class instance_trial_of_the_crusader : public InstanceMapScript // make sure Anub'arak isnt missing and floor is destroyed after a crash if (GetBossState(BOSS_LICH_KING) == DONE && TrialCounter && GetBossState(BOSS_ANUBARAK) != DONE) { - Creature* anubArak = ObjectAccessor::GetCreature(*player, GetData64(NPC_ANUBARAK)); - if (!anubArak) + if (Creature* anubArak = ObjectAccessor::GetCreature(*player, GetData64(NPC_ANUBARAK))) anubArak = player->SummonCreature(NPC_ANUBARAK, AnubarakLoc[0].GetPositionX(), AnubarakLoc[0].GetPositionY(), AnubarakLoc[0].GetPositionZ(), 3, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); - if (GameObject* floor = GameObject::GetGameObject(*player, GetData64(GO_ARGENT_COLISEUM_FLOOR))) + if (GameObject* floor = ObjectAccessor::GetGameObject(*player, GetData64(GO_ARGENT_COLISEUM_FLOOR))) floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); } } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 7829d1be627..b068b458073 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -201,7 +201,7 @@ class npc_announcer_toc10 : public CreatureScript } else if (instance->GetBossState(BOSS_LICH_KING) != DONE) { - if (GameObject* floor = GameObject::GetGameObject(*player, instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) + if (GameObject* floor = ObjectAccessor::GetGameObject(*player, instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) floor->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); creature->CastSpell(creature, SPELL_CORPSE_TELEPORT, false); @@ -318,7 +318,7 @@ class boss_lich_king_toc : public CreatureScript break; case 5080: { - if (GameObject* go = GameObject::GetGameObject(*me, _instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, _instance->GetData64(GO_ARGENT_COLISEUM_FLOOR))) { go->SetDisplayId(DISPLAYID_DESTROYED_FLOOR); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_NODESPAWN); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index 4b9308fc12d..2909946a0db 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -305,12 +305,6 @@ class boss_deathbringer_saurfang : public CreatureScript _introDone = true; - if (GameObject* teleporter = GameObject::GetGameObject(*me, instance->GetData64(GO_SCOURGE_TRANSPORTER_DEATHBRINGER))) - { - instance->HandleGameObject(0, false, teleporter); - teleporter->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } - Talk(SAY_AGGRO); events.ScheduleEvent(EVENT_SUMMON_BLOOD_BEAST, 30000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_BERSERK, IsHeroic() ? 360000 : 480000, 0, PHASE_COMBAT); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index e403e37835c..23569ba77c2 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -2120,15 +2120,8 @@ class at_icc_shutdown_traps : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override { if (InstanceScript* instance = player->GetInstanceScript()) - { instance->SetData(DATA_UPPERSPIRE_TELE_ACT, DONE); - uint64 teleporterGUID = instance->GetData64(GO_SCOURGE_TRANSPORTER_UPPERSPIRE); - if (GameObject* go = instance->instance->GetGameObject(teleporterGUID)) - { - go->SetGoState(GO_STATE_ACTIVE); - go->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); - } - } + return true; } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index f5f59e5d1fe..3f429183fa0 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -773,20 +773,6 @@ class instance_icecrown_citadel : public InstanceMapScript return DeathbringerSaurfangEventGUID; case GO_SAURFANG_S_DOOR: return DeathbringerSaurfangDoorGUID; - case GO_SCOURGE_TRANSPORTER_LICHKING: - return TeleporterLichKingGUID; - case GO_SCOURGE_TRANSPORTER_UPPERSPIRE: - return TeleporterUpperSpireGUID; - case GO_SCOURGE_TRANSPORTER_LIGHTSHAMMER: - return TeleporterLightsHammerGUID; - case GO_SCOURGE_TRANSPORTER_RAMPART: - return TeleporterRampartsGUID; - case GO_SCOURGE_TRANSPORTER_DEATHBRINGER: - return TeleporterDeathBringerGUID; - case GO_SCOURGE_TRANSPORTER_ORATORY: - return TeleporterOratoryGUID; - case GO_SCOURGE_TRANSPORTER_SINDRAGOSA: - return TeleporterSindragosaGUID; case DATA_FESTERGUT: return FestergutGUID; case DATA_ROTFACE: @@ -911,7 +897,12 @@ class instance_icecrown_citadel : public InstanceMapScript { if (GameObject* teleporter = instance->GetGameObject(TeleporterDeathBringerGUID)) SetTeleporterState(teleporter, true); - + break; + } + case IN_PROGRESS: + { + if (GameObject* teleporter = instance->GetGameObject(TeleporterDeathBringerGUID)) + SetTeleporterState(teleporter, false); break; } default: @@ -1126,7 +1117,11 @@ class instance_icecrown_citadel : public InstanceMapScript case DATA_UPPERSPIRE_TELE_ACT: UpperSpireTeleporterActiveState = data; if (UpperSpireTeleporterActiveState == DONE) + { + if (GameObject* go = instance->GetGameObject(TeleporterUpperSpireGUID)) + SetTeleporterState(go, true); SaveToDB(); + } break; default: break; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index ea345c0dee0..0f5320a8fa1 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -375,7 +375,7 @@ class boss_sapphiron : public CreatureScript for (IceBlockMap::const_iterator itr = _iceblocks.begin(); itr != _iceblocks.end(); ++itr) { - if (GameObject* go = GameObject::GetGameObject(*me, itr->second)) + if (GameObject* go = ObjectAccessor::GetGameObject(*me, itr->second)) { if (go->IsInBetween(me, target, 2.0f) && me->GetExactDist2d(target->GetPositionX(), target->GetPositionY()) - me->GetExactDist2d(go->GetPositionX(), go->GetPositionY()) < 5.0f) -- cgit v1.2.3 From 1e34aa9dcfbab5d4dec3d10dcc7978c9f9db3e24 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Sun, 7 Sep 2014 21:35:37 +0200 Subject: Removed redundant cast to c_str() in ConfigMgr::Reload function. cppcheck performance warning: [src/server/shared/Configuration/Config.cpp:62]: (performance) Passing the result of c_str() to a function that takes std::string as argument no. 1 is slow and redundant. --- src/server/shared/Configuration/Config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 6b83f562520..21bbd063b53 100644 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -59,7 +59,7 @@ bool ConfigMgr::LoadInitial(std::string const& file, std::string& error) bool ConfigMgr::Reload(std::string& error) { - return LoadInitial(_filename.c_str(), error); + return LoadInitial(_filename, error); } std::string ConfigMgr::GetStringDefault(std::string const& name, const std::string& def) -- cgit v1.2.3 From f2655b2d2d969e47630b7ed07c4517a1b3004c97 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 7 Sep 2014 22:22:16 +0200 Subject: Core: Remove whitespace (again, again, ...) --- CONTRIBUTING.md | 22 +++++++++++----------- README.md | 2 +- src/server/scripts/Commands/cs_server.cpp | 2 +- .../EasternKingdoms/AlteracValley/boss_balinda.cpp | 2 +- .../EasternKingdoms/Stratholme/stratholme.cpp | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 99fb588c1cf..b83aaebfee0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,9 +14,9 @@ When creating patches read: - [WDB Fields](http://www.trinitycore.org/f/topic/58-wdb-fields/) - [Git Squash](https://ariejan.net/2011/07/05/git-squash-your-latests-commits-into-one/) -We suggest you to create one branch for each `C++` based fix: on that way you can continue creating more fixes without having to wait to get one pull request merged. -For the `SQL` files of `C++` based fixes the naming schema is: `YYYY_MM_DD_i_database_description.sql`, where `YYYY_MM_DD` is the date of the fix, `i_database` is the *ith* sql created that day for `database`. -When doing changes to `auth` or `characters` database remember to update the base files (`/sql/base/*`). +We suggest you to create one branch for each `C++` based fix: on that way you can continue creating more fixes without having to wait to get one pull request merged. +For the `SQL` files of `C++` based fixes the naming schema is: `YYYY_MM_DD_i_database_description.sql`, where `YYYY_MM_DD` is the date of the fix, `i_database` is the *ith* sql created that day for `database`. +When doing changes to `auth` or `characters` database remember to update the base files (`/sql/base/*`). For SQL only fixes [create a ticket](https://github.com/TrinityCore/TrinityCore/issues/new). Wiki @@ -30,21 +30,21 @@ You are welcome to create an account and help us improve and extend the wiki. Issues ====== -Read [this](http://www.trinitycore.org/f/topic/37-the-trinitycore-issuetracker-and-you/) before creating a ticket. +Read [this](http://www.trinitycore.org/f/topic/37-the-trinitycore-issuetracker-and-you/) before creating a ticket. If you have problems with TrinityCore instalation, read http://www.trinitycore.org/f/topic/1518-trouble-with-your-trinity-install-readme-1st-faqs/ Requirements ============ -Platform: Linux, Windows or Mac -Processor with SSE2 support -Boost ≥ 1.4.9 +Platform: Linux, Windows or Mac +Processor with SSE2 support +Boost ≥ 1.4.9 MySQL ≥ 5.1.0 -CMake ≥ 2.8.11.2 / 2.8.9 (Windows / Linux) -OpenSSL ≥ 1.0.0 -GCC ≥ 4.7.2 (Linux only) +CMake ≥ 2.8.11.2 / 2.8.9 (Windows / Linux) +OpenSSL ≥ 1.0.0 +GCC ≥ 4.7.2 (Linux only) MS Visual Studio ≥ 12 (2013) (Windows only) -In case you choose Linux, we recommend to use Debian 7, it's the Linux we use to test compilations. +In case you choose Linux, we recommend to use Debian 7, it's the Linux we use to test compilations. Remember 4.3.4 branch is alpha, only intended for development, we don't recomend this branch to run a server. diff --git a/README.md b/README.md index 33fea30e36e..e91810b523f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ![logo](http://www.trinitycore.org/f/public/style_images/1_trinitycore.png) TrinityCore -[![Coverity Scan Build Status](https://scan.coverity.com/projects/435/badge.svg)](https://scan.coverity.com/projects/435) +[![Coverity Scan Build Status](https://scan.coverity.com/projects/435/badge.svg)](https://scan.coverity.com/projects/435) `3.3.5`: [![3.3.5 Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=master)](https://travis-ci.org/TrinityCore/TrinityCore) `4.3.4`: [![4.3.4 Build Status](https://travis-ci.org/TrinityCore/TrinityCore.svg?branch=4.3.4)](https://travis-ci.org/TrinityCore/TrinityCore) diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp index f828b66a93a..74a947e42e4 100644 --- a/src/server/scripts/Commands/cs_server.cpp +++ b/src/server/scripts/Commands/cs_server.cpp @@ -288,7 +288,7 @@ public: return false; sWorld->SetRecordDiffInterval(newTime); - printf("Record diff every %u ms\n", newTime); + printf("Record diff every %i ms\n", newTime); return true; } diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index 87272037755..ca46ff36079 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -173,7 +173,7 @@ public: DoMeleeAttackIfReady(); } - + private: EventMap events; SummonList summons; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 889fbe8fdc9..9c733677b42 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -149,7 +149,7 @@ public: void JustSummoned(Creature* summoned) override { summoned->CastSpell(summoned, SPELL_SOUL_FREED, false); - + if (Player* player = ObjectAccessor::GetPlayer(*me, Tagger)) summoned->GetMotionMaster()->MoveFollow(player, 0.0f, 0.0f); } -- cgit v1.2.3 From d5e945eec886d8a80987bb2a07e853107e3bb647 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 8 Sep 2014 00:19:02 +0200 Subject: Core/Misc: Named an unknown creature type flag --- src/server/game/Miscellaneous/SharedDefines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index 5309229b0fc..0e6966e6678 100644 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -2586,7 +2586,7 @@ enum CreatureTypeFlags CREATURE_TYPEFLAGS_DEAD_INTERACT = 0x00000080, // Player can interact with the creature if its dead (not player dead) CREATURE_TYPEFLAGS_HERBLOOT = 0x00000100, // Can be looted by herbalist CREATURE_TYPEFLAGS_MININGLOOT = 0x00000200, // Can be looted by miner - CREATURE_TYPEFLAGS_UNK10 = 0x00000400, + CREATURE_TYPEFLAGS_DONT_LOG_DEATH = 0x00000400, // Death event will not show up in combat log CREATURE_TYPEFLAGS_MOUNTED_COMBAT = 0x00000800, // Creature can remain mounted when entering combat CREATURE_TYPEFLAGS_AID_PLAYERS = 0x00001000, // ? Can aid any player in combat if in range? CREATURE_TYPEFLAGS_UNK13 = 0x00002000, -- cgit v1.2.3 From 3930606032c751f3eedca81c8c75f94cbc8ff0e2 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Mon, 8 Sep 2014 05:02:03 +0200 Subject: Core/Scripts: made BossAI::CheckInRoom virtual --- src/server/game/AI/ScriptedAI/ScriptedCreature.h | 2 +- .../ChamberOfAspects/RubySanctum/boss_halion.cpp | 21 +++++++++++++-------- .../IcecrownCitadel/boss_blood_prince_council.cpp | 12 ++++++------ 3 files changed, 20 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 788da26ea4a..f11769f1d1d 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -370,7 +370,7 @@ class BossAI : public ScriptedAI void _JustDied(); void _JustReachedHome() { me->setActive(false); } - bool CheckInRoom() + virtual bool CheckInRoom() { if (CheckBoundary(me)) return true; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index dbf3a185120..9d44e7d884f 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -262,9 +262,21 @@ struct generic_halionAI : public BossAI } } + bool CheckInRoom() override + { + // Rough radius, it is not an exactly perfect circle + if (me->GetDistance2d(HalionControllerSpawnPos.GetPositionX(), HalionControllerSpawnPos.GetPositionY()) > 48.5f) + { + if (Creature* controller = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HALION_CONTROLLER))) + controller->AI()->EnterEvadeMode(); + return false; + } + return true; + } + void UpdateAI(uint32 diff) override { - if (!UpdateVictim() || me->HasUnitState(UNIT_STATE_CASTING)) + if (!UpdateVictim() || !CheckInRoom() || me->HasUnitState(UNIT_STATE_CASTING)) return; events.Update(diff); @@ -394,13 +406,6 @@ class boss_halion : public CreatureScript if (events.IsInPhase(PHASE_TWO)) return; - // Rough radius, it is not an exactly perfect circle - if (me->GetDistance2d(HalionControllerSpawnPos.GetPositionX(), HalionControllerSpawnPos.GetPositionY()) > 48.5f) - { - EnterEvadeMode(); - return; - } - generic_halionAI::UpdateAI(diff); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 3aebed81f0b..4b3c50d1388 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -510,7 +510,7 @@ class boss_prince_keleseth_icc : public CreatureScript } } - bool CheckRoom() + bool CheckInRoom() override { if (!CheckBoundary(me)) { @@ -529,7 +529,7 @@ class boss_prince_keleseth_icc : public CreatureScript void UpdateAI(uint32 diff) override { - if (!UpdateVictim() || !CheckRoom()) + if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); @@ -729,7 +729,7 @@ class boss_prince_taldaram_icc : public CreatureScript } } - bool CheckRoom() + bool CheckInRoom() override { if (!CheckBoundary(me)) { @@ -748,7 +748,7 @@ class boss_prince_taldaram_icc : public CreatureScript void UpdateAI(uint32 diff) override { - if (!UpdateVictim() || !CheckRoom()) + if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); @@ -968,7 +968,7 @@ class boss_prince_valanar_icc : public CreatureScript } } - bool CheckRoom() + bool CheckInRoom() override { if (!CheckBoundary(me)) { @@ -987,7 +987,7 @@ class boss_prince_valanar_icc : public CreatureScript void UpdateAI(uint32 diff) override { - if (!UpdateVictim() || !CheckRoom()) + if (!UpdateVictim() || !CheckInRoom()) return; events.Update(diff); -- cgit v1.2.3 From 54e201b8b97912b45f5ae942c5b71abb1cf58640 Mon Sep 17 00:00:00 2001 From: Odyssey Date: Mon, 8 Sep 2014 15:56:00 +0100 Subject: Scripts/Commands: Allow to set a custom duration to the Freeze command applied Aura - Allow to set a default duration for the Freeze Aura in worldserver.conf - Handle the .freeze and .unfreeze command custom effects through the Freeze AuraScript - Make players able to eventually unfreeze by themselves since the aura will expire without someone having to use .unfreeze - Make .freeze command usable with the following syntax: * .freeze (with a targeted player) * .freeze duration_in_seconds (with a targeted player) * .freeze playername duration (if duration is an invalid value it will be defaulted to the config one) * .freeze playername (in this case, duration will be defaulted to the config value) - Make .listfreeze command able to show the remaining freeze duration on all affected players Closes #12972 --- .../world/2014_09_08_01_world_freeze_cmd.sql | 17 +++ src/server/game/Miscellaneous/Language.h | 4 +- src/server/game/World/World.cpp | 1 + src/server/game/World/World.h | 1 + src/server/scripts/Commands/cs_misc.cpp | 150 +++++++++++++-------- src/server/scripts/Spells/spell_generic.cpp | 74 ++++++++++ .../Database/Implementation/CharacterDatabase.cpp | 2 +- src/server/worldserver/worldserver.conf.dist | 8 ++ 8 files changed, 197 insertions(+), 60 deletions(-) create mode 100644 sql/updates/world/2014_09_08_01_world_freeze_cmd.sql (limited to 'src') diff --git a/sql/updates/world/2014_09_08_01_world_freeze_cmd.sql b/sql/updates/world/2014_09_08_01_world_freeze_cmd.sql new file mode 100644 index 00000000000..e2c7d53336b --- /dev/null +++ b/sql/updates/world/2014_09_08_01_world_freeze_cmd.sql @@ -0,0 +1,17 @@ +-- GM Freeze Spell Script +DELETE FROM `spell_script_names` WHERE `spell_id`=9454; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (9454, 'spell_gen_gm_freeze'); + +-- Update Command Help +UPDATE `command` SET `help`='Syntax: .freeze [#player] [#duration] +Freezes #player for #duration (seconds) +Freezes the selected player if no arguments are given. +Default duration: GM.FreezeAuraDuration (worldserver.conf)' WHERE `name`='freeze'; + +-- Add new string to show the duration on the freeze upon using .listfreeze +DELETE FROM `trinity_string` WHERE `entry`=5019; +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(5019, '| %s - Status: %d seconds left'); + +-- Update old string to show if the duration is permanent +UPDATE `trinity_string` SET `content_default`='| %s - Status: Permanently frozen' WHERE `entry`=5006; diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index eceb0a8e7de..c1de3aae7cb 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1054,7 +1054,7 @@ enum TrinityStrings LANG_COMMAND_UNFREEZE = 5003, LANG_COMMAND_NO_FROZEN_PLAYERS = 5004, LANG_COMMAND_LIST_FREEZE = 5005, - LANG_COMMAND_FROZEN_PLAYERS = 5006, + LANG_COMMAND_PERMA_FROZEN_PLAYER = 5006, LANG_INSTANCE_RAID_GROUP_ONLY = 5007, LANG_INSTANCE_CLOSED = 5008, LANG_COMMAND_PLAYED_TO_ALL = 5009, @@ -1068,7 +1068,7 @@ enum TrinityStrings LANG_ARENA = 5016, LANG_RAID = 5017, //= 5018, - //= 5019, + LANG_COMMAND_TEMP_FROZEN_PLAYER = 5019, LANG_NPCINFO_PHASEMASK = 5020, LANG_NPCINFO_ARMOR = 5021, LANG_CHANNEL_ENABLE_OWNERSHIP = 5022, diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 5c65055f3c0..58e3cffa8de 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -856,6 +856,7 @@ void World::LoadConfigSettings(bool reload) m_int_configs[CONFIG_GM_VISIBLE_STATE] = sConfigMgr->GetIntDefault("GM.Visible", 2); m_int_configs[CONFIG_GM_CHAT] = sConfigMgr->GetIntDefault("GM.Chat", 2); m_int_configs[CONFIG_GM_WHISPERING_TO] = sConfigMgr->GetIntDefault("GM.WhisperingTo", 2); + m_int_configs[CONFIG_GM_FREEZE_DURATION] = sConfigMgr->GetIntDefault("GM.FreezeAuraDuration", 0); m_int_configs[CONFIG_GM_LEVEL_IN_GM_LIST] = sConfigMgr->GetIntDefault("GM.InGMList.Level", SEC_ADMINISTRATOR); m_int_configs[CONFIG_GM_LEVEL_IN_WHO_LIST] = sConfigMgr->GetIntDefault("GM.InWhoList.Level", SEC_ADMINISTRATOR); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 05bfcc21462..cc2078bc736 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -227,6 +227,7 @@ enum WorldIntConfigs CONFIG_GM_ACCEPT_TICKETS, CONFIG_GM_CHAT, CONFIG_GM_WHISPERING_TO, + CONFIG_GM_FREEZE_DURATION, CONFIG_GM_LEVEL_IN_GM_LIST, CONFIG_GM_LEVEL_IN_WHO_LIST, CONFIG_START_GM_LEVEL, diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index 80b7710cd21..3e7b242f3cc 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -2241,69 +2241,100 @@ public: static bool HandleFreezeCommand(ChatHandler* handler, char const* args) { - std::string name; - Player* player; - char const* TargetName = strtok((char*)args, " "); // get entered name - if (!TargetName) // if no name entered use target - { - player = handler->getSelectedPlayer(); - if (player) //prevent crash with creature as target - { - name = player->GetName(); - normalizePlayerName(name); - } - } - else // if name entered + Player* player = handler->getSelectedPlayer(); // Selected player, if any. Might be null. + uint32 freezeDuration = 0; // Freeze Duration (in seconds) + bool canApplyFreeze = false; // Determines if every possible argument is set so Freeze can be applied + bool getDurationFromConfig = false; // If there's no given duration, we'll retrieve the world cfg value later + + /* + Possible Freeze Command Scenarios: + case 1 - .freeze (without args and a selected player) + case 2 - .freeze duration (with a selected player) + case 3 - .freeze player duration + case 4 - .freeze player (without specifying duration) + */ + + // case 1: .freeze + if (!*args) { - name = TargetName; - normalizePlayerName(name); - player = sObjectAccessor->FindPlayerByName(name); + // Might have a selected player. We'll check it later + // Get the duration from world cfg + getDurationFromConfig = true; } - - if (!player) + else { - handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); - return true; + // Get the args that we might have (up to 2) + char const* arg1 = strtok((char*)args, " "); + char const* arg2 = strtok(NULL, " "); + + // Analyze them to see if we got either a playerName or duration or both + if (arg1) + { + if (isNumeric(arg1)) + { + // case 2: .freeze duration + // We have a selected player. We'll check him later + freezeDuration = uint32(atoi(arg1)); + canApplyFreeze = true; + } + else + { + // case 3 or 4: .freeze player duration | .freeze player + // find the player + std::string name = arg1; + normalizePlayerName(name); + player = sObjectAccessor->FindPlayerByName(name); + // Check if we have duration set + if (arg2 && isNumeric(arg2)) + { + freezeDuration = uint32(atoi(arg2)); + canApplyFreeze = true; + } + else + getDurationFromConfig = true; + } + } } - if (player == handler->GetSession()->GetPlayer()) + // Check if duration needs to be retrieved from config + if (getDurationFromConfig) { - handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR); - return true; + freezeDuration = sWorld->getIntConfig(CONFIG_GM_FREEZE_DURATION); + canApplyFreeze = true; } - // effect - if (player && (player != handler->GetSession()->GetPlayer())) + // Player and duration retrieval is over + if (canApplyFreeze) { - handler->PSendSysMessage(LANG_COMMAND_FREEZE, name.c_str()); - - // stop combat + make player unattackable + duel stop + stop some spells - player->setFaction(35); - player->CombatStop(); - if (player->IsNonMeleeSpellCast(true)) - player->InterruptNonMeleeSpells(true); - player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - - // if player class = hunter || warlock remove pet if alive - if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) + if (!player) // can be null if some previous selection failed + { + handler->SendSysMessage(LANG_COMMAND_FREEZE_WRONG); + return true; + } + else if (player == handler->GetSession()->GetPlayer()) + { + // Can't freeze himself + handler->SendSysMessage(LANG_COMMAND_FREEZE_ERROR); + return true; + } + else // Apply the effect { - if (Pet* pet = player->GetPet()) + // Add the freeze aura and set the proper duration + // Player combat status and flags are now handled + // in Freeze Spell AuraScript (OnApply) + Aura* freeze = player->AddAura(9454, player); + if (freeze) { - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - // not let dismiss dead pet - if (pet->IsAlive()) - player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); + if (freezeDuration) + freeze->SetDuration(freezeDuration * IN_MILLISECONDS); + handler->PSendSysMessage(LANG_COMMAND_FREEZE, player->GetName().c_str()); + // save player + player->SaveToDB(); + return true; } } - - if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454)) - Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player); - - // save player - player->SaveToDB(); } - - return true; + return false; } static bool HandleUnFreezeCommand(ChatHandler* handler, char const*args) @@ -2329,15 +2360,10 @@ public: { handler->PSendSysMessage(LANG_COMMAND_UNFREEZE, name.c_str()); - // Reset player faction + allow combat + allow duels - player->setFactionForRace(player->getRace()); - player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - // Remove Freeze spell (allowing movement and spells) + // Player Flags + Neutral faction removal is now + // handled on the Freeze Spell AuraScript (OnRemove) player->RemoveAurasDueToSpell(9454); - - // Save player - player->SaveToDB(); } else { @@ -2394,7 +2420,17 @@ public: { Field* fields = result->Fetch(); std::string player = fields[0].GetString(); - handler->PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, player.c_str()); + int32 remaintime = fields[1].GetInt32(); + // Save the frozen player to update remaining time in case of future .listfreeze uses + // before the frozen state expires + if (Player* frozen = sObjectAccessor->FindPlayerByName(player)) + frozen->SaveToDB(); + // Notify the freeze duration + if (remaintime == -1) // Permanent duration + handler->PSendSysMessage(LANG_COMMAND_PERMA_FROZEN_PLAYER, player.c_str()); + else + // show time left (seconds) + handler->PSendSysMessage(LANG_COMMAND_TEMP_FROZEN_PLAYER, player.c_str(), remaintime / IN_MILLISECONDS); } while (result->NextRow()); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 84e36b55c2c..e198a6a0c61 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3609,6 +3609,79 @@ class spell_gen_eject_all_passengers : public SpellScriptLoader } }; +enum GMFreeze +{ + SPELL_GM_FREEZE = 9454 +}; + +class spell_gen_gm_freeze : public SpellScriptLoader +{ + public: + spell_gen_gm_freeze() : SpellScriptLoader("spell_gen_gm_freeze") { } + + class spell_gen_gm_freeze_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_gm_freeze_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_GM_FREEZE)) + return false; + return true; + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // Do what was done before to the target in HandleFreezeCommand + if (Player* player = GetTarget()->ToPlayer()) + { + // stop combat + make player unattackable + duel stop + stop some spells + player->setFaction(35); + player->CombatStop(); + if (player->IsNonMeleeSpellCast(true)) + player->InterruptNonMeleeSpells(true); + player->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + + // if player class = hunter || warlock remove pet if alive + if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) + { + if (Pet* pet = player->GetPet()) + { + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + // not let dismiss dead pet + if (pet->IsAlive()) + player->RemovePet(pet, PET_SAVE_NOT_IN_SLOT); + } + } + } + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // Do what was done before to the target in HandleUnfreezeCommand + if (Player* player = GetTarget()->ToPlayer()) + { + // Reset player faction + allow combat + allow duels + player->setFactionForRace(player->getRace()); + player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + // save player + player->SaveToDB(); + } + } + + void Register() override + { + OnEffectApply += AuraEffectApplyFn(spell_gen_gm_freeze_AuraScript::OnApply, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + OnEffectRemove += AuraEffectRemoveFn(spell_gen_gm_freeze_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_MOD_STUN, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_gen_gm_freeze_AuraScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -3689,4 +3762,5 @@ void AddSC_generic_spell_scripts() new spell_gen_wg_water(); new spell_gen_whisper_gulch_yogg_saron_whisper(); new spell_gen_eject_all_passengers(); + new spell_gen_gm_freeze(); } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 0669d0b84f9..aa584d026fb 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -417,7 +417,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_DEL_CHARACTER_SOCIAL, "DELETE FROM character_social WHERE guid = ? AND friend = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_CHARACTER_SOCIAL_NOTE, "UPDATE character_social SET note = ? WHERE guid = ? AND friend = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_CHARACTER_POSITION, "UPDATE characters SET position_x = ?, position_y = ?, position_z = ?, orientation = ?, map = ?, zone = ?, trans_x = 0, trans_y = 0, trans_z = 0, transguid = 0, taxi_path = '' WHERE guid = ?", CONNECTION_ASYNC); - PrepareStatement(CHAR_SEL_CHARACTER_AURA_FROZEN, "SELECT characters.name FROM characters LEFT JOIN character_aura ON (characters.guid = character_aura.guid) WHERE character_aura.spell = 9454", CONNECTION_SYNCH); + PrepareStatement(CHAR_SEL_CHARACTER_AURA_FROZEN, "SELECT characters.name, character_aura.remaintime FROM characters LEFT JOIN character_aura ON (characters.guid = character_aura.guid) WHERE character_aura.spell = 9454", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHARACTER_ONLINE, "SELECT name, account, map, zone FROM characters WHERE online > 0", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID, "SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND guid = ?", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHAR_DEL_INFO_BY_NAME, "SELECT guid, deleteInfos_Name, deleteInfos_Account, deleteDate FROM characters WHERE deleteDate IS NOT NULL AND deleteInfos_Name LIKE CONCAT('%%', ?, '%%')", CONNECTION_SYNCH); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index b49f9ebd9ec..3fec13684da 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1547,6 +1547,14 @@ GM.Chat = 2 GM.WhisperingTo = 2 +# +# GM.FreezeAuraDuration +# Description: Allows to set a default duration to the Freeze Aura +# applied on players when using the .freeze command +# Default: 0 - (Original aura duration. Lasts until the .unfreeze command is used) +# N - (Aura duration if unspecified in .freeze command, in seconds) +GM.FreezeAuraDuration = 0 + # # GM.InGMList.Level # Description: Maximum GM level shown in GM list (if enabled) in non-GM state (.gm off). -- cgit v1.2.3 From e181af1b1c983c8dc492f20eb4720973f002c538 Mon Sep 17 00:00:00 2001 From: Nyeriah Date: Mon, 8 Sep 2014 17:10:46 -0300 Subject: Scripts/Onyxia Lair: Some small improvements to GUID storage as it's only used locally --- src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp | 17 +++++++++-------- .../Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp | 15 --------------- src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h | 2 -- 3 files changed, 9 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index 347c87b160b..1a0987625df 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -145,6 +145,8 @@ public: MovePoint = urand(0, 5); PointData = GetMoveData(); SummonWhelpCount = 0; + triggerGUID = 0; + tankGUID = 0; IsMoving = false; instance->SetData(DATA_ONYXIA_PHASE, Phase); @@ -153,17 +155,14 @@ public: void EnterCombat(Unit* /*who*/) override { + _EnterCombat(); Talk(SAY_AGGRO); - me->SetInCombatWithZone(); - - events.Reset(); events.ScheduleEvent(EVENT_FLAME_BREATH, urand(10000, 20000)); events.ScheduleEvent(EVENT_TAIL_SWEEP, urand(15000, 20000)); events.ScheduleEvent(EVENT_CLEAVE, urand(2000, 5000)); events.ScheduleEvent(EVENT_WING_BUFFET, urand(10000, 20000)); - instance->SetBossState(DATA_ONYXIA, IN_PROGRESS); instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } @@ -226,11 +225,11 @@ public: me->SetCanFly(false); me->SetDisableGravity(false); me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); - if (Creature* trigger = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_TRIGGER_GUID))) + if (Creature* trigger = ObjectAccessor::GetCreature(*me, triggerGUID)) me->Kill(trigger); me->SetReactState(REACT_AGGRESSIVE); // tank selection based on phase one. If tank is not there i take nearest one - if (Unit* tank = ObjectAccessor::GetUnit(*me, instance->GetData64(DATA_TANK_GUID))) + if (Unit* tank = ObjectAccessor::GetUnit(*me, tankGUID)) me->GetMotionMaster()->MoveChase(tank); else if (Unit* newtarget = SelectTarget(SELECT_TARGET_NEAREST, 0)) me->GetMotionMaster()->MoveChase(newtarget); @@ -246,7 +245,7 @@ public: me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, UNIT_BYTE1_FLAG_ALWAYS_STAND | UNIT_BYTE1_FLAG_HOVER); me->SetFacingTo(me->GetOrientation() + float(M_PI)); if (Creature * trigger = me->SummonCreature(NPC_TRIGGER, MiddleRoomLocation, TEMPSUMMON_CORPSE_DESPAWN)) - instance->SetData64(DATA_TRIGGER_GUID, trigger->GetGUID()); + triggerGUID = trigger->GetGUID(); me->GetMotionMaster()->MoveTakeoff(11, Phase2Floating); me->SetSpeed(MOVE_FLIGHT, 1.0f); Talk(SAY_PHASE_2_TRANS); @@ -329,7 +328,7 @@ public: { SetCombatMovement(false); Phase = PHASE_BREATH; - instance->SetData64(DATA_TANK_GUID, me->GetVictim()->GetGUID()); + tankGUID = me->GetVictim()->GetGUID(); me->SetReactState(REACT_PASSIVE); me->AttackStop(); me->GetMotionMaster()->MovePoint(10, Phase2Location); @@ -470,6 +469,8 @@ public: uint8 Phase; uint8 MovePoint; uint8 SummonWhelpCount; + uint64 triggerGUID; + uint64 tankGUID; bool IsMoving; }; diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 61b57d181a3..6aa50e71b17 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -54,8 +54,6 @@ public: SetBossNumber(EncounterCount); onyxiaGUID = 0; - triggerGUID = 0; - tankGUID = 0; onyxiaLiftoffTimer = 0; manyWhelpsCounter = 0; eruptTimer = 0; @@ -184,12 +182,6 @@ public: FloorEruptionGUIDQueue.push(data); eruptTimer = 2500; break; - case DATA_TRIGGER_GUID: - triggerGUID = data; - break; - case DATA_TANK_GUID: - tankGUID = data; - break; } } @@ -199,13 +191,6 @@ public: { case NPC_ONYXIA: return onyxiaGUID; - break; - case DATA_TRIGGER_GUID: - return triggerGUID; - break; - case DATA_TANK_GUID: - return tankGUID; - break; } return 0; diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h index 0c423f35de6..9fd73f7a977 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h +++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h @@ -38,8 +38,6 @@ enum Data64 { DATA_ONYXIA_GUID = 0, DATA_FLOOR_ERUPTION_GUID = 1, - DATA_TRIGGER_GUID = 2, - DATA_TANK_GUID = 3 }; enum OnyxiaPhases -- cgit v1.2.3