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 --- .../EasternKingdoms/Deadmines/boss_mr_smite.cpp | 2 +- .../EasternKingdoms/Gnomeregan/gnomeregan.cpp | 44 +++++------- .../Scholomance/boss_darkmaster_gandling.cpp | 79 +++++++++++++--------- 3 files changed, 66 insertions(+), 59 deletions(-) (limited to 'src/server/scripts/EasternKingdoms') 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 -- 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/server/scripts/EasternKingdoms') 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