aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Instances/InstanceSaveMgr.h6
-rwxr-xr-xsrc/server/game/Scripting/MapScripts.cpp19
-rwxr-xr-xsrc/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp44
3 files changed, 38 insertions, 31 deletions
diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h
index 63d54e4ec94..dec50e40127 100755
--- a/src/server/game/Instances/InstanceSaveMgr.h
+++ b/src/server/game/Instances/InstanceSaveMgr.h
@@ -80,8 +80,8 @@ class InstanceSave
/* online players bound to the instance (perm/solo)
does not include the members of the group unless they have permanent saves */
- void AddPlayer(Player* player) { m_playerList.push_back(player); }
- bool RemovePlayer(Player* player) { m_playerList.remove(player); return UnloadIfEmpty(); }
+ void AddPlayer(Player* player) { ACE_GUARD(ACE_Thread_Mutex, guard, _lock); m_playerList.push_back(player); }
+ bool RemovePlayer(Player* player) { ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, _lock, false); m_playerList.remove(player); return UnloadIfEmpty(); }
/* all groups bound to the instance */
void AddGroup(Group* group) { m_groupList.push_back(group); }
bool RemoveGroup(Group* group) { m_groupList.remove(group); return UnloadIfEmpty(); }
@@ -110,6 +110,8 @@ class InstanceSave
uint32 m_mapid;
Difficulty m_difficulty;
bool m_canReset;
+
+ ACE_Thread_Mutex _lock;
};
typedef UNORDERED_MAP<uint32 /*PAIR32(map, difficulty)*/, time_t /*resetTime*/> ResetTimeByMapDifficultyMap;
diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp
index 90c1b432416..b141f889196 100755
--- a/src/server/game/Scripting/MapScripts.cpp
+++ b/src/server/game/Scripting/MapScripts.cpp
@@ -539,8 +539,8 @@ void Map::ScriptsProcess()
// when script called for item spell casting then target == (unit or GO) and source is player
WorldObject* worldObject;
- Player* pTarget = target->ToPlayer();
- if (pTarget)
+ Player* plrTarget = target->ToPlayer();
+ if (plrTarget)
{
if (source->GetTypeId() != TYPEID_UNIT && source->GetTypeId() != TYPEID_GAMEOBJECT && source->GetTypeId() != TYPEID_PLAYER)
{
@@ -552,8 +552,8 @@ void Map::ScriptsProcess()
}
else
{
- pTarget = source->ToPlayer();
- if (target)
+ plrTarget = source->ToPlayer();
+ if (plrTarget)
{
if (target->GetTypeId() != TYPEID_UNIT && target->GetTypeId() != TYPEID_GAMEOBJECT && target->GetTypeId() != TYPEID_PLAYER)
{
@@ -566,19 +566,18 @@ void Map::ScriptsProcess()
else
{
sLog->outError("%s neither source nor target is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.",
- step.script->GetDebugInfo().c_str(),
- source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0,
- target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0);
+ step.script->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow(),
+ target->GetTypeId(), target->GetEntry(), target->GetGUIDLow());
break;
}
}
// quest id and flags checked at script loading
if ((worldObject->GetTypeId() != TYPEID_UNIT || ((Unit*)worldObject)->isAlive()) &&
- (step.script->QuestExplored.Distance == 0 || worldObject->IsWithinDistInMap(pTarget, float(step.script->QuestExplored.Distance))))
- pTarget->AreaExploredOrEventHappens(step.script->QuestExplored.QuestID);
+ (step.script->QuestExplored.Distance == 0 || worldObject->IsWithinDistInMap(plrTarget, float(step.script->QuestExplored.Distance))))
+ plrTarget->AreaExploredOrEventHappens(step.script->QuestExplored.QuestID);
else
- pTarget->FailQuest(step.script->QuestExplored.QuestID);
+ plrTarget->FailQuest(step.script->QuestExplored.QuestID);
break;
}
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
index d5186833364..8e79bb185cf 100755
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp
@@ -815,38 +815,45 @@ class spell_putricide_ooze_channel : public SpellScriptLoader
}
};
+class ExactDistanceCheck
+{
+ public:
+ ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {}
+
+ bool operator()(Unit* unit)
+ {
+ return _source->GetExactDist2d(unit) > _dist;
+ }
+
+ private:
+ Unit* _source;
+ float _dist;
+};
+
class spell_putricide_slime_puddle : public SpellScriptLoader
{
public:
spell_putricide_slime_puddle() : SpellScriptLoader("spell_putricide_slime_puddle") { }
- class spell_putricide_slime_puddle_AuraScript : public AuraScript
+ class spell_putricide_slime_puddle_SpellScript : public SpellScript
{
- PrepareAuraScript(spell_putricide_slime_puddle_AuraScript);
+ PrepareSpellScript(spell_putricide_slime_puddle_SpellScript);
- void HandleTriggerSpell(AuraEffect const* aurEff)
+ void ScaleRange(std::list<Unit*>& targets)
{
- PreventDefaultAction();
- if (Unit* caster = GetCaster())
- {
- int32 radiusMod = 4;
- if (Aura* size = caster->GetAura(70347))
- radiusMod += size->GetStackAmount();
-
- uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell;
- caster->CastCustomSpell(triggerSpellId, SPELLVALUE_RADIUS_MOD, radiusMod * 100, caster, true);
- }
+ targets.remove_if(ExactDistanceCheck(GetCaster(), 2.5f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X)));
}
void Register()
{
- OnEffectPeriodic += AuraEffectPeriodicFn(spell_putricide_slime_puddle_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
+ OnUnitTargetSelect += SpellUnitTargetFn(spell_putricide_slime_puddle_SpellScript::ScaleRange, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY);
}
};
- AuraScript* GetAuraScript() const
+ SpellScript* GetSpellScript() const
{
- return new spell_putricide_slime_puddle_AuraScript();
+ return new spell_putricide_slime_puddle_SpellScript();
}
};
@@ -1051,7 +1058,6 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
return;
uint32 plagueId = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE, GetCaster());
- uint32 searcherId = sSpellMgr->GetSpellIdForDifficulty(SPELL_UNBOUND_PLAGUE_SEARCHER, GetCaster());
if (!GetHitUnit()->HasAura(plagueId))
{
@@ -1061,10 +1067,10 @@ class spell_putricide_unbound_plague : public SpellScriptLoader
{
if (Aura* newPlague = professor->AddAura(plagueId, GetHitUnit()))
{
- newPlague->SetMaxDuration(oldPlague->GetDuration());
+ newPlague->SetMaxDuration(oldPlague->GetMaxDuration());
newPlague->SetDuration(oldPlague->GetDuration());
oldPlague->Remove();
- GetCaster()->RemoveAurasDueToSpell(searcherId);
+ GetCaster()->RemoveAurasDueToSpell(SPELL_UNBOUND_PLAGUE_SEARCHER);
GetCaster()->CastSpell(GetCaster(), SPELL_PLAGUE_SICKNESS, true);
GetCaster()->CastSpell(GetCaster(), SPELL_UNBOUND_PLAGUE_PROTECTION, true);
professor->CastSpell(GetHitUnit(), SPELL_UNBOUND_PLAGUE_SEARCHER, true);