Core/Refactor: Part 1
This commit is contained in:
@@ -25,8 +25,6 @@ namespace Game.Entities
|
||||
{
|
||||
public class FormationMgr
|
||||
{
|
||||
public FormationMgr() { }
|
||||
|
||||
public static void AddCreatureToGroup(uint groupId, Creature member)
|
||||
{
|
||||
Map map = member.GetMap();
|
||||
|
||||
@@ -764,8 +764,6 @@ namespace Game.Misc
|
||||
|
||||
public class QuestMenu
|
||||
{
|
||||
public QuestMenu() { }
|
||||
|
||||
public void AddMenuItem(uint QuestId, byte Icon)
|
||||
{
|
||||
if (Global.ObjectMgr.GetQuestTemplate(QuestId) == null)
|
||||
|
||||
@@ -105,12 +105,6 @@ namespace Game.Entities
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void SaveToDB(SQLTransaction trans)
|
||||
{
|
||||
base.SaveToDB(trans);
|
||||
|
||||
}
|
||||
|
||||
public override bool LoadFromDB(ulong guid, ObjectGuid owner_guid, SQLFields fields, uint entry)
|
||||
{
|
||||
if (!base.LoadFromDB(guid, owner_guid, fields, entry))
|
||||
|
||||
@@ -180,12 +180,6 @@ namespace Game.Entities
|
||||
|
||||
public static bool operator ==(ObjectGuid first, ObjectGuid other)
|
||||
{
|
||||
if (ReferenceEquals(first, other))
|
||||
return true;
|
||||
|
||||
if ((object)first == null || (object)other == null)
|
||||
return false;
|
||||
|
||||
return first.Equals(other);
|
||||
}
|
||||
|
||||
|
||||
@@ -2444,10 +2444,9 @@ namespace Game.Entities
|
||||
|
||||
public bool IsInMap(WorldObject obj)
|
||||
{
|
||||
var m = GetMap().GetId();
|
||||
var b = obj.GetMap().GetId();
|
||||
if (obj != null)
|
||||
return IsInWorld && obj.IsInWorld && m == b;
|
||||
return IsInWorld && obj.IsInWorld && GetMap().GetId() == obj.GetMap().GetId();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,11 +30,6 @@ namespace Game.Entities
|
||||
{
|
||||
public partial class Player
|
||||
{
|
||||
public override void SetMap(Map map)
|
||||
{
|
||||
base.SetMap(map);
|
||||
}
|
||||
|
||||
public Difficulty GetDifficultyID(MapRecord mapEntry)
|
||||
{
|
||||
if (!mapEntry.IsRaid())
|
||||
|
||||
@@ -1683,9 +1683,12 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
bool destroyItem = true;
|
||||
foreach (QuestObjective obj in quest.Objectives)
|
||||
if (obj.Type == QuestObjectiveType.Item && srcItemId == obj.ObjectID)
|
||||
destroyItem = false;
|
||||
if (item.GetStartQuest() == questId)
|
||||
{
|
||||
foreach (QuestObjective obj in quest.Objectives)
|
||||
if (obj.Type == QuestObjectiveType.Item && srcItemId == obj.ObjectID)
|
||||
destroyItem = false;
|
||||
}
|
||||
|
||||
if (destroyItem)
|
||||
DestroyItemCount(srcItemId, count, true, true);
|
||||
|
||||
@@ -145,8 +145,6 @@ namespace Game.Entities
|
||||
{
|
||||
if (!GetThreatManager().isThreatListEmpty())
|
||||
{
|
||||
int count = GetThreatManager().getThreatList().Count;
|
||||
|
||||
ThreatUpdate packet = new ThreatUpdate();
|
||||
packet.UnitGUID = GetGUID();
|
||||
var tlist = GetThreatManager().getThreatList();
|
||||
|
||||
@@ -370,30 +370,32 @@ namespace Game.Entities
|
||||
// Set charmed
|
||||
charmer.SetCharm(this, true);
|
||||
|
||||
Player player;
|
||||
if (IsTypeId(TypeId.Unit))
|
||||
{
|
||||
ToCreature().GetAI().OnCharmed(true);
|
||||
GetMotionMaster().MoveIdle();
|
||||
}
|
||||
else if (player = ToPlayer())
|
||||
else
|
||||
{
|
||||
if (player.isAFK())
|
||||
player.ToggleAFK();
|
||||
|
||||
Creature creatureCharmer = charmer.ToCreature();
|
||||
if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature
|
||||
Player player = ToPlayer();
|
||||
if (player)
|
||||
{
|
||||
// change AI to charmed AI on next Update tick
|
||||
NeedChangeAI = true;
|
||||
if (IsAIEnabled)
|
||||
{
|
||||
IsAIEnabled = false;
|
||||
player.GetAI().OnCharmed(true);
|
||||
}
|
||||
}
|
||||
if (player.isAFK())
|
||||
player.ToggleAFK();
|
||||
|
||||
player.SetClientControl(this, false);
|
||||
if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature
|
||||
{
|
||||
// change AI to charmed AI on next Update tick
|
||||
NeedChangeAI = true;
|
||||
if (IsAIEnabled)
|
||||
{
|
||||
IsAIEnabled = false;
|
||||
player.GetAI().OnCharmed(true);
|
||||
}
|
||||
}
|
||||
|
||||
player.SetClientControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
// charm is set by aura, and aura effect remove handler was called during apply handler execution
|
||||
|
||||
@@ -3128,9 +3128,9 @@ namespace Game.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<DispelCharges> GetDispellableAuraList(Unit caster, uint dispelMask)
|
||||
public List<DispelableAura> GetDispellableAuraList(Unit caster, uint dispelMask, bool isReflect = false)
|
||||
{
|
||||
List<DispelCharges> dispelList = new List<DispelCharges>();
|
||||
List<DispelableAura> dispelList = new List<DispelableAura>();
|
||||
|
||||
var auras = GetOwnedAuras();
|
||||
foreach (var pair in auras)
|
||||
@@ -3147,8 +3147,14 @@ namespace Game.Entities
|
||||
if (Convert.ToBoolean(aura.GetSpellInfo().GetDispelMask() & dispelMask))
|
||||
{
|
||||
// do not remove positive auras if friendly target
|
||||
// negative auras if non-friendly target
|
||||
if (aurApp.IsPositive() == IsFriendlyTo(caster))
|
||||
// negative auras if non-friendly
|
||||
// unless we're reflecting (dispeller eliminates one of it's benefitial buffs)
|
||||
if (isReflect != (aurApp.IsPositive() == IsFriendlyTo(caster)))
|
||||
continue;
|
||||
|
||||
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
|
||||
int chance = aura.CalcDispelChance(this, !IsFriendlyTo(caster));
|
||||
if (chance == 0)
|
||||
continue;
|
||||
|
||||
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
|
||||
@@ -3157,7 +3163,7 @@ namespace Game.Entities
|
||||
bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges);
|
||||
byte charges = dispelCharges ? aura.GetCharges() : aura.GetStackAmount();
|
||||
if (charges > 0)
|
||||
dispelList.Add(new DispelCharges(aura, charges));
|
||||
dispelList.Add(new DispelableAura(aura, chance, charges));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,9 +61,9 @@ namespace Game.Entities
|
||||
InitMovementInfoForBase();
|
||||
}
|
||||
|
||||
public virtual void Dispose()
|
||||
public void Dispose()
|
||||
{
|
||||
/// @Uninstall must be called before this.
|
||||
// @Uninstall must be called before this.
|
||||
Contract.Assert(_status == Status.UnInstalling);
|
||||
foreach (var pair in Seats)
|
||||
Contract.Assert(pair.Value.IsEmpty());
|
||||
|
||||
Reference in New Issue
Block a user