Some refactoring of code. and some cleanups

This commit is contained in:
hondacrx
2019-09-21 12:11:16 -04:00
parent 7c405230cc
commit 35c06c09fd
214 changed files with 1235 additions and 1341 deletions
@@ -24,6 +24,11 @@ namespace Game.Entities
{
public class UpdateData
{
uint MapId;
uint BlockCount;
List<ObjectGuid> outOfRangeGUIDs = new List<ObjectGuid>();
ByteBuffer data = new ByteBuffer();
public UpdateData(uint mapId)
{
MapId = mapId;
@@ -82,10 +87,5 @@ namespace Game.Entities
public List<ObjectGuid> GetOutOfRangeGUIDs() { return outOfRangeGUIDs; }
public void SetMapId(ushort mapId) { MapId = mapId; }
uint MapId;
uint BlockCount;
List<ObjectGuid> outOfRangeGUIDs = new List<ObjectGuid>();
ByteBuffer data = new ByteBuffer();
}
}
@@ -27,6 +27,9 @@ namespace Game.Entities
{
public class UpdateFieldHolder
{
UpdateMask _changesMask = new UpdateMask((int)TypeId.Max);
WorldObject _owner;
public UpdateFieldHolder(WorldObject owner) { _owner = owner; }
public BaseUpdateData<T> ModifyValue<T>(BaseUpdateData<T> updateData)
@@ -59,9 +62,6 @@ namespace Game.Entities
{
return _changesMask[(int)index];
}
UpdateMask _changesMask = new UpdateMask((int)TypeId.Max);
WorldObject _owner;
}
public interface IUpdateField<T>
@@ -430,6 +430,9 @@ namespace Game.Entities
public class DynamicUpdateFieldSetter<T> : IUpdateField<T> where T : new()
{
DynamicUpdateField<T> _dynamicUpdateField;
int _index;
public DynamicUpdateFieldSetter(DynamicUpdateField<T> dynamicUpdateField, int index)
{
_dynamicUpdateField = dynamicUpdateField;
@@ -447,8 +450,5 @@ namespace Game.Entities
{
return dynamicUpdateFieldSetter.GetValue();
}
DynamicUpdateField<T> _dynamicUpdateField;
int _index;
}
}
@@ -19,9 +19,7 @@ using Framework.Constants;
using Game.Network;
using System;
using System.Collections.Generic;
using System.Linq;
using Framework.GameMath;
using System.Runtime.CompilerServices;
using Game.Spells;
using Game.DataStorage;
@@ -84,10 +82,10 @@ namespace Game.Entities
Creature creature = obj.ToCreature();
if (creature != null)
{
if (creature.hasLootRecipient() && !creature.isTappedBy(receiver))
if (creature.HasLootRecipient() && !creature.IsTappedBy(receiver))
unitDynFlags |= UnitDynFlags.Tapped;
if (!receiver.isAllowedToLoot(creature))
if (!receiver.IsAllowedToLoot(creature))
unitDynFlags &= ~UnitDynFlags.Lootable;
}
@@ -1998,7 +1996,7 @@ namespace Game.Entities
CreatureTemplate cinfo = unit.ToCreature().GetCreatureTemplate();
// this also applies for transform auras
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.getTransForm());
SpellInfo transform = Global.SpellMgr.GetSpellInfo(unit.GetTransForm());
if (transform != null)
{
foreach (SpellEffectInfo effect in transform.GetEffectsForDifficulty(unit.GetMap().GetDifficultyID()))
@@ -15,9 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.IO;
using System.Collections;
using System;
namespace Game.Entities