diff options
| author | Nay <dnpd.dd@gmail.com> | 2012-09-09 02:26:31 +0100 |
|---|---|---|
| committer | Nay <dnpd.dd@gmail.com> | 2012-09-09 02:26:31 +0100 |
| commit | 50327363ca764347b508d7b5e736db631f2be45c (patch) | |
| tree | 076f22d7da5a5fe4c330af588b221170dae88366 /src/server/game/Entities | |
| parent | 6c1bdb3d3c319e999bfbf3c3a16701569ce04d22 (diff) | |
| parent | d04f155b6529e3d86fca931075775fd34b544e29 (diff) | |
Merge remote-tracking branch 'origin/master' into mmaps
Diffstat (limited to 'src/server/game/Entities')
| -rwxr-xr-x | src/server/game/Entities/GameObject/GameObject.cpp | 5 | ||||
| -rwxr-xr-x | src/server/game/Entities/Object/Object.cpp | 9 | ||||
| -rwxr-xr-x | src/server/game/Entities/Object/Object.h | 1 | ||||
| -rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 5 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 8 |
5 files changed, 23 insertions, 5 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 808cbd9a5e4..c28ff21bfa5 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1707,6 +1707,11 @@ bool GameObject::IsInRange(float x, float y, float z, float radius) const float dy = y - GetPositionY(); float dz = z - GetPositionZ(); float dist = sqrt(dx*dx + dy*dy); + //! Check if the distance between the 2 objects is 0, can happen if both objects are on the same position. + //! The code below this check wont crash if dist is 0 because 0/0 in float operations is valid, and returns infinite + if (G3D::fuzzyEq(dist, 0.0f)) + return true; + float sinB = dx / dist; float cosB = dy / dist; dx = dist * (cosA * cosB + sinA * sinB); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 2205efa8724..cc800dce7b8 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -2537,6 +2537,15 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const return go; } +GameObject* WorldObject::FindNearestGameObjectOfType(GameobjectTypes type, float range) const +{ + GameObject* go = NULL; + Trinity::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range); + Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectTypeInObjectRangeCheck> searcher(this, go, checker); + VisitNearbyGridObject(range, searcher); + return go; +} + void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& gameobjectList, uint32 entry, float maxSearchRange) const { CellCoord pair(Trinity::ComputeCellCoord(this->GetPositionX(), this->GetPositionY())); diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index ab9ea2daea9..410903f6619 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -799,6 +799,7 @@ class WorldObject : public Object, public WorldLocation Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const; GameObject* FindNearestGameObject(uint32 entry, float range) const; + GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const; void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const; void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const; diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d8b20454321..dc3fe6b0f0b 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7913,6 +7913,9 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, -val, apply); m_spellPenetrationItemMod += apply ? val : -val; break; + case ITEM_MOD_BLOCK_VALUE: + HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, float(val), apply); + break; // deprecated item mods case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_DAMAGE_DONE: @@ -14723,7 +14726,7 @@ bool Player::CanSeeStartQuest(Quest const* quest) bool Player::CanTakeQuest(Quest const* quest, bool msg) { - return !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this) + return !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, quest->GetQuestId(), this) && SatisfyQuestStatus(quest, msg) && SatisfyQuestExclusiveGroup(quest, msg) && SatisfyQuestClass(quest, msg) && SatisfyQuestRace(quest, msg) && SatisfyQuestLevel(quest, msg) && SatisfyQuestSkill(quest, msg) && SatisfyQuestReputation(quest, msg) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index f46ad17b033..4efdf3b6357 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -4367,10 +4367,10 @@ int32 Unit::GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) if ((*i)->GetMiscValue() & misc_mask) if (!sSpellMgr->AddSameEffectStackRuleSpellGroups((*i)->GetSpellInfo(), (*i)->GetAmount(), SameEffectSpellGroup)) modifier += (*i)->GetAmount(); - + for (std::map<SpellGroup, int32>::const_iterator itr = SameEffectSpellGroup.begin(); itr != SameEffectSpellGroup.end(); ++itr) modifier += itr->second; - + return modifier; } @@ -13235,13 +13235,13 @@ int32 Unit::ModSpellDuration(SpellInfo const* spellProto, Unit const* target, in } break; case SPELLFAMILY_PALADIN: - if (spellProto->SpellFamilyFlags[0] & 0x00000002) + if (spellProto->SpellFamilyFlags[0] & 0x00000002 && spellProto->SpellIconID == 298) { // Glyph of Blessing of Might if (AuraEffect* aurEff = GetAuraEffect(57958, 0)) duration += aurEff->GetAmount() * MINUTE * IN_MILLISECONDS; } - else if (spellProto->SpellFamilyFlags[0] & 0x00010000) + else if (spellProto->SpellFamilyFlags[0] & 0x00010000 && spellProto->SpellIconID == 306) { // Glyph of Blessing of Wisdom if (AuraEffect* aurEff = GetAuraEffect(57979, 0)) |
