Core/Misc: Fixes
This commit is contained in:
@@ -141,7 +141,7 @@ namespace Game.Chat
|
|||||||
if (spellId == 0)
|
if (spellId == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (CheckSpellExistsAndIsValid(handler, spellId))
|
if (!CheckSpellExistsAndIsValid(handler, spellId))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
target.CastSpell(target, spellId, false);
|
target.CastSpell(target, spellId, false);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace Game.Chat.Commands
|
|||||||
[Command("casttime", RBACPermissions.CommandCheatCasttime)]
|
[Command("casttime", RBACPermissions.CommandCheatCasttime)]
|
||||||
static bool HandleCasttimeCheat(StringArguments args, CommandHandler handler)
|
static bool HandleCasttimeCheat(StringArguments args, CommandHandler handler)
|
||||||
{
|
{
|
||||||
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
|
if (handler.GetSession() == null || !handler.GetSession().GetPlayer())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string argstr = args.NextString();
|
string argstr = args.NextString();
|
||||||
@@ -80,7 +80,7 @@ namespace Game.Chat.Commands
|
|||||||
[Command("cooldown", RBACPermissions.CommandCheatCooldown)]
|
[Command("cooldown", RBACPermissions.CommandCheatCooldown)]
|
||||||
static bool HandleCoolDownCheat(StringArguments args, CommandHandler handler)
|
static bool HandleCoolDownCheat(StringArguments args, CommandHandler handler)
|
||||||
{
|
{
|
||||||
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
|
if (handler.GetSession() == null || !handler.GetSession().GetPlayer())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string argstr = args.NextString();
|
string argstr = args.NextString();
|
||||||
@@ -107,7 +107,7 @@ namespace Game.Chat.Commands
|
|||||||
[Command("power", RBACPermissions.CommandCheatPower)]
|
[Command("power", RBACPermissions.CommandCheatPower)]
|
||||||
static bool HandlePowerCheat(StringArguments args, CommandHandler handler)
|
static bool HandlePowerCheat(StringArguments args, CommandHandler handler)
|
||||||
{
|
{
|
||||||
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
|
if (handler.GetSession() == null || !handler.GetSession().GetPlayer())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string argstr = args.NextString();
|
string argstr = args.NextString();
|
||||||
@@ -152,7 +152,7 @@ namespace Game.Chat.Commands
|
|||||||
[Command("waterwalk", RBACPermissions.CommandCheatWaterwalk)]
|
[Command("waterwalk", RBACPermissions.CommandCheatWaterwalk)]
|
||||||
static bool HandleWaterWalkCheat(StringArguments args, CommandHandler handler)
|
static bool HandleWaterWalkCheat(StringArguments args, CommandHandler handler)
|
||||||
{
|
{
|
||||||
if (handler.GetSession() == null || handler.GetSession().GetPlayer())
|
if (handler.GetSession() == null || !handler.GetSession().GetPlayer())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
string argstr = args.NextString();
|
string argstr = args.NextString();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Game
|
|||||||
GetPlayer().GetSceneMgr().OnSceneTrigger(sceneTriggerEvent.SceneInstanceID, sceneTriggerEvent._Event);
|
GetPlayer().GetSceneMgr().OnSceneTrigger(sceneTriggerEvent.SceneInstanceID, sceneTriggerEvent._Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WorldPacketHandler(ClientOpcodes.ScenePlaybackComplete)]
|
||||||
void HandleScenePlaybackComplete(ScenePlaybackComplete scenePlaybackComplete)
|
void HandleScenePlaybackComplete(ScenePlaybackComplete scenePlaybackComplete)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Scenes, "HandleScenePlaybackComplete: SceneInstanceID: {0}", scenePlaybackComplete.SceneInstanceID);
|
Log.outDebug(LogFilter.Scenes, "HandleScenePlaybackComplete: SceneInstanceID: {0}", scenePlaybackComplete.SceneInstanceID);
|
||||||
@@ -38,6 +39,7 @@ namespace Game
|
|||||||
GetPlayer().GetSceneMgr().OnSceneComplete(scenePlaybackComplete.SceneInstanceID);
|
GetPlayer().GetSceneMgr().OnSceneComplete(scenePlaybackComplete.SceneInstanceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[WorldPacketHandler(ClientOpcodes.ScenePlaybackCanceled)]
|
||||||
void HandleScenePlaybackCanceled(ScenePlaybackCanceled scenePlaybackCanceled)
|
void HandleScenePlaybackCanceled(ScenePlaybackCanceled scenePlaybackCanceled)
|
||||||
{
|
{
|
||||||
Log.outDebug(LogFilter.Scenes, "HandleScenePlaybackCanceled: SceneInstanceID: {0}", scenePlaybackCanceled.SceneInstanceID);
|
Log.outDebug(LogFilter.Scenes, "HandleScenePlaybackCanceled: SceneInstanceID: {0}", scenePlaybackCanceled.SceneInstanceID);
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace Game.Spells
|
|||||||
// Patch 1.2 notes: Spell Reflection no longer reflects abilities
|
// Patch 1.2 notes: Spell Reflection no longer reflects abilities
|
||||||
m_canReflect = m_spellInfo.DmgClass == SpellDmgClass.Magic && !m_spellInfo.HasAttribute(SpellAttr0.Ability)
|
m_canReflect = m_spellInfo.DmgClass == SpellDmgClass.Magic && !m_spellInfo.HasAttribute(SpellAttr0.Ability)
|
||||||
&& !m_spellInfo.HasAttribute(SpellAttr1.CantBeReflected) && !m_spellInfo.HasAttribute(SpellAttr0.UnaffectedByInvulnerability)
|
&& !m_spellInfo.HasAttribute(SpellAttr1.CantBeReflected) && !m_spellInfo.HasAttribute(SpellAttr0.UnaffectedByInvulnerability)
|
||||||
&& !m_spellInfo.IsPassive() && !m_spellInfo.IsPositive();
|
&& !m_spellInfo.IsPassive();
|
||||||
|
|
||||||
CleanupTargetList();
|
CleanupTargetList();
|
||||||
|
|
||||||
@@ -1657,7 +1657,7 @@ namespace Game.Spells
|
|||||||
// Calculate hit result
|
// Calculate hit result
|
||||||
if (m_originalCaster != null)
|
if (m_originalCaster != null)
|
||||||
{
|
{
|
||||||
targetInfo.missCondition = m_originalCaster.SpellHitResult(target, m_spellInfo, m_canReflect);
|
targetInfo.missCondition = m_originalCaster.SpellHitResult(target, m_spellInfo, m_canReflect && !(m_spellInfo.IsPositive() && m_caster.IsFriendlyTo(target)));
|
||||||
if (m_skipCheck && targetInfo.missCondition != SpellMissInfo.Immune)
|
if (m_skipCheck && targetInfo.missCondition != SpellMissInfo.Immune)
|
||||||
targetInfo.missCondition = SpellMissInfo.None;
|
targetInfo.missCondition = SpellMissInfo.None;
|
||||||
}
|
}
|
||||||
@@ -7495,14 +7495,16 @@ namespace Game.Spells
|
|||||||
{
|
{
|
||||||
public ObjectGuid targetGUID;
|
public ObjectGuid targetGUID;
|
||||||
public ulong timeDelay;
|
public ulong timeDelay;
|
||||||
|
public int damage;
|
||||||
|
|
||||||
public SpellMissInfo missCondition;
|
public SpellMissInfo missCondition;
|
||||||
public SpellMissInfo reflectResult;
|
public SpellMissInfo reflectResult;
|
||||||
|
|
||||||
public uint effectMask;
|
public uint effectMask;
|
||||||
public bool processed;
|
public bool processed;
|
||||||
public bool alive;
|
public bool alive;
|
||||||
public bool crit;
|
public bool crit;
|
||||||
public bool scaleAura;
|
public bool scaleAura;
|
||||||
public int damage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class GOTargetInfo
|
public class GOTargetInfo
|
||||||
|
|||||||
@@ -1920,7 +1920,7 @@ namespace Game.Spells
|
|||||||
for (int count = 0; count < damage && remaining > 0;)
|
for (int count = 0; count < damage && remaining > 0;)
|
||||||
{
|
{
|
||||||
// Random select buff for dispel
|
// Random select buff for dispel
|
||||||
var dispelableAura = dispelList[RandomHelper.IRand(0, dispelList.Count - 1)];
|
var dispelableAura = dispelList[RandomHelper.IRand(0, remaining - 1)];
|
||||||
|
|
||||||
if (dispelableAura.RollDispel())
|
if (dispelableAura.RollDispel())
|
||||||
{
|
{
|
||||||
@@ -4708,7 +4708,7 @@ namespace Game.Spells
|
|||||||
if (unitTarget == null || unitTarget == m_caster) // can't steal from self
|
if (unitTarget == null || unitTarget == m_caster) // can't steal from self
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<Tuple<Aura, byte>> steal_list = new List<Tuple<Aura, byte>>();
|
List<DispelableAura> stealList = new List<DispelableAura>();
|
||||||
|
|
||||||
// Create dispel mask by dispel type
|
// Create dispel mask by dispel type
|
||||||
uint dispelMask = SpellInfo.GetDispelMask((DispelType)effectInfo.MiscValue);
|
uint dispelMask = SpellInfo.GetDispelMask((DispelType)effectInfo.MiscValue);
|
||||||
@@ -4726,21 +4726,29 @@ namespace Game.Spells
|
|||||||
if (!aurApp.IsPositive() || aura.IsPassive() || aura.GetSpellInfo().HasAttribute(SpellAttr4.NotStealable))
|
if (!aurApp.IsPositive() || aura.IsPassive() || aura.GetSpellInfo().HasAttribute(SpellAttr4.NotStealable))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
|
||||||
|
int chance = aura.CalcDispelChance(unitTarget, !unitTarget.IsFriendlyTo(m_caster));
|
||||||
|
if (chance == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
|
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
|
||||||
// Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) . 50% chance to dispell
|
// Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
|
||||||
// Polymorph instead of 1 / (5 + 1) . 16%.
|
// Polymorph instead of 1 / (5 + 1) -> 16%.
|
||||||
bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges);
|
bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges);
|
||||||
byte charges = dispelCharges ? aura.GetCharges() : aura.GetStackAmount();
|
byte charges = dispelCharges ? aura.GetCharges() : aura.GetStackAmount();
|
||||||
if (charges > 0)
|
if (charges > 0)
|
||||||
steal_list.Add(Tuple.Create(aura, charges));
|
stealList.Add(new DispelableAura(aura, chance, charges));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (steal_list.Empty())
|
if (stealList.Empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int remaining = stealList.Count;
|
||||||
|
|
||||||
// Ok if exist some buffs for dispel try dispel it
|
// Ok if exist some buffs for dispel try dispel it
|
||||||
List<KeyValuePair<uint, ObjectGuid>> success_list = new List<KeyValuePair<uint, ObjectGuid>>();
|
uint failCount = 0;
|
||||||
|
List<Tuple<uint, ObjectGuid>> successList = new List<Tuple<uint, ObjectGuid>>();
|
||||||
|
|
||||||
DispelFailed dispelFailed = new DispelFailed();
|
DispelFailed dispelFailed = new DispelFailed();
|
||||||
dispelFailed.CasterGUID = m_caster.GetGUID();
|
dispelFailed.CasterGUID = m_caster.GetGUID();
|
||||||
@@ -4748,40 +4756,32 @@ namespace Game.Spells
|
|||||||
dispelFailed.SpellID = m_spellInfo.Id;
|
dispelFailed.SpellID = m_spellInfo.Id;
|
||||||
|
|
||||||
// dispel N = damage buffs (or while exist buffs for dispel)
|
// dispel N = damage buffs (or while exist buffs for dispel)
|
||||||
for (int count = 0; count < damage && !steal_list.Empty();)
|
for (int count = 0; count < damage && remaining > 0;)
|
||||||
{
|
{
|
||||||
// Random select buff for dispel
|
// Random select buff for dispel
|
||||||
var pair = steal_list[RandomHelper.IRand(0, steal_list.Count - 1)];
|
var dispelableAura = stealList[RandomHelper.IRand(0, remaining - 1)];
|
||||||
|
|
||||||
int chance = pair.Item1.CalcDispelChance(unitTarget, !unitTarget.IsFriendlyTo(m_caster));
|
if (dispelableAura.RollDispel())
|
||||||
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
|
|
||||||
if (chance == 0)
|
|
||||||
{
|
{
|
||||||
steal_list.Remove(pair);
|
successList.Add(Tuple.Create(dispelableAura.GetAura().GetId(), dispelableAura.GetAura().GetCasterGUID()));
|
||||||
continue;
|
if (!dispelableAura.DecrementCharge())
|
||||||
|
{
|
||||||
|
--remaining;
|
||||||
|
stealList[remaining] = dispelableAura;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (RandomHelper.randChance(chance))
|
++failCount;
|
||||||
{
|
dispelFailed.FailedSpells.Add(dispelableAura.GetAura().GetId());
|
||||||
success_list.Add(new KeyValuePair<uint, ObjectGuid>(pair.Item1.GetId(), pair.Item1.GetCasterGUID()));
|
|
||||||
var temp = pair.Item2;
|
|
||||||
--temp;
|
|
||||||
pair = Tuple.Create(pair.Item1, temp);
|
|
||||||
if (pair.Item2 <= 0)
|
|
||||||
steal_list.Remove(pair);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
dispelFailed.FailedSpells.Add(pair.Item1.GetId());
|
|
||||||
|
|
||||||
++count;
|
|
||||||
}
|
}
|
||||||
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dispelFailed.FailedSpells.Empty())
|
if (!dispelFailed.FailedSpells.Empty())
|
||||||
m_caster.SendMessageToSet(dispelFailed, true);
|
m_caster.SendMessageToSet(dispelFailed, true);
|
||||||
|
|
||||||
if (success_list.Empty())
|
if (successList.Empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SpellDispellLog spellDispellLog = new SpellDispellLog();
|
SpellDispellLog spellDispellLog = new SpellDispellLog();
|
||||||
@@ -4792,15 +4792,15 @@ namespace Game.Spells
|
|||||||
spellDispellLog.CasterGUID = m_caster.GetGUID();
|
spellDispellLog.CasterGUID = m_caster.GetGUID();
|
||||||
spellDispellLog.DispelledBySpellID = m_spellInfo.Id;
|
spellDispellLog.DispelledBySpellID = m_spellInfo.Id;
|
||||||
|
|
||||||
foreach (var dispell in success_list)
|
foreach (var dispell in successList)
|
||||||
{
|
{
|
||||||
var dispellData = new SpellDispellData();
|
var dispellData = new SpellDispellData();
|
||||||
dispellData.SpellID = dispell.Key;
|
dispellData.SpellID = dispell.Item1;
|
||||||
dispellData.Harmful = false; // TODO: use me
|
dispellData.Harmful = false; // TODO: use me
|
||||||
//dispellData.Rolled = none; // TODO: use me
|
//dispellData.Rolled = none; // TODO: use me
|
||||||
//dispellData.Needed = none; // TODO: use me
|
//dispellData.Needed = none; // TODO: use me
|
||||||
|
|
||||||
unitTarget.RemoveAurasDueToSpellBySteal(dispell.Key, dispell.Value, m_caster);
|
unitTarget.RemoveAurasDueToSpellBySteal(dispell.Item1, dispell.Item2, m_caster);
|
||||||
|
|
||||||
spellDispellLog.DispellData.Add(dispellData);
|
spellDispellLog.DispellData.Add(dispellData);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user