diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp | 7 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp | 7 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp | 3 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp | 24 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp | 6 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp | 3 | ||||
-rw-r--r-- | src/game/BattleGround.cpp | 33 | ||||
-rw-r--r-- | src/game/BattleGround.h | 9 | ||||
-rw-r--r-- | src/game/GridNotifiers.cpp | 47 | ||||
-rw-r--r-- | src/game/GridNotifiers.h | 61 | ||||
-rw-r--r-- | src/game/GridNotifiersImpl.h | 109 | ||||
-rw-r--r-- | src/game/Map.cpp | 43 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 3 | ||||
-rw-r--r-- | src/game/ObjectMgr.h | 2 | ||||
-rw-r--r-- | src/game/Player.cpp | 39 | ||||
-rw-r--r-- | src/game/Player.h | 1 | ||||
-rw-r--r-- | src/game/Spell.cpp | 11 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 28 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 3 |
19 files changed, 186 insertions, 253 deletions
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp index aab2e8f79c5..1ac54a682aa 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp @@ -111,6 +111,9 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI PhaseChangeTimer = 60000; Phase1 = true; + + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } void Aggro(Unit *who) @@ -292,6 +295,8 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI if(DoGetThreat(target)) DoModifyThreatPercent(target, -100); m_creature->AddThreat(target, 50000000.0f); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); // If VMaps are disabled, this spell can call the whole instance DoCast(m_creature, SPELL_INSIGNIFIGANCE, true); DoCast(target, SPELL_FEL_RAGE_TARGET, true); @@ -325,6 +330,8 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI FelAcidTimer += 2000; EjectTimer += 2000; PhaseChangeTimer = 60000; + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } }else PhaseChangeTimer -= diff; diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp index ac6d1091c60..3ae719effaf 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp @@ -91,6 +91,9 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI Phase1 = true; summons.DespawnAll(); + + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } void Aggro(Unit *who) @@ -212,6 +215,8 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI PhaseSwitchTimer = 60000; m_creature->SetSpeed(MOVE_RUN, 1.2f); DoZoneInCombat(); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } else { @@ -222,6 +227,8 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI PhaseSwitchTimer = 60000; m_creature->SetSpeed(MOVE_RUN, 0.9f); DoZoneInCombat(); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); } }else PhaseSwitchTimer -= diff; diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp index aae8b56cdf7..8103d73c651 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp @@ -114,8 +114,7 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->setActive(true); - pInstance->SetData(DATA_NIGHTBANE_EVENT, 6); - if(pInstance->GetData(DATA_NIGHTBANE_EVENT) > 1) + if(pInstance->GetData(DATA_NIGHTBANE_EVENT) == DONE || pInstance->GetData(DATA_NIGHTBANE_EVENT) == IN_PROGRESS) { m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); diff --git a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp index 72a839cc5bd..c86fe3ead82 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp @@ -65,9 +65,6 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance uint64 MastersTerraceDoor[2]; uint64 ImageGUID; - uint8 Nightbane; - bool CheckNightbane; - void Initialize() { for (uint8 i = 0; i < ENCOUNTERS; ++i) @@ -92,10 +89,6 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance MastersTerraceDoor[0]= 0; MastersTerraceDoor[1]= 0; ImageGUID = 0; - - Nightbane = 0; - - CheckNightbane = false; } bool IsEncounterInProgress() const @@ -122,12 +115,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_NETHERSPITE_EVENT: return Encounters[8]; case DATA_CHESS_EVENT: return Encounters[9]; case DATA_MALCHEZZAR_EVENT: return Encounters[10]; - case DATA_NIGHTBANE_EVENT: - if(CheckNightbane) - { - CheckNightbane = false; - return Nightbane; - }else return Encounters[11]; + case DATA_NIGHTBANE_EVENT: return Encounters[11]; case DATA_OPERA_PERFORMANCE: return OperaEvent; case DATA_OPERA_OZ_DEATHCOUNT: return OzDeathCount; case DATA_IMAGE_OF_MEDIVH: return ImageGUID; @@ -188,11 +176,9 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_CHESS_EVENT: Encounters[9] = data; break; case DATA_MALCHEZZAR_EVENT: Encounters[10] = data; break; case DATA_NIGHTBANE_EVENT: - if(data == 6) - { - Nightbane; - CheckNightbane = true; - }else Encounters[11] = data; + if (Encounters[11] == DONE) + break; + Encounters[11] = data; break; case DATA_OPERA_OZ_DEATHCOUNT: ++OzDeathCount; break; } @@ -268,7 +254,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance std::istringstream loadStream(in); loadStream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4] >> Encounters[5] >> Encounters[6] >> Encounters[7] - >> Encounters[8] >> Encounters[9] >> Encounters[10]; + >> Encounters[8] >> Encounters[9] >> Encounters[10] >> Encounters[11]; for(uint8 i = 0; i < ENCOUNTERS; ++i) if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. Encounters[i] = NOT_STARTED; diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp index da576d9ebbc..de5a723c630 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp @@ -201,9 +201,6 @@ struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if (!UpdateVictim()) - return; - //Check_Timer if(Check_Timer < diff) { @@ -219,6 +216,9 @@ struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI Check_Timer = 1000; }else Check_Timer -= diff; + if (!UpdateVictim()) + return; + if (!onlyonce) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp index d5506fbf44e..58fb27f90b5 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp @@ -46,7 +46,8 @@ struct TRINITY_DLL_DECL instance_mechanar : public ScriptedInstance bool IsEncounterInProgress() const { for(uint8 i = 0; i < ENCOUNTERS; ++i) - if(Encounters[i]) return true; + if(Encounters[i] == IN_PROGRESS) + return true; return false; } diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 29843eb425e..a4c2cae5ca8 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -727,42 +727,29 @@ void BattleGround::RewardMark(Player *plr,uint32 count) if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE)) return; - BattleGroundMarks mark; - bool IsSpell; + if(!plr || !count) + return; + + BattleGroundMarks mark; switch(GetTypeID()) { case BATTLEGROUND_AV: - IsSpell = true; - if(count == ITEM_WINNER_COUNT) - mark = SPELL_AV_MARK_WINNER; - else - mark = SPELL_AV_MARK_LOSER; + mark = ITEM_AV_MARK_OF_HONOR; break; case BATTLEGROUND_WS: - IsSpell = true; - if(count == ITEM_WINNER_COUNT) - mark = SPELL_WS_MARK_WINNER; - else - mark = SPELL_WS_MARK_LOSER; + mark = ITEM_WS_MARK_OF_HONOR; break; case BATTLEGROUND_AB: - IsSpell = true; - if(count == ITEM_WINNER_COUNT) - mark = SPELL_AB_MARK_WINNER; - else - mark = SPELL_AB_MARK_LOSER; + mark = ITEM_AB_MARK_OF_HONOR; break; - case BATTLEGROUND_EY: - IsSpell = false; + case BATTLEGROUND_EY: mark = ITEM_EY_MARK_OF_HONOR; break; default: return; } - if(IsSpell) - plr->CastSpell(plr, mark, true); - else if ( objmgr.GetItemPrototype( mark ) ) + if ( objmgr.GetItemPrototype( mark ) ) { ItemPosCountVec dest; uint32 no_space_count = 0; @@ -770,7 +757,7 @@ void BattleGround::RewardMark(Player *plr,uint32 count) if( msg != EQUIP_ERR_OK ) // convert to possible store amount count -= no_space_count; - if( count != 0 && !dest.empty()) // can add some + if(!dest.empty()) // can add some if(Item* item = plr->StoreNewItem( dest, mark, true, 0)) plr->SendNewItem(item,count,false,true); diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index d05969ec50a..ea691dc9750 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -53,12 +53,9 @@ enum BattleGroundQuests enum BattleGroundMarks { - SPELL_WS_MARK_LOSER = 24950, - SPELL_WS_MARK_WINNER = 24951, - SPELL_AB_MARK_LOSER = 24952, - SPELL_AB_MARK_WINNER = 24953, - SPELL_AV_MARK_LOSER = 24954, - SPELL_AV_MARK_WINNER = 24955, + ITEM_AV_MARK_OF_HONOR = 20560, + ITEM_WS_MARK_OF_HONOR = 20558, + ITEM_AB_MARK_OF_HONOR = 20559, ITEM_EY_MARK_OF_HONOR = 29024 }; diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index c6119617f33..6b9b3bb4728 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -30,23 +30,6 @@ using namespace Trinity; -/*void -Trinity::PlayerNotifier::Visit(PlayerMapType &m) -{ - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - { - if( iter->getSource() == &i_player ) - continue; - - iter->getSource()->UpdateVisibilityOf(&i_player); - i_player.UpdateVisibilityOf(iter->getSource()); - - if (!i_player.GetSharedVisionList().empty()) - for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it) - (*it)->UpdateVisibilityOf(iter->getSource()); - } -}*/ - void VisibleChangesNotifier::Visit(PlayerMapType &m) { @@ -60,27 +43,7 @@ VisibleChangesNotifier::Visit(PlayerMapType &m) } void -VisibleNotifier::Visit(PlayerMapType &m) -{ - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - { - if( iter->getSource() == &i_player ) - continue; - - iter->getSource()->UpdateVisibilityOf(&i_player); - //i_player.UpdateVisibilityOf(iter->getSource()); - - //if (!i_player.GetSharedVisionList().empty()) - // for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it) - // (*it)->UpdateVisibilityOf(iter->getSource()); - - i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); - i_clientGUIDs.erase(iter->getSource()->GetGUID()); - } -} - -void -VisibleNotifier::Notify() +PlayerRelocationNotifier::Notify() { // at this moment i_clientGUIDs have guids that not iterate at grid level checks // but exist one case when this possible and object not out of range: transports @@ -144,15 +107,9 @@ VisibleNotifier::Notify() // send data at target visibility change (adding to client) for(std::set<WorldObject*>::const_iterator vItr = i_visibleNow.begin(); vItr != i_visibleNow.end(); ++vItr) - { // target aura duration for caster show only if target exist at caster client if((*vItr)!=&i_player && (*vItr)->isType(TYPEMASK_UNIT)) - i_player.SendAurasForTarget((Unit*)(*vItr)); - - // non finished movements show to player - if((*vItr)->GetTypeId()==TYPEID_UNIT && ((Creature*)(*vItr))->isAlive()) - ((Creature*)(*vItr))->SendMonsterMoveWithSpeedToCurrentDestination(&i_player); - } + i_player.SendInitialVisiblePackets((Unit*)(*vItr)); } void diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index db1e700fe55..0117727a987 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -38,16 +38,7 @@ class Player; namespace Trinity { - - /*struct TRINITY_DLL_DECL PlayerNotifier - { - explicit PlayerNotifier(Player &pl) : i_player(pl) {} - void Visit(PlayerMapType &); - template<class SKIP> void Visit(GridRefManager<SKIP> &) {} - Player &i_player; - };*/ - - struct TRINITY_DLL_DECL VisibleNotifier + struct TRINITY_DLL_DECL PlayerRelocationNotifier { Player &i_player; UpdateData i_data; @@ -55,12 +46,28 @@ namespace Trinity Player::ClientGUIDs i_clientGUIDs; std::set<WorldObject*> i_visibleNow; - explicit VisibleNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {} - template<class T> void Visit(GridRefManager<T> &m); - void Visit(PlayerMapType &); + PlayerRelocationNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {} + + #ifdef WIN32 + template<class T> inline void Visit(GridRefManager<T> &); + template<> inline void Visit(PlayerMapType &); + template<> inline void Visit(CreatureMapType &); + #endif + void Notify(void); }; + struct TRINITY_DLL_DECL CreatureRelocationNotifier + { + Creature &i_creature; + CreatureRelocationNotifier(Creature &c) : i_creature(c) {} + template<class T> void Visit(GridRefManager<T> &) {} + #ifdef WIN32 + template<> inline void Visit(PlayerMapType &); + template<> inline void Visit(CreatureMapType &); + #endif + }; + struct TRINITY_DLL_DECL VisibleChangesNotifier { WorldObject &i_object; @@ -170,25 +177,6 @@ namespace Trinity template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {} }; - struct TRINITY_DLL_DECL PlayerRelocationNotifier - { - Player &i_player; - PlayerRelocationNotifier(Player &pl) : i_player(pl) {} - template<class T> void Visit(GridRefManager<T> &) {} - void Visit(PlayerMapType &); - void Visit(CreatureMapType &); - }; - - struct TRINITY_DLL_DECL CreatureRelocationNotifier - { - Creature &i_creature; - CreatureRelocationNotifier(Creature &c) : i_creature(c) {} - template<class T> void Visit(GridRefManager<T> &) {} - #ifdef WIN32 - template<> void Visit(PlayerMapType &); - #endif - }; - struct TRINITY_DLL_DECL DynamicObjectUpdater { DynamicObject &i_dynobject; @@ -1045,10 +1033,11 @@ namespace Trinity }; #ifndef WIN32 - template<> void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType &); - template<> void PlayerRelocationNotifier::Visit<Player>(PlayerMapType &); - template<> void CreatureRelocationNotifier::Visit<Player>(PlayerMapType &); - template<> void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType &); + template<class T> inline void PlayerRelocationNotifier::Visit(GridRefManager<T> &); + template<> inline void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType &); + template<> inline void PlayerRelocationNotifier::Visit<Player>(PlayerMapType &); + template<> inline void CreatureRelocationNotifier::Visit<Player>(PlayerMapType &); + template<> inline void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType &); template<> inline void DynamicObjectUpdater::Visit<Creature>(CreatureMapType &); template<> inline void DynamicObjectUpdater::Visit<Player>(PlayerMapType &); #endif diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 1704d26263c..059447fdc9a 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -29,17 +29,6 @@ #include "CreatureAI.h" #include "SpellAuras.h" -template<class T> -inline void -Trinity::VisibleNotifier::Visit(GridRefManager<T> &m) -{ - for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter) - { - i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); - i_clientGUIDs.erase(iter->getSource()->GetGUID()); - } -} - inline void Trinity::ObjectUpdater::Visit(CreatureMapType &m) { @@ -48,28 +37,10 @@ Trinity::ObjectUpdater::Visit(CreatureMapType &m) iter->getSource()->Update(i_timeDiff); } -inline void -Trinity::PlayerRelocationNotifier::Visit(PlayerMapType &m) -{ - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - { - if(&i_player==iter->getSource()) - continue; - - // visibility for players updated by ObjectAccessor::UpdateVisibilityFor calls in appropriate places - - // Cancel Trade - if(i_player.GetTrader()==iter->getSource()) - // iteraction distance - if(!i_player.IsWithinDistInMap(iter->getSource(), 5)) - i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows - } -} - inline void PlayerCreatureRelocationWorker(Player* pl, Creature* c) { - // update creature visibility at player/creature move - pl->UpdateVisibilityOf(c); + if(!pl->isAlive() || !c->isAlive() || pl->isInFlight()) + return; // Creature AI reaction if(c->HasReactState(REACT_AGGRESSIVE) && !c->hasUnitState(UNIT_STAT_SIGHTLESS)) @@ -94,27 +65,71 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) } } +template<class T> +inline void +Trinity::PlayerRelocationNotifier::Visit(GridRefManager<T> &m) +{ + for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter) + { + i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); + i_clientGUIDs.erase(iter->getSource()->GetGUID()); + } +} + +template<> +inline void +Trinity::PlayerRelocationNotifier::Visit(PlayerMapType &m) +{ + for(PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) + { + if(iter->getSource()->m_Notified) //self is also skipped in this check + continue; + + i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); + i_clientGUIDs.erase(iter->getSource()->GetGUID()); + + iter->getSource()->UpdateVisibilityOf(&i_player); + + //if (!i_player.GetSharedVisionList().empty()) + // for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it) + // (*it)->UpdateVisibilityOf(iter->getSource()); + + // Cancel Trade + if(i_player.GetTrader()==iter->getSource()) + if(!i_player.IsWithinDistInMap(iter->getSource(), 5)) // iteraction distance + i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows + } +} + +template<> inline void Trinity::PlayerRelocationNotifier::Visit(CreatureMapType &m) { - if(!i_player.isAlive() || i_player.isInFlight()) - return; + for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) + { + if(iter->getSource()->m_Notified) + continue; - for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - if( !iter->getSource()->m_Notified && iter->getSource()->isAlive()) - PlayerCreatureRelocationWorker(&i_player,iter->getSource()); + i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); + i_clientGUIDs.erase(iter->getSource()->GetGUID()); + + PlayerCreatureRelocationWorker(&i_player, iter->getSource()); + } } template<> inline void Trinity::CreatureRelocationNotifier::Visit(PlayerMapType &m) { - if(!i_creature.isAlive()) - return; + for(PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) + { + if(iter->getSource()->m_Notified) + continue; - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - if( !iter->getSource()->m_Notified && iter->getSource()->isAlive() && !iter->getSource()->isInFlight()) - PlayerCreatureRelocationWorker(iter->getSource(), &i_creature); + iter->getSource()->UpdateVisibilityOf(&i_creature); + + PlayerCreatureRelocationWorker(iter->getSource(), &i_creature); + } } template<> @@ -124,11 +139,15 @@ Trinity::CreatureRelocationNotifier::Visit(CreatureMapType &m) if(!i_creature.isAlive()) return; - for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) + for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { - Creature* c = iter->getSource(); - if( !iter->getSource()->m_Notified && c != &i_creature && c->isAlive()) - CreatureCreatureRelocationWorker(c, &i_creature); + if(iter->getSource()->m_Notified) + continue; + + if(!iter->getSource()->isAlive()) + continue; + + CreatureCreatureRelocationWorker(iter->getSource(), &i_creature); } } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 58ae50ee1dd..ae099710083 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -624,34 +624,15 @@ void Map::RelocationNotify() if(unit->GetTypeId() == TYPEID_PLAYER) { - //UpdatePlayerVisibility((Player*)unit, cell, val); - //Trinity::PlayerNotifier pl_notifier(*player); - //VisitWorld(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), pl_notifier); - - //UpdateObjectsVisibilityFor((Player*)unit, cell, val); - Trinity::VisibleNotifier ob_notifier(*((Player*)unit)); - VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), ob_notifier); - ob_notifier.Notify(); - Trinity::PlayerRelocationNotifier notifier(*((Player*)unit)); VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier); + notifier.Notify(); } else { Trinity::CreatureRelocationNotifier notifier(*((Creature*)unit)); VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier); } - - // Update visibility back to player who is controlling the unit - if(unit->GetSharedVisionList().size()) - { - for(SharedVisionList::const_iterator it = unit->GetSharedVisionList().begin(); it != unit->GetSharedVisionList().end(); ++it) - { - Trinity::VisibleNotifier ob_notifier(**it); - VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), ob_notifier); - ob_notifier.Notify(); - } - } } //Clear list @@ -768,6 +749,28 @@ void Map::Update(const uint32 &t_diff) } } } + + // Update bindsight players + if(obj->isType(TYPEMASK_UNIT)) + { + if(!((Unit*)obj)->GetSharedVisionList().empty()) + for(SharedVisionList::const_iterator it = ((Unit*)obj)->GetSharedVisionList().begin(); it != ((Unit*)obj)->GetSharedVisionList().end(); ++it) + { + Trinity::PlayerRelocationNotifier notifier(**it); + VisitAll(obj->GetPositionX(), obj->GetPositionY(), World::GetMaxVisibleDistance(), notifier); + notifier.Notify(); + } + } + else if(obj->GetTypeId() == TYPEID_DYNAMICOBJECT) + { + if(Unit *caster = ((DynamicObject*)obj)->GetCaster()) + if(caster->GetTypeId() == TYPEID_PLAYER && caster->GetUInt64Value(PLAYER_FARSIGHT) == obj->GetGUID()) + { + Trinity::PlayerRelocationNotifier notifier(*((Player*)caster)); + VisitAll(obj->GetPositionX(), obj->GetPositionY(), World::GetMaxVisibleDistance(), notifier); + notifier.Notify(); + } + } } } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 91ead9fc09d..a3802a5eab8 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -6625,6 +6625,7 @@ void ObjectMgr::LoadSpellDisabledEntrys() { m_DisabledPlayerSpells.clear(); // need for reload case m_DisabledCreatureSpells.clear(); + m_DisabledPetSpells.clear(); QueryResult *result = WorldDatabase.Query("SELECT entry, disable_mask FROM spell_disabled"); uint32 total_count = 0; @@ -6657,6 +6658,8 @@ void ObjectMgr::LoadSpellDisabledEntrys() m_DisabledPlayerSpells.insert(spellid); if(disable_mask & SPELL_DISABLE_CREATURE) m_DisabledCreatureSpells.insert(spellid); + if(disable_mask & SPELL_DISABLE_PET) + m_DisabledPetSpells.insert(spellid); ++total_count; } while ( result->NextRow() ); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index b33e2ac26e4..ea73fb15715 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -739,6 +739,7 @@ class ObjectMgr void LoadSpellDisabledEntrys(); bool IsPlayerSpellDisabled(uint32 spellid) { return (m_DisabledPlayerSpells.count(spellid) != 0); } bool IsCreatureSpellDisabled(uint32 spellid) { return (m_DisabledCreatureSpells.count(spellid) != 0); } + bool IsPetSpellDisabled(uint32 spellid) { return (m_DisabledPetSpells.count(spellid) != 0); } int GetIndexForLocale(LocaleConstant loc); LocaleConstant GetLocaleForIndex(int i); @@ -859,6 +860,7 @@ class ObjectMgr std::set<uint32> m_DisabledPlayerSpells; std::set<uint32> m_DisabledCreatureSpells; + std::set<uint32> m_DisabledPetSpells; GraveYardMap mGraveYardMap; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e5de0154ad4..99e4cf04b1c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17597,19 +17597,7 @@ void Player::HandleStealthedUnitsDetection() sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i)); #endif - // target aura duration for caster show only if target exist at caster client - // send data at target visibility change (adding to client) - if((*i)!=this && (*i)->isType(TYPEMASK_UNIT)) - { - SendAurasForTarget(*i); - //if(((Unit*)(*i))->isAlive()) //should be always alive - { - if((*i)->GetTypeId()==TYPEID_UNIT) - ((Creature*)(*i))->SendMonsterMoveWithSpeedToCurrentDestination(this); - if(((Unit*)(*i))->getVictim()) - ((Unit*)(*i))->SendAttackStart(((Unit*)(*i))->getVictim()); - } - } + SendInitialVisiblePackets(*i); } } } @@ -18710,21 +18698,24 @@ void Player::UpdateVisibilityOf(WorldObject* target) // target aura duration for caster show only if target exist at caster client // send data at target visibility change (adding to client) - if(target!=this && target->isType(TYPEMASK_UNIT)) - { - SendAurasForTarget((Unit*)target); - if(((Unit*)target)->isAlive()) - { - if(target->GetTypeId()==TYPEID_UNIT) - ((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this); - if(((Unit*)target)->getVictim()) - ((Unit*)target)->SendAttackStart(((Unit*)target)->getVictim()); - } - } + if(target->isType(TYPEMASK_UNIT)) + SendInitialVisiblePackets((Unit*)target); } } } +void Player::SendInitialVisiblePackets(Unit* target) +{ + SendAurasForTarget(target); + if(target->isAlive()) + { + if(target->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) + target->SendMonsterMoveWithSpeedToCurrentDestination(this); + if(target->hasUnitState(UNIT_STAT_MELEE_ATTACKING) && target->getVictim()) + target->SendAttackStart(target->getVictim()); + } +} + template<class T> inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, T* target) { diff --git a/src/game/Player.h b/src/game/Player.h index b0a5f0e0e5a..932961c79c6 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2100,6 +2100,7 @@ class TRINITY_DLL_SPEC Player : public Unit bool IsVisibleGloballyFor(Player* pl) const; void UpdateVisibilityOf(WorldObject* target); + void SendInitialVisiblePackets(Unit* target); template<class T> void UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow); diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6f98508fd1d..36b2ccf6d43 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2031,7 +2031,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) return; } - if(m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet())) + if(m_caster->GetTypeId() == TYPEID_PLAYER) { if(objmgr.IsPlayerSpellDisabled(m_spellInfo->Id)) { @@ -2040,6 +2040,15 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura) return; } } + else if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet()) + { + if(objmgr.IsPetSpellDisabled(m_spellInfo->Id)) + { + SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE); + finish(false); + return; + } + } else { if(objmgr.IsCreatureSpellDisabled(m_spellInfo->Id)) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 494957e354c..a36cc22abd2 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2786,33 +2786,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) // we succeeded in creating at least one item, so a levelup is possible player->UpdateCraftSkill(m_spellInfo->Id); - } - - // for battleground marks send by mail if not add all expected - if(no_space > 0 ) - { - BattleGroundTypeId bgType; - switch(m_spellInfo->Id) - { - case SPELL_AV_MARK_WINNER: - case SPELL_AV_MARK_LOSER: - bgType = BATTLEGROUND_AV; - break; - case SPELL_WS_MARK_WINNER: - case SPELL_WS_MARK_LOSER: - bgType = BATTLEGROUND_WS; - break; - case SPELL_AB_MARK_WINNER: - case SPELL_AB_MARK_LOSER: - bgType = BATTLEGROUND_AB; - break; - default: - return; - } - - if(BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(bgType)) - bg->SendRewardMarkByMail(player,newitemid,no_space); - } + } } void Spell::EffectCreateItem(uint32 i) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 19eddbe368a..f53d289393e 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -257,7 +257,8 @@ enum SpellFamilyNames enum SpellDisableTypes { SPELL_DISABLE_PLAYER = 1, - SPELL_DISABLE_CREATURE = 2 + SPELL_DISABLE_CREATURE = 2, + SPELL_DISABLE_PET = 4 }; enum SpellEffectTargetTypes |