diff options
Diffstat (limited to 'src')
| -rwxr-xr-x | src/server/game/Conditions/ConditionMgr.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/DungeonFinding/LFGMgr.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 28 | ||||
| -rwxr-xr-x | src/server/game/Entities/Player/Player.h | 6 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 4 | ||||
| -rwxr-xr-x | src/server/game/Movement/MotionMaster.cpp | 4 | ||||
| -rwxr-xr-x | src/server/game/Movement/MotionMaster.h | 2 | ||||
| -rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.cpp | 14 | ||||
| -rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.h | 3 | ||||
| -rw-r--r-- | src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/EasternKingdoms/stormwind_city.cpp | 74 | ||||
| -rwxr-xr-x | src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp | 105 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | 2 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp | 18 | ||||
| -rw-r--r-- | src/server/scripts/Northrend/dalaran.cpp | 13 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_generic.cpp | 78 |
16 files changed, 207 insertions, 150 deletions
diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 0bcd1a7864b..49b5d4cba65 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -63,7 +63,7 @@ bool Condition::Meets(Player* player, Unit* invoker) case CONDITION_REPUTATION_RANK: { if (FactionEntry const* faction = sFactionStore.LookupEntry(mConditionValue1)) - condMeets = uint32(player->GetReputationMgr().GetRank(faction)) == mConditionValue2; + condMeets = (mConditionValue2 & (1 << player->GetReputationMgr().GetRank(faction))); break; } case CONDITION_ACHIEVEMENT: diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 0f146598a6e..ac7343e8f23 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -483,7 +483,7 @@ void LFGMgr::InitializeLockedDungeons(Player* player) void LFGMgr::Join(Player* player, uint8 roles, const LfgDungeonSet& selectedDungeons, const std::string& comment) { if (!player || !player->GetSession() || selectedDungeons.empty()) - return; + return; Group* grp = player->GetGroup(); uint64 guid = player->GetGUID(); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index bed3c0cb1a7..ed65e1ce527 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -296,15 +296,24 @@ Item* TradeData::GetItem(TradeSlots slot) const return m_items[slot] ? m_player->GetItemByGuid(m_items[slot]) : NULL; } -bool TradeData::HasItem(uint64 item_guid) const +bool TradeData::HasItem(uint64 itemGuid) const { for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) - if (m_items[i] == item_guid) + if (m_items[i] == itemGuid) return true; return false; } +TradeSlots const TradeData::GetTradeSlotForItem(uint64 itemGuid) +{ + for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) + if (m_items[i] == itemGuid) + return TradeSlots(i); + + return TRADE_SLOT_INVALID; +} + Item* TradeData::GetSpellCastItem() const { return m_spellCastItem ? m_player->GetItemByGuid(m_spellCastItem) : NULL; @@ -12833,7 +12842,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) pSrcItem->SetState(ITEM_CHANGED, this); StoreItem(dest, pNewItem, true); } - else if (IsBankPos (dst)) + else if (IsBankPos(dst)) { // change item amount before check (for unique max count check) pSrcItem->SetCount(pSrcItem->GetCount() - count); @@ -12853,7 +12862,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) pSrcItem->SetState(ITEM_CHANGED, this); BankItem(dest, pNewItem, true); } - else if (IsEquipmentPos (dst)) + else if (IsEquipmentPos(dst)) { // change item amount before check (for unique max count check), provide space for splitted items pSrcItem->SetCount(pSrcItem->GetCount() - count); @@ -12874,6 +12883,17 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) EquipItem(dest, pNewItem, true); AutoUnequipOffhandIfNeed(); } + + //! Make sure that code below only is executed when trading + if (!GetTradeData()) + return; + + //! Update item count in trade window, prevent spoofing + //! Since pSrcItem has its count updated (see above), Item::GetCount() will return the new count + //! in the underlying packet builder function + TradeSlots const slot = GetTradeData()->GetTradeSlotForItem(pSrcItem->GetGUID()); + if (slot != TRADE_SLOT_INVALID) + GetTradeData()->SetItem(slot, pSrcItem); } void Player::SwapItem(uint16 src, uint16 dst) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 7a455590506..fccd380bd29 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -686,7 +686,8 @@ enum TradeSlots { TRADE_SLOT_COUNT = 7, TRADE_SLOT_TRADED_COUNT = 6, - TRADE_SLOT_NONTRADED = 6 + TRADE_SLOT_NONTRADED = 6, + TRADE_SLOT_INVALID = -1, }; enum TransferAbortReason @@ -1001,7 +1002,8 @@ class TradeData TradeData* GetTraderData() const; Item* GetItem(TradeSlots slot) const; - bool HasItem(uint64 item_guid) const; + bool HasItem(uint64 itemGuid) const; + TradeSlots const GetTradeSlotForItem(uint64 itemGuid); void SetItem(TradeSlots slot, Item* item); uint32 GetSpell() const { return m_spell; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 63aa7771063..d7353d72ee0 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2114,12 +2114,12 @@ void Unit::SendMeleeAttackStart(Unit* victim) void Unit::SendMeleeAttackStop(Unit* victim) { - WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); // we guess size + WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); data.append(GetPackGUID()); data.append(victim ? victim->GetPackGUID() : 0); // can be 0x00... data << uint32(0); // can be 0x1 SendMessageToSet(&data, true); - sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTART"); + sLog->outStaticDebug("WORLD: Sent SMSG_ATTACKSTOP"); if (victim) sLog->outDetail("%s %u stopped attacking %s %u", (GetTypeId() == TYPEID_PLAYER ? "Player" : "Creature"), GetGUIDLow(), (victim->GetTypeId() == TYPEID_PLAYER ? "player" : "creature"), victim->GetGUIDLow()); diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 2656d882009..c17f5096748 100755 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -368,7 +368,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); } -void MotionMaster::MoveFall() +void MotionMaster::MoveFall(uint32 id/*=0*/) { // use larger distance for vmap height search than in most other cases float tz = i_owner->GetMap()->GetHeight(i_owner->GetPositionX(), i_owner->GetPositionY(), i_owner->GetPositionZ(), true, MAX_FALL_DISTANCE); @@ -387,7 +387,7 @@ void MotionMaster::MoveFall() init.MoveTo(i_owner->GetPositionX(),i_owner->GetPositionY(),tz); init.SetFall(); init.Launch(); - Mutate(new EffectMovementGenerator(0), MOTION_SLOT_CONTROLLED); + Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED); } void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id) diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 00f1701e591..a5bd0861b04 100755 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -163,7 +163,7 @@ class MotionMaster //: private std::stack<MovementGenerator *> void MoveKnockbackFrom(float srcX, float srcY, float speedXY, float speedZ); void MoveJumpTo(float angle, float speedXY, float speedZ); void MoveJump(float x, float y, float z, float speedXY, float speedZ, uint32 id = 0); - void MoveFall(); + void MoveFall(uint32 id = 0); void MoveSeekAssistance(float x, float y, float z); void MoveSeekAssistanceDistract(uint32 timer); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 5577422919f..b32e346757f 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1963,6 +1963,13 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI if (!sSpellMgr->CanSpellTriggerProcOnEvent(*procEntry, eventInfo)) return false; + // TODO: + // - do checks using conditions table for eventInfo->GetActor() and eventInfo->GetActionTarget() + // - add DoCheckProc() AuraScript hook + // to allow additional requirements for procs + // this is needed because this is the last moment in which you can prevent aura charge drop on proc + // and possibly a way to prevent default checks (if there're going to be any) + // Check if current equipment meets aura requirements // do that only for passive spells // TODO: this needs to be unified for all kinds of auras @@ -2023,11 +2030,14 @@ float Aura::CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& event void Aura::TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo) { - // TODO: script hooks here (allowing prevention of selected effects) + // TODO: OnProc hook here for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (aurApp->HasEffect(i)) + // TODO: OnEffectProc hook here (allowing prevention of selected effects) GetEffect(i)->HandleProc(aurApp, eventInfo); - // TODO: script hooks here + // TODO: AfterEffectProc hook here + + // TODO: AfterProc hook here // Remove aura if we've used last charge to proc if (IsUsingCharges() && !GetCharges()) diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 8c9cde37c15..de743eb2991 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -186,6 +186,9 @@ class Aura bool CanStackWith(Aura const* existingAura) const; // Proc system + // this subsystem is not yet in use - the core of it is functional, but still some research has to be done + // and some dependant problems fixed before it can replace old proc system (for example cooldown handling) + // currently proc system functionality is implemented in Unit::ProcDamageAndSpell bool IsProcOnCooldown() const; void AddProcCooldown(uint32 msec); bool IsUsingCharges() const { return m_isUsingCharges; } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp index ecb909480c5..728446aa833 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_nightbane.cpp @@ -186,7 +186,7 @@ public: void MovementInform(uint32 type, uint32 id) { if (type != POINT_MOTION_TYPE) - return; + return; if (Intro) { diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp index 4d43e4adefe..a4eca1950f8 100644 --- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp @@ -26,7 +26,6 @@ EndScriptData */ /* ContentData npc_archmage_malin npc_bartleby -npc_dashel_stonefist npc_lady_katrana_prestor npc_tyrion npc_tyrion_spybot @@ -148,78 +147,6 @@ public: }; /*###### -## npc_dashel_stonefist -######*/ - -enum eDashel -{ - QUEST_MISSING_DIPLO_PT8 = 1447, - FACTION_HOSTILE = 168 -}; - -class npc_dashel_stonefist : public CreatureScript -{ -public: - npc_dashel_stonefist() : CreatureScript("npc_dashel_stonefist") { } - - bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) - { - if (quest->GetQuestId() == QUEST_MISSING_DIPLO_PT8) - { - creature->setFaction(FACTION_HOSTILE); - CAST_AI(npc_dashel_stonefist::npc_dashel_stonefistAI, creature->AI())->AttackStart(player); - } - return true; - } - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_dashel_stonefistAI(creature); - } - - struct npc_dashel_stonefistAI : public ScriptedAI - { - npc_dashel_stonefistAI(Creature* c) : ScriptedAI(c) - { - m_uiNormalFaction = c->getFaction(); - } - - uint32 m_uiNormalFaction; - - void Reset() - { - if (me->getFaction() != m_uiNormalFaction) - me->setFaction(m_uiNormalFaction); - } - - void AttackedBy(Unit* pAttacker) - { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); - } - - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage)) - { - uiDamage = 0; - - if (pDoneBy->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pDoneBy)->AreaExploredOrEventHappens(QUEST_MISSING_DIPLO_PT8); - - EnterEvadeMode(); - } - } - }; - -}; - -/*###### ## npc_lady_katrana_prestor ######*/ @@ -716,7 +643,6 @@ void AddSC_stormwind_city() { new npc_archmage_malin(); new npc_bartleby(); - new npc_dashel_stonefist(); new npc_lady_katrana_prestor(); new npc_tyrion(); new npc_tyrion_spybot(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 8e34a318d6c..d3d92375d39 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -122,6 +122,11 @@ const Position SphereSpawn[6] = { 706.6383f, 161.5266f, 155.6701f, 0 }, }; +enum MovementPoints +{ + POINT_FALL_GROUND = 1 +}; + class boss_anubarak_trial : public CreatureScript { public: @@ -553,68 +558,68 @@ public: class mob_frost_sphere : public CreatureScript { -public: - mob_frost_sphere() : CreatureScript("mob_frost_sphere") { } + public: + mob_frost_sphere() : CreatureScript("mob_frost_sphere") { } - CreatureAI* GetAI(Creature* creature) const - { - return new mob_frost_sphereAI(creature); - }; - - struct mob_frost_sphereAI : public ScriptedAI - { - mob_frost_sphereAI(Creature* creature) : ScriptedAI(creature) + struct mob_frost_sphereAI : public ScriptedAI { - } - - bool m_bFall; - float x, y, z; + mob_frost_sphereAI(Creature* creature) : ScriptedAI(creature) + { + } - void Reset() - { - m_bFall = false; - me->SetReactState(REACT_PASSIVE); - me->SetFlying(true); - me->SetDisplayId(25144); - me->SetSpeed(MOVE_RUN, 0.5f, false); - me->GetMotionMaster()->MoveRandom(20.0f); - DoCast(SPELL_FROST_SPHERE); - } + void Reset() + { + _isFalling = false; + me->SetReactState(REACT_PASSIVE); + me->SetFlying(true); + me->SetDisplayId(me->GetCreatureInfo()->Modelid2); + me->SetSpeed(MOVE_RUN, 0.5f, false); + me->GetMotionMaster()->MoveRandom(20.0f); + DoCast(SPELL_FROST_SPHERE); + } - void DamageTaken(Unit* /*who*/, uint32& uiDamage) - { - if (me->GetHealth() < uiDamage) + void DamageTaken(Unit* /*who*/, uint32& damage) { - uiDamage = 0; - if (!m_bFall) + if (me->GetHealth() <= damage) { - m_bFall = true; - me->GetMotionMaster()->MoveIdle(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //At hit the ground - me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); - me->GetMotionMaster()->MoveFall(); + damage = 0; + if (!_isFalling) + { + _isFalling = true; + me->GetMotionMaster()->MoveIdle(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //At hit the ground + me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); + me->GetMotionMaster()->MoveFall(POINT_FALL_GROUND); + } } } - } - - void MovementInform(uint32 uiType, uint32 uiId) - { - if (uiType != POINT_MOTION_TYPE) return; - switch (uiId) + void MovementInform(uint32 type, uint32 pointId) { - case 0: - me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE); - me->SetDisplayId(11686); - DoCast(SPELL_PERMAFROST_VISUAL); - DoCast(SPELL_PERMAFROST); - me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f); - break; + if (type != EFFECT_MOTION_TYPE) + return; + + switch (pointId) + { + case POINT_FALL_GROUND: + me->RemoveAurasDueToSpell(SPELL_FROST_SPHERE); + me->SetDisplayId(me->GetCreatureInfo()->Modelid1); + DoCast(SPELL_PERMAFROST_VISUAL); + DoCast(SPELL_PERMAFROST); + me->SetFloatValue(OBJECT_FIELD_SCALE_X, 2.0f); + break; + } } - } - }; + private: + bool _isFalling; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_frost_sphereAI(creature); + }; }; class mob_anubarak_spike : public CreatureScript diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index 46c1cf425ed..11100e6297e 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -268,7 +268,7 @@ class boss_sindragosa : public CreatureScript void MovementInform(uint32 type, uint32 point) { - if (type != POINT_MOTION_TYPE) + if (type != POINT_MOTION_TYPE && type != EFFECT_MOTION_TYPE) return; switch (point) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index 436336ec5b8..542243293de 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -94,6 +94,11 @@ enum SvalaPhase SVALADEAD }; +enum SvalaPoint +{ + POINT_FALL_GROUND = 1, +}; + #define DATA_INCREDIBLE_HULK 2043 static const float spectatorWP[2][3] = @@ -258,16 +263,16 @@ public: SetCombatMovement(false); me->HandleEmoteCommand(EMOTE_ONESHOT_FLYDEATH); - me->GetMotionMaster()->MoveFall(); + me->GetMotionMaster()->MoveFall(POINT_FALL_GROUND); } } void MovementInform(uint32 motionType, uint32 pointId) { - if (motionType != POINT_MOTION_TYPE) + if (motionType != EFFECT_MOTION_TYPE) return; - if (pointId == 1) + if (pointId == POINT_FALL_GROUND) me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } @@ -288,7 +293,7 @@ public: Phase = NORMAL; SetCombatMovement(true); - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300, true)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 300.0f, true)) me->GetMotionMaster()->MoveChase(target); } } @@ -330,7 +335,7 @@ public: { std::list<Creature*> lspectatorList; GetCreatureListWithEntryInGrid(lspectatorList, me, CREATURE_SPECTATOR, 100.0f); - for(std::list<Creature*>::iterator itr = lspectatorList.begin(); itr != lspectatorList.end(); ++itr) + for (std::list<Creature*>::iterator itr = lspectatorList.begin(); itr != lspectatorList.end(); ++itr) { if ((*itr)->isAlive()) { @@ -397,7 +402,8 @@ public: Phase = NORMAL; break; } - } else introTimer -= diff; + } + else introTimer -= diff; return; } diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index 57007a93fa7..cd3cbf29d0d 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -32,7 +32,12 @@ Script Data End */ enum Spells { SPELL_TRESPASSER_A = 54028, - SPELL_TRESPASSER_H = 54029 + SPELL_TRESPASSER_H = 54029, + + SPELL_SUNREAVER_DISGUISE_FEMALE = 70973, + SPELL_SUNREAVER_DISGUISE_MALE = 70974, + SPELL_SILVER_COVENANT_DISGUISE_FEMALE = 70971, + SPELL_SILVER_COVENANT_DISGUISE_MALE = 70972, }; enum NPCs // All outdoor guards are within 35.0f of these NPCs @@ -71,8 +76,10 @@ public: Player* player = who->GetCharmerOrOwnerPlayerOrPlayerItself(); - // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass - if (!player || player->isGameMaster() || player->IsBeingTeleported() || player->HasAura(70973) || player->HasAura(70971)) + if (!player || player->isGameMaster() || player->IsBeingTeleported() || + // If player has Disguise aura for quest A Meeting With The Magister or An Audience With The Arcanist, do not teleport it away but let it pass + player->HasAura(SPELL_SUNREAVER_DISGUISE_FEMALE) || player->HasAura(SPELL_SUNREAVER_DISGUISE_MALE) || + player->HasAura(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || player->HasAura(SPELL_SILVER_COVENANT_DISGUISE_MALE)) return; switch (me->GetEntry()) diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 3fb2c4f3319..2b31a50510d 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1481,6 +1481,82 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader } }; +enum DalaranDisguiseSpells +{ + SPELL_SUNREAVER_DISGUISE_TRIGGER = 69672, + SPELL_SUNREAVER_DISGUISE_FEMALE = 70973, + SPELL_SUNREAVER_DISGUISE_MALE = 70974, + + SPELL_SILVER_COVENANT_DISGUISE_TRIGGER = 69673, + SPELL_SILVER_COVENANT_DISGUISE_FEMALE = 70971, + SPELL_SILVER_COVENANT_DISGUISE_MALE = 70972, +}; + +class spell_gen_dalaran_disguise : public SpellScriptLoader +{ + public: + spell_gen_dalaran_disguise(const char* name) : SpellScriptLoader(name) {} + + class spell_gen_dalaran_disguise_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_dalaran_disguise_SpellScript); + bool Validate(SpellInfo const* spellEntry) + { + switch (spellEntry->Id) + { + case SPELL_SUNREAVER_DISGUISE_TRIGGER: + if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE)) + return false; + break; + case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER: + if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE)) + return false; + if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE)) + return false; + break; + } + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + + if (Player* player = GetHitPlayer()) + { + uint8 gender = player->getGender(); + + uint32 spellId = GetSpellInfo()->Id; + + switch (spellId) + { + case SPELL_SUNREAVER_DISGUISE_TRIGGER: + spellId = gender ? SPELL_SUNREAVER_DISGUISE_FEMALE : SPELL_SUNREAVER_DISGUISE_MALE; + break; + case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER: + spellId = gender ? SPELL_SILVER_COVENANT_DISGUISE_FEMALE : SPELL_SILVER_COVENANT_DISGUISE_MALE; + break; + default: + break; + } + + GetCaster()->CastSpell(player, spellId, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_dalaran_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_dalaran_disguise_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -1514,4 +1590,6 @@ void AddSC_generic_spell_scripts() new spell_gen_oracle_wolvar_reputation(); new spell_gen_damage_reduction_aura(); new spell_gen_luck_of_the_draw(); + new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise"); + new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise"); } |
