diff options
author | Subv <s.v.h21@hotmail.com> | 2012-02-14 20:12:49 -0500 |
---|---|---|
committer | Subv <s.v.h21@hotmail.com> | 2012-02-14 20:12:49 -0500 |
commit | 6119254fce50a33496c82a7d49be6afca23d6ffd (patch) | |
tree | de41d950cdefeaadd9434758baadfc9cefe7d39d /src | |
parent | 15a2acfb528728b824291cb49cdd9196e6f0d57d (diff) | |
parent | 1090f84ebf71843bee40508e582d936748ec53ab (diff) |
Merge branch 'master' of https://github.com/TrinityCore/TrinityCore
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Grids/Notifiers/GridNotifiers.h | 28 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 55 | ||||
-rw-r--r-- | src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp | 3 |
3 files changed, 58 insertions, 28 deletions
diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index e3029a1be65..4112711ad3c 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -530,20 +530,38 @@ namespace Trinity class RaiseDeadObjectCheck { public: - RaiseDeadObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {} + RaiseDeadObjectCheck(Unit* source, float range) : _source(source), i_range(range) {} bool operator()(Creature* u) { - if (i_funit->GetTypeId() != TYPEID_PLAYER || !((Player*)i_funit)->isHonorOrXPTarget(u) || - u->getDeathState() != CORPSE || u->isInFlight() || + if (_source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) || + u->getDeathState() != CORPSE || (u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0 || (u->GetDisplayId() != u->GetNativeDisplayId())) return false; - return i_funit->IsWithinDistInMap(u, i_range); + return _source->IsWithinDistInMap(u, i_range); + } + + bool operator()(Player* u) + { + if (_source == u || _source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) || + u->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) || u->isInFlight() || !u->isDead() || + (u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0) + return false; + + return _source->IsWithinDistInMap(u, i_range); + } + + bool operator()(Corpse* u) + { + if (_source->GetTypeId() != TYPEID_PLAYER || u->GetType() == CORPSE_BONES) + return false; + + return _source->IsWithinDistInMap(u, i_range); } template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; } private: - Unit* const i_funit; + Unit* const _source; float i_range; }; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 670b743d725..6cacf5e7e5a 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -598,24 +598,10 @@ WorldObject* Spell::FindCorpseUsing() // non-standard target selection float max_range = m_spellInfo->GetMaxRange(false); - CellCoord p(Trinity::ComputeCellCoord(m_caster->GetPositionX(), m_caster->GetPositionY())); - Cell cell(p); - cell.SetNoCreate(); - WorldObject* result = NULL; - T u_check(m_caster, max_range); Trinity::WorldObjectSearcher<T> searcher(m_caster, result, u_check); - - TypeContainerVisitor<Trinity::WorldObjectSearcher<T>, GridTypeMapContainer > grid_searcher(searcher); - cell.Visit(p, grid_searcher, *m_caster->GetMap(), *m_caster, max_range); - - if (!result) - { - TypeContainerVisitor<Trinity::WorldObjectSearcher<T>, WorldTypeMapContainer > world_searcher(searcher); - cell.Visit(p, world_searcher, *m_caster->GetMap(), *m_caster, max_range); - } - + m_caster->GetMap()->VisitFirstFound(m_caster->GetPositionX(), m_caster->GetPositionY(), max_range, searcher); return result; } @@ -2554,11 +2540,15 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) { case 46584: // Raise Dead { - if (WorldObject* result = FindCorpseUsing<Trinity::RaiseDeadObjectCheck> ()) + if (WorldObject* result = FindCorpseUsing<Trinity::RaiseDeadObjectCheck>()) { switch (result->GetTypeId()) { case TYPEID_UNIT: + case TYPEID_PLAYER: + unitList.push_back(result->ToUnit()); + // no break; + case TYPEID_CORPSE: // wont work until corpses are allowed in target lists, but at least will send dest in packet m_targets.SetDst(*result); break; default: @@ -2582,7 +2572,7 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) { CleanupTargetList(); - WorldObject* result = FindCorpseUsing <Trinity::ExplodeCorpseObjectCheck> (); + WorldObject* result = FindCorpseUsing<Trinity::ExplodeCorpseObjectCheck>(); if (result) { @@ -2824,12 +2814,12 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) unitList.remove(m_targets.GetUnitTarget()); Trinity::RandomResizeList(unitList, maxTargets); } + } - CallScriptAfterUnitTargetSelectHandlers(unitList, SpellEffIndex(i)); + CallScriptAfterUnitTargetSelectHandlers(unitList, SpellEffIndex(i)); - for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - AddUnitTarget(*itr, effectMask, false); - } + for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + AddUnitTarget(*itr, effectMask, false); if (!gobjectList.empty()) { @@ -3725,6 +3715,27 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas case SPELL_FAILED_CUSTOM_ERROR: data << uint32(customError); break; + case SPELL_FAILED_REAGENTS: + { + uint32 missingItem = 0; + for (uint32 i = 0; i < MAX_SPELL_REAGENTS; i++) + { + if (spellInfo->Reagent[i] <= 0) + continue; + + uint32 itemid = spellInfo->Reagent[i]; + uint32 itemcount = spellInfo->ReagentCount[i]; + + if (!caster->HasItemCount(itemid, itemcount)) + { + missingItem = itemid; + break; + } + } + + data << uint32(missingItem); // first missing item + break; + } default: break; } @@ -5926,7 +5937,7 @@ SpellCastResult Spell::CheckItems() } } if (!p_caster->HasItemCount(itemid, itemcount)) - return SPELL_FAILED_ITEM_NOT_READY; //0x54 + return SPELL_FAILED_REAGENTS; } } diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp index 4e1b9da0adb..2789bc48a4c 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_jedoga_shadowseeker.cpp @@ -402,7 +402,8 @@ public: if (!CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerok) CAST_AI(boss_jedoga_shadowseeker::boss_jedoga_shadowseekerAI, boss->AI())->bOpFerokFail = true; - boss->AI()->DoAction(ACTION_INITIAND_KILLED); + if (Killer->GetTypeId() == TYPEID_PLAYER) + boss->AI()->DoAction(ACTION_INITIAND_KILLED); } instance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); |