diff options
| author | megamage <none@none> | 2009-02-13 20:12:01 -0600 |
|---|---|---|
| committer | megamage <none@none> | 2009-02-13 20:12:01 -0600 |
| commit | 1c3f478ecc5745b880ca6610d64aa5522eb24b1b (patch) | |
| tree | abbaf56201c8b40f41bf5af20eb76c370ba32182 /src/game | |
| parent | 59be8223e4f25e28ede94f9694a2b151caffd9ed (diff) | |
| parent | 29f3d67fb8d47ea25291fa040f1cfd33b53c9da6 (diff) | |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/GameObject.cpp | 8 | ||||
| -rw-r--r-- | src/game/GridNotifiers.h | 17 | ||||
| -rw-r--r-- | src/game/Group.cpp | 6 | ||||
| -rw-r--r-- | src/game/Map.cpp | 2 | ||||
| -rw-r--r-- | src/game/MapInstanced.cpp | 8 | ||||
| -rw-r--r-- | src/game/MapInstanced.h | 1 | ||||
| -rw-r--r-- | src/game/Spell.cpp | 2 | ||||
| -rw-r--r-- | src/game/SpellEffects.cpp | 12 | ||||
| -rw-r--r-- | src/game/SpellMgr.cpp | 3 | ||||
| -rw-r--r-- | src/game/Unit.cpp | 10 |
10 files changed, 54 insertions, 15 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index f2bf5739334..64d604a04fc 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -326,18 +326,18 @@ void GameObject::Update(uint32 /*p_time*/) // search unfriendly creature if(owner && NeedDespawn) // hunter trap { - MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck u_check(this, owner, radius); - MaNGOS::UnitSearcher<MaNGOS::AnyUnfriendlyUnitInObjectRangeCheck> checker(this,ok, u_check); + Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck u_check(this, owner, radius); + Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> checker(this, ok, u_check); CellLock<GridReadGuard> cell_lock(cell, p); - TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); + TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck>, GridTypeMapContainer > grid_object_checker(checker); cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); // or unfriendly player/pet if(!ok) { - TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); + TypeContainerVisitor<Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck>, WorldTypeMapContainer > world_object_checker(checker); cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); } } diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 740ded8e17e..8df2cad8009 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -632,6 +632,23 @@ namespace Trinity float i_range; }; + class AnyUnfriendlyNoTotemUnitInObjectRangeCheck + { + public: + AnyUnfriendlyNoTotemUnitInObjectRangeCheck(WorldObject const* obj, Unit const* funit, float range) : i_obj(obj), i_funit(funit), i_range(range) {} + bool operator()(Unit* u) + { + if(u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u) && !((Creature*)u)->isTotem()) + return true; + else + return false; + } + private: + WorldObject const* i_obj; + Unit const* i_funit; + float i_range; + }; + class CreatureWithDbGUIDCheck { public: diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 6134be7f9e4..9007da3bdaa 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -1411,8 +1411,10 @@ bool Group::InCombatToInstance(uint32 instanceId) for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player *pPlayer = itr->getSource(); - if(pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId) - return true; + if(pPlayer && pPlayer->getAttackers().size() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaid() || pPlayer->GetMap()->IsHeroic())) + for(std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i!=pPlayer->getAttackers().end(); ++i) + if((*i) && (*i)->GetTypeId() == TYPEID_UNIT && ((Creature*)(*i))->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) + return true; } return false; } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 40df012410b..f0fdbd346df 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1781,7 +1781,7 @@ bool InstanceMap::CanEnter(Player *player) // cannot enter while players in the instance are in combat Group *pGroup = player->GetGroup(); - if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->isAlive() && player->GetMapId() != GetId()) + if(!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId()) { player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); return false; diff --git a/src/game/MapInstanced.cpp b/src/game/MapInstanced.cpp index c61ed531c9a..37a4e1dcd6e 100644 --- a/src/game/MapInstanced.cpp +++ b/src/game/MapInstanced.cpp @@ -266,3 +266,11 @@ void MapInstanced::DestroyInstance(InstancedMaps::iterator &itr) delete itr->second; m_InstancedMaps.erase(itr++); } + +bool MapInstanced::CanEnter(Player *player) +{ + if(Map* map = GetInstance(player)) + return map->CanEnter(player); + + return false; +} diff --git a/src/game/MapInstanced.h b/src/game/MapInstanced.h index 924f77b8d82..581c42aaad5 100644 --- a/src/game/MapInstanced.h +++ b/src/game/MapInstanced.h @@ -39,6 +39,7 @@ class TRINITY_DLL_DECL MapInstanced : public Map void RemoveAllObjectsInRemoveList(); bool RemoveBones(uint64 guid, float x, float y); void UnloadAll(bool pForce); + bool CanEnter(Player* player); Map* GetInstance(const WorldObject* obj); Map* FindMap(uint32 InstanceId) { return _FindMap(InstanceId); } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 0ede1f00e4d..d6d11ba80a7 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1121,7 +1121,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) m_diminishLevel = unit->GetDiminishing(m_diminishGroup); DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup); // Increase Diminishing on unit, current informations for actually casts will use values above - if((type == DRTYPE_PLAYER && unit->GetTypeId() == TYPEID_PLAYER) || type == DRTYPE_ALL) + if((type == DRTYPE_PLAYER && (unit->GetTypeId() == TYPEID_PLAYER || ((Creature*)unit)->isPet() || ((Creature*)unit)->isPossessedByPlayer())) || type == DRTYPE_ALL) unit->IncrDiminishing(m_diminishGroup); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index e0a6dbe351d..d86cf091a5e 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -339,9 +339,17 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx) switch(m_spellInfo->Id) // better way to check unknown { - case 35354://hand of death + case 35354: //Hand of Death { - if(unitTarget && unitTarget->HasAura(38528,0))//protection of elune + if(unitTarget && unitTarget->HasAura(38528,0)) //Protection of Elune + { + damage = 0; + } + break; + } + case 43648: //Electrical Storm + { + if(unitTarget && unitTarget->HasAura(44007, 0)) // Immune Aura { damage = 0; } diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 37f627222fc..5ab5e828eec 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -484,6 +484,9 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex) case 23333: // BG spell case 23335: // BG spell case 34976: // BG spell + case 31579: // Arcane Empowerment Rank1 talent aura with one positive and one negative (check not needed in wotlk) + case 31582: // Arcane Empowerment Rank2 + case 31583: // Arcane Empowerment Rank3 return true; case 28441: // not positive dummy spell case 37675: // Chaos Blast diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6996df9ed97..0801ba454bb 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -10158,13 +10158,13 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un if(duration == -1 || group == DIMINISHING_NONE || caster->IsFriendlyTo(this) ) return; + // test pet/charm masters instead pets/charmeds + Unit const* targetOwner = GetCharmerOrOwner(); + Unit const* casterOwner = caster->GetCharmerOrOwner(); + // Duration of crowd control abilities on pvp target is limited by 10 sec. (2.2.0) if(duration > 10000 && IsDiminishingReturnsGroupDurationLimited(group)) { - // test pet/charm masters instead pets/charmeds - Unit const* targetOwner = GetCharmerOrOwner(); - Unit const* casterOwner = caster->GetCharmerOrOwner(); - Unit const* target = targetOwner ? targetOwner : this; Unit const* source = casterOwner ? casterOwner : caster; @@ -10175,7 +10175,7 @@ void Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,Un float mod = 1.0f; // Some diminishings applies to mobs too (for example, Stun) - if((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER && GetTypeId() == TYPEID_PLAYER) || GetDiminishingReturnsGroupType(group) == DRTYPE_ALL) + if((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER && (targetOwner ? targetOwner->GetTypeId():GetTypeId()) == TYPEID_PLAYER) || GetDiminishingReturnsGroupType(group) == DRTYPE_ALL) { DiminishingLevels diminish = Level; switch(diminish) |
