Core/Errors: Stop using System.Diagnostics.Contracts, Its just closing the server without error or warning. We now log the error and then throw a exception
This commit is contained in:
@@ -27,7 +27,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -662,7 +661,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
Contract.Assert(i_disabledAI == null, "The disabled AI wasn't cleared!");
|
||||
Cypher.Assert(i_disabledAI == null, "The disabled AI wasn't cleared!");
|
||||
|
||||
i_AI = null;
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Network.Packets;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Misc
|
||||
@@ -32,7 +31,7 @@ namespace Game.Misc
|
||||
{
|
||||
public uint AddMenuItem(int optionIndex, GossipOptionIcon icon, string message, uint sender, uint action, string boxMessage, uint boxMoney, bool coded = false)
|
||||
{
|
||||
Contract.Assert(_menuItems.Count <= SharedConst.MaxGossipMenuItems);
|
||||
Cypher.Assert(_menuItems.Count <= SharedConst.MaxGossipMenuItems);
|
||||
|
||||
// Find a free new id - script case
|
||||
if (optionIndex == -1)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Spells;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
@@ -36,9 +35,9 @@ namespace Game.Entities
|
||||
public override void Dispose()
|
||||
{
|
||||
// make sure all references were properly removed
|
||||
Contract.Assert(_aura == null);
|
||||
Contract.Assert(!_caster);
|
||||
Contract.Assert(!_isViewpoint);
|
||||
Cypher.Assert(_aura == null);
|
||||
Cypher.Assert(!_caster);
|
||||
Cypher.Assert(!_isViewpoint);
|
||||
_removedAura = null;
|
||||
|
||||
base.Dispose();
|
||||
@@ -129,8 +128,8 @@ namespace Game.Entities
|
||||
public override void Update(uint diff)
|
||||
{
|
||||
// caster has to be always available and in the same map
|
||||
Contract.Assert(_caster != null);
|
||||
Contract.Assert(_caster.GetMap() == GetMap());
|
||||
Cypher.Assert(_caster != null);
|
||||
Cypher.Assert(_caster.GetMap() == GetMap());
|
||||
|
||||
bool expired = false;
|
||||
|
||||
@@ -189,13 +188,13 @@ namespace Game.Entities
|
||||
|
||||
public void SetAura(Aura aura)
|
||||
{
|
||||
Contract.Assert(_aura == null && aura != null);
|
||||
Cypher.Assert(_aura == null && aura != null);
|
||||
_aura = aura;
|
||||
}
|
||||
|
||||
void RemoveAura()
|
||||
{
|
||||
Contract.Assert(_aura != null && _removedAura == null);
|
||||
Cypher.Assert(_aura != null && _removedAura == null);
|
||||
_removedAura = _aura;
|
||||
_aura = null;
|
||||
if (!_removedAura.IsRemoved())
|
||||
@@ -224,16 +223,16 @@ namespace Game.Entities
|
||||
|
||||
void BindToCaster()
|
||||
{
|
||||
Contract.Assert(_caster == null);
|
||||
Cypher.Assert(_caster == null);
|
||||
_caster = Global.ObjAccessor.GetUnit(this, GetCasterGUID());
|
||||
Contract.Assert(_caster != null);
|
||||
Contract.Assert(_caster.GetMap() == GetMap());
|
||||
Cypher.Assert(_caster != null);
|
||||
Cypher.Assert(_caster.GetMap() == GetMap());
|
||||
_caster._RegisterDynObject(this);
|
||||
}
|
||||
|
||||
void UnbindFromCaster()
|
||||
{
|
||||
Contract.Assert(_caster != null);
|
||||
Cypher.Assert(_caster != null);
|
||||
_caster._UnregisterDynObject(this);
|
||||
_caster = null;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -100,7 +99,7 @@ namespace Game.Entities
|
||||
if (owner)
|
||||
{
|
||||
owner.RemoveGameObject(this, false);
|
||||
Contract.Assert(GetOwnerGUID().IsEmpty());
|
||||
Cypher.Assert(GetOwnerGUID().IsEmpty());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -182,7 +181,7 @@ namespace Game.Entities
|
||||
|
||||
bool Create(uint entry, Map map, Position pos, Quaternion rotation, uint animProgress, GameObjectState goState, uint artKit)
|
||||
{
|
||||
Contract.Assert(map);
|
||||
Cypher.Assert(map);
|
||||
SetMap(map);
|
||||
|
||||
Relocate(pos);
|
||||
@@ -2143,7 +2142,7 @@ namespace Game.Entities
|
||||
public void SetDestructibleState(GameObjectDestructibleState state, Player eventInvoker = null, bool setHealth = false)
|
||||
{
|
||||
// the user calling this must know he is already operating on destructible gameobject
|
||||
Contract.Assert(GetGoType() == GameObjectTypes.DestructibleBuilding);
|
||||
Cypher.Assert(GetGoType() == GameObjectTypes.DestructibleBuilding);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
@@ -2278,7 +2277,7 @@ namespace Game.Entities
|
||||
|
||||
public virtual uint GetTransportPeriod()
|
||||
{
|
||||
Contract.Assert(GetGoInfo().type == GameObjectTypes.Transport);
|
||||
Cypher.Assert(GetGoInfo().type == GameObjectTypes.Transport);
|
||||
if (m_goValue.Transport.AnimationInfo.Path != null)
|
||||
return m_goValue.Transport.AnimationInfo.TotalTime;
|
||||
|
||||
@@ -2290,8 +2289,8 @@ namespace Game.Entities
|
||||
if (GetGoState() == state)
|
||||
return;
|
||||
|
||||
Contract.Assert(GetGoInfo().type == GameObjectTypes.Transport);
|
||||
Contract.Assert(state >= GameObjectState.TransportActive);
|
||||
Cypher.Assert(GetGoInfo().type == GameObjectTypes.Transport);
|
||||
Cypher.Assert(state >= GameObjectState.TransportActive);
|
||||
if (state == GameObjectState.TransportActive)
|
||||
{
|
||||
m_goValue.Transport.StateUpdateTimer = 0;
|
||||
@@ -2302,7 +2301,7 @@ namespace Game.Entities
|
||||
}
|
||||
else
|
||||
{
|
||||
Contract.Assert(stopFrame < m_goValue.Transport.StopFrames.Count);
|
||||
Cypher.Assert(stopFrame < m_goValue.Transport.StopFrames.Count);
|
||||
m_goValue.Transport.PathProgress = Time.GetMSTime() + m_goValue.Transport.StopFrames[(int)stopFrame];
|
||||
SetGoState((GameObjectState)((int)GameObjectState.TransportStopped + stopFrame));
|
||||
}
|
||||
@@ -2631,7 +2630,7 @@ namespace Game.Entities
|
||||
// Owner already found and different than expected owner - remove object from old owner
|
||||
if (!owner.IsEmpty() && !GetOwnerGUID().IsEmpty() && GetOwnerGUID() != owner)
|
||||
{
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
m_spawnedByDefault = false; // all object with owner is despawned after delay
|
||||
SetGuidValue(GameObjectFields.CreatedBy, owner);
|
||||
|
||||
@@ -26,7 +26,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
@@ -759,7 +758,7 @@ namespace Game.Entities
|
||||
if (item.IsInUpdateQueue())
|
||||
return;
|
||||
|
||||
Contract.Assert(player != null);
|
||||
Cypher.Assert(player != null);
|
||||
|
||||
if (player.GetGUID() != item.GetOwnerGUID())
|
||||
{
|
||||
@@ -779,7 +778,7 @@ namespace Game.Entities
|
||||
if (!item.IsInUpdateQueue())
|
||||
return;
|
||||
|
||||
Contract.Assert(player != null);
|
||||
Cypher.Assert(player != null);
|
||||
|
||||
if (player.GetGUID() != item.GetOwnerGUID())
|
||||
{
|
||||
@@ -2054,7 +2053,7 @@ namespace Game.Entities
|
||||
|
||||
public int GetItemStatValue(uint index, Player owner)
|
||||
{
|
||||
Contract.Assert(index < ItemConst.MaxStats);
|
||||
Cypher.Assert(index < ItemConst.MaxStats);
|
||||
uint itemLevel = GetItemLevel(owner);
|
||||
uint randomPropPoints = ItemEnchantment.GetRandomPropertyPoints(itemLevel, GetQuality(), GetTemplate().GetInventoryType(), GetTemplate().GetSubClass());
|
||||
if (randomPropPoints != 0)
|
||||
@@ -2550,7 +2549,7 @@ namespace Game.Entities
|
||||
|
||||
if (eff.EquippedItemCount == 0) //all items of a set were removed
|
||||
{
|
||||
Contract.Assert(eff == player.ItemSetEff[setindex]);
|
||||
Cypher.Assert(eff == player.ItemSetEff[setindex]);
|
||||
player.ItemSetEff[setindex] = null;
|
||||
}
|
||||
}
|
||||
@@ -2632,12 +2631,12 @@ namespace Game.Entities
|
||||
public ItemQuality GetQuality() { return _bonusData.Quality; }
|
||||
public int GetItemStatType(uint index)
|
||||
{
|
||||
Contract.Assert(index < ItemConst.MaxStats);
|
||||
Cypher.Assert(index < ItemConst.MaxStats);
|
||||
return _bonusData.ItemStatType[index];
|
||||
}
|
||||
public SocketColor GetSocketColor(uint index)
|
||||
{
|
||||
Contract.Assert(index < ItemConst.MaxGemSockets);
|
||||
Cypher.Assert(index < ItemConst.MaxGemSockets);
|
||||
return _bonusData.socketColor[index];
|
||||
}
|
||||
public uint GetAppearanceModId() { return GetUInt32Value(ItemFields.AppearanceModId); }
|
||||
|
||||
@@ -20,7 +20,6 @@ using Game.DataStorage;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
@@ -275,22 +274,22 @@ namespace Game.Entities
|
||||
public uint GetContainerSlots() { return ExtendedData.ContainerSlots; }
|
||||
public int GetItemStatType(uint index)
|
||||
{
|
||||
Contract.Assert(index < ItemConst.MaxStats);
|
||||
Cypher.Assert(index < ItemConst.MaxStats);
|
||||
return ExtendedData.StatModifierBonusStat[index];
|
||||
}
|
||||
public int GetItemStatValue(uint index)
|
||||
{
|
||||
Contract.Assert(index < ItemConst.MaxStats);
|
||||
Cypher.Assert(index < ItemConst.MaxStats);
|
||||
return ExtendedData.ItemStatValue[index];
|
||||
}
|
||||
public int GetItemStatAllocation(uint index)
|
||||
{
|
||||
Contract.Assert(index < ItemConst.MaxStats);
|
||||
Cypher.Assert(index < ItemConst.MaxStats);
|
||||
return ExtendedData.StatPercentEditor[index];
|
||||
}
|
||||
public float GetItemStatSocketCostMultiplier(uint index)
|
||||
{
|
||||
Contract.Assert(index < ItemConst.MaxStats);
|
||||
Cypher.Assert(index < ItemConst.MaxStats);
|
||||
return ExtendedData.StatPercentageOfSocket[index];
|
||||
}
|
||||
public uint GetScalingStatDistribution() { return ExtendedData.ScalingStatDistributionID; }
|
||||
@@ -310,7 +309,7 @@ namespace Game.Entities
|
||||
public uint GetTotemCategory() { return ExtendedData.TotemCategoryID; }
|
||||
public SocketColor GetSocketColor(uint index)
|
||||
{
|
||||
Contract.Assert(index < ItemConst.MaxGemSockets);
|
||||
Cypher.Assert(index < ItemConst.MaxGemSockets);
|
||||
return (SocketColor)ExtendedData.SocketType[index];
|
||||
}
|
||||
public uint GetSocketBonus() { return ExtendedData.SocketMatchEnchantmentId; }
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -39,7 +38,7 @@ namespace Game.Entities
|
||||
{
|
||||
m_petType = type;
|
||||
|
||||
Contract.Assert(GetOwner().IsTypeId(TypeId.Player));
|
||||
Cypher.Assert(GetOwner().IsTypeId(TypeId.Player));
|
||||
|
||||
m_unitTypeMask |= UnitTypeMask.Pet;
|
||||
if (type == PetType.Hunter)
|
||||
@@ -663,7 +662,7 @@ namespace Game.Entities
|
||||
|
||||
public bool CreateBaseAtCreature(Creature creature)
|
||||
{
|
||||
Contract.Assert(creature);
|
||||
Cypher.Assert(creature);
|
||||
|
||||
if (!CreateBaseAtTamed(creature.GetCreatureTemplate(), creature.GetMap()))
|
||||
return false;
|
||||
@@ -1336,7 +1335,7 @@ namespace Game.Entities
|
||||
|
||||
public bool Create(ulong guidlow, Map map, uint Entry)
|
||||
{
|
||||
Contract.Assert(map);
|
||||
Cypher.Assert(map);
|
||||
SetMap(map);
|
||||
|
||||
_Create(ObjectGuid.Create(HighGuid.Pet, map.GetId(), Entry, guidlow));
|
||||
|
||||
@@ -30,7 +30,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -2670,7 +2669,7 @@ namespace Game.Entities
|
||||
var nodeEntry = CliDB.TaxiNodesStorage.LookupByKey(nodeid);
|
||||
if (nodeEntry != null && nodeEntry.ContinentID == GetMapId())
|
||||
{
|
||||
Contract.Assert(nodeEntry != null); // checked in m_taxi.LoadTaxiDestinationsFromString
|
||||
Cypher.Assert(nodeEntry != null); // checked in m_taxi.LoadTaxiDestinationsFromString
|
||||
mapId = nodeEntry.ContinentID;
|
||||
Relocate(nodeEntry.Pos.X, nodeEntry.Pos.Y, nodeEntry.Pos.Z, 0.0f);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Game.Groups;
|
||||
using Game.Maps;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
@@ -165,7 +164,7 @@ namespace Game.Entities
|
||||
|
||||
public void SetPartyType(GroupCategory category, GroupType type)
|
||||
{
|
||||
Contract.Assert(category < GroupCategory.Max);
|
||||
Cypher.Assert(category < GroupCategory.Max);
|
||||
byte value = GetByteValue(PlayerFields.Bytes3, PlayerFieldOffsets.Bytes3OffsetPartyType);
|
||||
value &= (byte)~((byte)0xFF << ((byte)category * 4));
|
||||
value |= (byte)((byte)type << ((byte)category * 4));
|
||||
|
||||
@@ -29,7 +29,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -122,7 +121,7 @@ namespace Game.Entities
|
||||
{
|
||||
List<ItemPosCount> dest = new List<ItemPosCount>();
|
||||
InventoryResult msg = CanStoreNewItem(ItemConst.NullBag, ItemConst.NullSlot, dest, itemid, count);
|
||||
Contract.Assert(msg == InventoryResult.Ok); // Already checked before
|
||||
Cypher.Assert(msg == InventoryResult.Ok); // Already checked before
|
||||
Item it = StoreNewItem(dest, itemid, true);
|
||||
SendNewItem(it, count, true, false, true);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
@@ -241,7 +240,7 @@ namespace Game.Entities
|
||||
//we should obtain map from GetMap() in 99% of cases. Special case
|
||||
//only for quests which cast teleport spells on player
|
||||
Map _map = IsInWorld ? GetMap() : Global.MapMgr.FindMap(GetMapId(), GetInstanceId());
|
||||
Contract.Assert(_map != null);
|
||||
Cypher.Assert(_map != null);
|
||||
GameObject gameObject = _map.GetGameObject(guid);
|
||||
if (gameObject != null)
|
||||
{
|
||||
@@ -342,7 +341,7 @@ namespace Game.Entities
|
||||
switch (guid.GetHigh())
|
||||
{
|
||||
case HighGuid.Player:
|
||||
Contract.Assert(quest.HasFlag(QuestFlags.AutoComplete));
|
||||
Cypher.Assert(quest.HasFlag(QuestFlags.AutoComplete));
|
||||
return Global.ObjectMgr.GetQuestTemplate(nextQuestID);
|
||||
case HighGuid.Creature:
|
||||
case HighGuid.Pet:
|
||||
@@ -360,7 +359,7 @@ namespace Game.Entities
|
||||
//we should obtain map from GetMap() in 99% of cases. Special case
|
||||
//only for quests which cast teleport spells on player
|
||||
Map _map = IsInWorld ? GetMap() : Global.MapMgr.FindMap(GetMapId(), GetInstanceId());
|
||||
Contract.Assert(_map != null);
|
||||
Cypher.Assert(_map != null);
|
||||
GameObject gameObject = _map.GetGameObject(guid);
|
||||
if (gameObject != null)
|
||||
objectQR = Global.ObjectMgr.GetGOQuestRelationBounds(gameObject.GetEntry());
|
||||
@@ -2156,7 +2155,7 @@ namespace Game.Entities
|
||||
|
||||
public void KilledMonster(CreatureTemplate cInfo, ObjectGuid guid)
|
||||
{
|
||||
Contract.Assert(cInfo != null);
|
||||
Cypher.Assert(cInfo != null);
|
||||
|
||||
if (cInfo.Entry != 0)
|
||||
KilledMonsterCredit(cInfo.Entry, guid);
|
||||
|
||||
@@ -37,7 +37,6 @@ using Game.PvP;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -1091,7 +1090,7 @@ namespace Game.Entities
|
||||
if (!charm.GetCharmerGUID().IsEmpty())
|
||||
{
|
||||
Log.outFatal(LogFilter.Player, "Charmed unit has charmer guid {0}", charm.GetCharmerGUID());
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
SetCharm(charm, false);
|
||||
@@ -1231,7 +1230,7 @@ namespace Game.Entities
|
||||
return;
|
||||
|
||||
CurrencyTypesRecord currency = CliDB.CurrencyTypesStorage.LookupByKey(id);
|
||||
Contract.Assert(currency != null);
|
||||
Cypher.Assert(currency != null);
|
||||
|
||||
if (!ignoreMultipliers)
|
||||
count *= (int)GetTotalAuraMultiplierByMiscValue(AuraType.ModCurrencyGain, (int)id);
|
||||
@@ -2605,7 +2604,7 @@ namespace Game.Entities
|
||||
|
||||
return textId;
|
||||
}
|
||||
uint GetDefaultGossipMenuForSource(WorldObject source)
|
||||
public static uint GetDefaultGossipMenuForSource(WorldObject source)
|
||||
{
|
||||
switch (source.GetTypeId())
|
||||
{
|
||||
@@ -3546,7 +3545,7 @@ namespace Game.Entities
|
||||
|
||||
public void SetResurrectRequestData(Unit caster, uint health, uint mana, uint appliedAura)
|
||||
{
|
||||
Contract.Assert(!IsResurrectRequested());
|
||||
Cypher.Assert(!IsResurrectRequested());
|
||||
_resurrectionData = new ResurrectionData();
|
||||
_resurrectionData.GUID = caster.GetGUID();
|
||||
_resurrectionData.Location.WorldRelocate(caster);
|
||||
@@ -5099,9 +5098,9 @@ namespace Game.Entities
|
||||
return GetCollisionHeight(false);
|
||||
|
||||
var displayInfo = CliDB.CreatureDisplayInfoStorage.LookupByKey(GetNativeDisplayId());
|
||||
Contract.Assert(displayInfo != null);
|
||||
Cypher.Assert(displayInfo != null);
|
||||
var modelData = CliDB.CreatureModelDataStorage.LookupByKey(displayInfo.ModelID);
|
||||
Contract.Assert(modelData != null);
|
||||
Cypher.Assert(modelData != null);
|
||||
|
||||
float scaleMod = GetObjectScale(); // 99% sure about this
|
||||
|
||||
@@ -5111,9 +5110,9 @@ namespace Game.Entities
|
||||
{
|
||||
//! Dismounting case - use basic default model data
|
||||
var displayInfo = CliDB.CreatureDisplayInfoStorage.LookupByKey(GetNativeDisplayId());
|
||||
Contract.Assert(displayInfo != null);
|
||||
Cypher.Assert(displayInfo != null);
|
||||
var modelData = CliDB.CreatureModelDataStorage.LookupByKey(displayInfo.ModelID);
|
||||
Contract.Assert(modelData != null);
|
||||
Cypher.Assert(modelData != null);
|
||||
|
||||
return modelData.CollisionHeight;
|
||||
}
|
||||
@@ -7009,7 +7008,7 @@ namespace Game.Entities
|
||||
//new
|
||||
public uint DoRandomRoll(uint minimum, uint maximum)
|
||||
{
|
||||
Contract.Assert(maximum <= 10000);
|
||||
Cypher.Assert(maximum <= 10000);
|
||||
|
||||
uint roll = RandomHelper.URand(minimum, maximum);
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
using Framework.Constants;
|
||||
using Framework.Dynamic;
|
||||
using Game.DataStorage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Entities
|
||||
{
|
||||
@@ -175,7 +175,7 @@ namespace Game.Entities
|
||||
|
||||
public virtual void InitStats(uint duration)
|
||||
{
|
||||
Contract.Assert(!IsPet());
|
||||
Cypher.Assert(!IsPet());
|
||||
|
||||
m_timer = duration;
|
||||
m_lifetime = duration;
|
||||
@@ -250,11 +250,11 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
Contract.Assert(!IsPet());
|
||||
Cypher.Assert(!IsPet());
|
||||
if (IsPet())
|
||||
{
|
||||
ToPet().Remove(PetSaveMode.NotInSlot);
|
||||
Contract.Assert(!IsInWorld);
|
||||
Cypher.Assert(!IsInWorld);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -313,9 +313,11 @@ namespace Game.Entities
|
||||
: base(properties, owner, isWorldObject)
|
||||
{
|
||||
m_owner = owner;
|
||||
Contract.Assert(m_owner);
|
||||
Cypher.Assert(m_owner);
|
||||
m_unitTypeMask |= UnitTypeMask.Minion;
|
||||
m_followAngle = SharedConst.PetFollowAngle;
|
||||
/// @todo: Find correct way
|
||||
InitCharmInfo();
|
||||
}
|
||||
|
||||
public override void InitStats(uint duration)
|
||||
@@ -411,7 +413,7 @@ namespace Game.Entities
|
||||
public bool InitStatsForLevel(uint petlevel)
|
||||
{
|
||||
CreatureTemplate cinfo = GetCreatureTemplate();
|
||||
Contract.Assert(cinfo != null);
|
||||
Cypher.Assert(cinfo != null);
|
||||
|
||||
SetLevel(petlevel);
|
||||
|
||||
@@ -966,10 +968,9 @@ namespace Game.Entities
|
||||
|
||||
public class Puppet : Minion
|
||||
{
|
||||
public Puppet(SummonPropertiesRecord properties, Unit owner)
|
||||
: base(properties, owner, false)
|
||||
public Puppet(SummonPropertiesRecord properties, Unit owner) : base(properties, owner, false)
|
||||
{
|
||||
Contract.Assert(owner.IsTypeId(TypeId.Player));
|
||||
Cypher.Assert(owner.IsTypeId(TypeId.Player));
|
||||
m_unitTypeMask |= UnitTypeMask.Puppet;
|
||||
}
|
||||
|
||||
@@ -985,7 +986,7 @@ namespace Game.Entities
|
||||
{
|
||||
base.InitSummon();
|
||||
if (!SetCharmedBy(GetOwner(), CharmType.Possess))
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
public override void Update(uint diff)
|
||||
|
||||
@@ -21,7 +21,6 @@ using Game.DataStorage;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -72,7 +71,7 @@ namespace Game.Entities
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Contract.Assert(_passengers.Empty());
|
||||
Cypher.Assert(_passengers.Empty());
|
||||
UnloadStaticPassengers();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ using Game.PvP;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -168,7 +167,7 @@ namespace Game.Entities
|
||||
|
||||
public void TauntApply(Unit taunter)
|
||||
{
|
||||
Contract.Assert(IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(IsTypeId(TypeId.Unit));
|
||||
|
||||
if (!taunter || (taunter.IsTypeId(TypeId.Player) && taunter.ToPlayer().IsGameMaster()))
|
||||
return;
|
||||
@@ -192,7 +191,7 @@ namespace Game.Entities
|
||||
|
||||
public void TauntFadeOut(Unit taunter)
|
||||
{
|
||||
Contract.Assert(IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(IsTypeId(TypeId.Unit));
|
||||
|
||||
if (!taunter || (taunter.IsTypeId(TypeId.Player) && taunter.ToPlayer().IsGameMaster()))
|
||||
return;
|
||||
@@ -1091,7 +1090,7 @@ namespace Game.Entities
|
||||
{
|
||||
Player he = duel_wasMounted ? victim.GetCharmer().ToPlayer() : victim.ToPlayer();
|
||||
|
||||
Contract.Assert(he && he.duel != null);
|
||||
Cypher.Assert(he && he.duel != null);
|
||||
|
||||
if (duel_wasMounted) // In this case victim==mount
|
||||
victim.SetHealth(1);
|
||||
@@ -2882,7 +2881,7 @@ namespace Game.Entities
|
||||
// function based on function Unit.CanAttack from 13850 client
|
||||
public bool _IsValidAttackTarget(Unit target, SpellInfo bySpell, WorldObject obj = null)
|
||||
{
|
||||
Contract.Assert(target != null);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
// can't attack self
|
||||
if (this == target)
|
||||
@@ -3019,7 +3018,7 @@ namespace Game.Entities
|
||||
// function based on function Unit.CanAssist from 13850 client
|
||||
public bool _IsValidAssistTarget(Unit target, SpellInfo bySpell)
|
||||
{
|
||||
Contract.Assert(target != null);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
// can assist to self
|
||||
if (this == target)
|
||||
|
||||
@@ -20,7 +20,6 @@ using Game.AI;
|
||||
using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -163,7 +162,8 @@ namespace Game.Entities
|
||||
|
||||
minion.SetOwnerGUID(GetGUID());
|
||||
|
||||
m_Controlled.Add(minion);
|
||||
if (!m_Controlled.Contains(minion))
|
||||
m_Controlled.Add(minion);
|
||||
|
||||
if (IsTypeId(TypeId.Player))
|
||||
{
|
||||
@@ -269,12 +269,12 @@ namespace Game.Entities
|
||||
if (GetGUID() == unit.GetCharmerGUID())
|
||||
continue;
|
||||
|
||||
Contract.Assert(unit.GetOwnerGUID() == GetGUID());
|
||||
Cypher.Assert(unit.GetOwnerGUID() == GetGUID());
|
||||
if (unit.GetOwnerGUID() != GetGUID())
|
||||
{
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
Contract.Assert(unit.IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(unit.IsTypeId(TypeId.Unit));
|
||||
|
||||
if (!unit.HasUnitTypeMask(UnitTypeMask.Guardian))
|
||||
continue;
|
||||
@@ -308,8 +308,8 @@ namespace Game.Entities
|
||||
if (charmer.IsTypeId(TypeId.Player))
|
||||
charmer.RemoveAurasByType(AuraType.Mounted);
|
||||
|
||||
Contract.Assert(type != CharmType.Possess || charmer.IsTypeId(TypeId.Player));
|
||||
Contract.Assert((type == CharmType.Vehicle) == IsVehicle());
|
||||
Cypher.Assert(type != CharmType.Possess || charmer.IsTypeId(TypeId.Player));
|
||||
Cypher.Assert((type == CharmType.Vehicle) == IsVehicle());
|
||||
|
||||
Log.outDebug(LogFilter.Unit, "SetCharmedBy: charmer {0} (GUID {1}), charmed {2} (GUID {3}), type {4}.", charmer.GetEntry(), charmer.GetGUID().ToString(), GetEntry(), GetGUID().ToString(), type);
|
||||
|
||||
@@ -505,8 +505,8 @@ namespace Game.Entities
|
||||
if (!charmer)
|
||||
return;
|
||||
|
||||
Contract.Assert(type != CharmType.Possess || charmer.IsTypeId(TypeId.Player));
|
||||
Contract.Assert(type != CharmType.Vehicle || (IsTypeId(TypeId.Unit) && IsVehicle()));
|
||||
Cypher.Assert(type != CharmType.Possess || charmer.IsTypeId(TypeId.Player));
|
||||
Cypher.Assert(type != CharmType.Vehicle || (IsTypeId(TypeId.Unit) && IsVehicle()));
|
||||
|
||||
charmer.SetCharm(this, false);
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveAllMinionsByEntry(uint entry)
|
||||
public void RemoveAllMinionsByEntry(uint entry)
|
||||
{
|
||||
for (var i = 0; i < m_Controlled.Count; ++i)
|
||||
{
|
||||
@@ -612,7 +612,8 @@ namespace Game.Entities
|
||||
if (_isWalkingBeforeCharm)
|
||||
charm.SetWalk(false);
|
||||
|
||||
m_Controlled.Add(charm);
|
||||
if (!m_Controlled.Contains(charm))
|
||||
m_Controlled.Add(charm);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -1787,7 +1786,7 @@ namespace Game.Entities
|
||||
{
|
||||
foreach (AuraApplication aurApp in procAuras)
|
||||
{
|
||||
Contract.Assert(aurApp.GetTarget() == this);
|
||||
Cypher.Assert(aurApp.GetTarget() == this);
|
||||
uint procEffectMask = aurApp.GetBase().IsProcTriggeredOnEvent(aurApp, eventInfo, now);
|
||||
if (procEffectMask != 0)
|
||||
{
|
||||
@@ -1890,7 +1889,7 @@ namespace Game.Entities
|
||||
++m_procDeep;
|
||||
else
|
||||
{
|
||||
Contract.Assert(m_procDeep != 0);
|
||||
Cypher.Assert(m_procDeep != 0);
|
||||
--m_procDeep;
|
||||
}
|
||||
}
|
||||
@@ -1989,7 +1988,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void SetCurrentCastSpell(Spell pSpell)
|
||||
{
|
||||
Contract.Assert(pSpell != null); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
|
||||
Cypher.Assert(pSpell != null); // NULL may be never passed here, use InterruptSpell or InterruptNonMeleeSpells
|
||||
|
||||
CurrentSpellTypes CSpellType = pSpell.GetCurrentContainer();
|
||||
|
||||
@@ -2789,7 +2788,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed = true, bool withInstant = true)
|
||||
{
|
||||
Contract.Assert(spellType < CurrentSpellTypes.Max);
|
||||
Cypher.Assert(spellType < CurrentSpellTypes.Max);
|
||||
|
||||
Log.outDebug(LogFilter.Unit, "Interrupt spell for unit {0}", GetEntry());
|
||||
Spell spell = m_currentSpells.LookupByKey(spellType);
|
||||
@@ -3375,7 +3374,7 @@ namespace Game.Entities
|
||||
{
|
||||
Aura aura = keyValuePair.Value;
|
||||
|
||||
Contract.Assert(!aura.IsRemoved());
|
||||
Cypher.Assert(!aura.IsRemoved());
|
||||
|
||||
m_ownedAuras.Remove(keyValuePair);
|
||||
m_removedAuras.Add(aura);
|
||||
@@ -3402,7 +3401,7 @@ namespace Game.Entities
|
||||
if (auraToRemove.IsRemoved())
|
||||
return;
|
||||
|
||||
Contract.Assert(auraToRemove.GetOwner() == this);
|
||||
Cypher.Assert(auraToRemove.GetOwner() == this);
|
||||
|
||||
if (removeMode == AuraRemoveMode.None)
|
||||
{
|
||||
@@ -3423,7 +3422,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
public void RemoveAurasDueToSpell(uint spellId, ObjectGuid casterGUID = default(ObjectGuid), uint reqEffMask = 0, AuraRemoveMode removeMode = AuraRemoveMode.Default)
|
||||
@@ -3612,7 +3611,7 @@ namespace Game.Entities
|
||||
{
|
||||
Aura aura = m_modAuras[auraType][i].GetBase();
|
||||
AuraApplication aurApp = aura.GetApplicationOfTarget(GetGUID());
|
||||
Contract.Assert(aurApp != null);
|
||||
Cypher.Assert(aurApp != null);
|
||||
|
||||
if (check(aurApp))
|
||||
{
|
||||
@@ -3833,16 +3832,16 @@ namespace Game.Entities
|
||||
public void _UnapplyAura(KeyValuePair<uint, AuraApplication> pair, AuraRemoveMode removeMode)
|
||||
{
|
||||
AuraApplication aurApp = pair.Value;
|
||||
Contract.Assert(aurApp != null);
|
||||
Contract.Assert(!aurApp.HasRemoveMode());
|
||||
Contract.Assert(aurApp.GetTarget() == this);
|
||||
Cypher.Assert(aurApp != null);
|
||||
Cypher.Assert(!aurApp.HasRemoveMode());
|
||||
Cypher.Assert(aurApp.GetTarget() == this);
|
||||
|
||||
aurApp.SetRemoveMode(removeMode);
|
||||
Aura aura = aurApp.GetBase();
|
||||
Log.outDebug(LogFilter.Spells, "Aura {0} now is remove mode {1}", aura.GetId(), removeMode);
|
||||
|
||||
// dead loop is killing the server probably
|
||||
Contract.Assert(m_removedAurasCount < 0xFFFFFFFF);
|
||||
Cypher.Assert(m_removedAurasCount < 0xFFFFFFFF);
|
||||
|
||||
++m_removedAurasCount;
|
||||
|
||||
@@ -3889,7 +3888,7 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
// all effect mustn't be applied
|
||||
Contract.Assert(aurApp.GetEffectMask() == 0);
|
||||
Cypher.Assert(aurApp.GetEffectMask() == 0);
|
||||
|
||||
// Remove totem at next update if totem loses its aura
|
||||
if (aurApp.GetRemoveMode() == AuraRemoveMode.Expire && IsTypeId(TypeId.Unit) && IsTotem())
|
||||
@@ -3908,7 +3907,7 @@ namespace Game.Entities
|
||||
public void _UnapplyAura(AuraApplication aurApp, AuraRemoveMode removeMode)
|
||||
{
|
||||
// aura can be removed from unit only if it's applied on it, shouldn't happen
|
||||
Contract.Assert(aurApp.GetBase().GetApplicationOfTarget(GetGUID()) == aurApp);
|
||||
Cypher.Assert(aurApp.GetBase().GetApplicationOfTarget(GetGUID()) == aurApp);
|
||||
|
||||
uint spellId = aurApp.GetBase().GetId();
|
||||
var range = m_appliedAuras.LookupByKey(spellId);
|
||||
@@ -3921,7 +3920,7 @@ namespace Game.Entities
|
||||
return;
|
||||
}
|
||||
}
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
public AuraEffect GetAuraEffect(uint spellId, uint effIndex, ObjectGuid casterGUID = default(ObjectGuid))
|
||||
@@ -4009,10 +4008,10 @@ namespace Game.Entities
|
||||
|
||||
public void _ApplyAuraEffect(Aura aura, uint effIndex)
|
||||
{
|
||||
Contract.Assert(aura != null);
|
||||
Contract.Assert(aura.HasEffect(effIndex));
|
||||
Cypher.Assert(aura != null);
|
||||
Cypher.Assert(aura.HasEffect(effIndex));
|
||||
AuraApplication aurApp = aura.GetApplicationOfTarget(GetGUID());
|
||||
Contract.Assert(aurApp != null);
|
||||
Cypher.Assert(aurApp != null);
|
||||
if (aurApp.GetEffectMask() == 0)
|
||||
_ApplyAura(aurApp, (uint)(1 << (int)effIndex));
|
||||
else
|
||||
@@ -4058,7 +4057,7 @@ namespace Game.Entities
|
||||
}
|
||||
public void _AddAura(UnitAura aura, Unit caster)
|
||||
{
|
||||
Contract.Assert(!m_cleanupDone);
|
||||
Cypher.Assert(!m_cleanupDone);
|
||||
m_ownedAuras.Add(aura.GetId(), aura);
|
||||
|
||||
_RemoveNoStackAurasDueToAura(aura);
|
||||
@@ -4073,7 +4072,7 @@ namespace Game.Entities
|
||||
// @HACK: Player is not in world during loading auras.
|
||||
//Single target auras are not saved or loaded from database
|
||||
//but may be created as a result of aura links (player mounts with passengers)
|
||||
Contract.Assert((IsInWorld && !IsDuringRemoveFromWorld()) || (aura.GetCasterGUID() == GetGUID()) || (IsLoading() && aura.HasEffectType(AuraType.ControlVehicle)));
|
||||
Cypher.Assert((IsInWorld && !IsDuringRemoveFromWorld()) || (aura.GetCasterGUID() == GetGUID()) || (IsLoading() && aura.HasEffectType(AuraType.ControlVehicle)));
|
||||
|
||||
// register single target aura
|
||||
caster.m_scAuras.Add(aura);
|
||||
@@ -4090,7 +4089,7 @@ namespace Game.Entities
|
||||
}
|
||||
public Aura _TryStackingOrRefreshingExistingAura(SpellInfo newAura, uint effMask, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
|
||||
{
|
||||
Contract.Assert(!casterGUID.IsEmpty() || caster);
|
||||
Cypher.Assert(!casterGUID.IsEmpty() || caster);
|
||||
|
||||
// Check if these can stack anyway
|
||||
if (casterGUID.IsEmpty() && !newAura.IsStackableOnOneSlotWithDifferentCasters())
|
||||
|
||||
@@ -30,7 +30,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -139,7 +138,7 @@ namespace Game.Entities
|
||||
|
||||
// If this is set during update SetCantProc(false) call is missing somewhere in the code
|
||||
// Having this would prevent spells from being proced, so let's crash
|
||||
Contract.Assert(m_procDeep == 0);
|
||||
Cypher.Assert(m_procDeep == 0);
|
||||
|
||||
if (CanHaveThreatList() && GetThreatManager().isNeedUpdateToClient(diff))
|
||||
SendThreatListUpdate();
|
||||
@@ -811,7 +810,7 @@ namespace Game.Entities
|
||||
public void _EnterVehicle(Vehicle vehicle, sbyte seatId, AuraApplication aurApp)
|
||||
{
|
||||
// Must be called only from aura handler
|
||||
Contract.Assert(aurApp != null);
|
||||
Cypher.Assert(aurApp != null);
|
||||
|
||||
if (!IsAlive() || GetVehicleKit() == vehicle || vehicle.GetBase().IsOnVehicle(this))
|
||||
return;
|
||||
@@ -840,7 +839,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
Contract.Assert(!m_vehicle);
|
||||
Cypher.Assert(!m_vehicle);
|
||||
vehicle.AddPassenger(this, seatId);
|
||||
}
|
||||
|
||||
@@ -866,12 +865,12 @@ namespace Game.Entities
|
||||
continue;
|
||||
|
||||
// Make sure there is only one ride vehicle aura on target cast by the unit changing seat
|
||||
Contract.Assert(rideVehicleEffect == null);
|
||||
Cypher.Assert(rideVehicleEffect == null);
|
||||
rideVehicleEffect = eff;
|
||||
}
|
||||
|
||||
// Unit riding a vehicle must always have control vehicle aura on target
|
||||
Contract.Assert(rideVehicleEffect != null);
|
||||
Cypher.Assert(rideVehicleEffect != null);
|
||||
|
||||
rideVehicleEffect.ChangeAmount((seatId < 0 ? GetTransSeat() : seatId) + 1);
|
||||
}
|
||||
@@ -1764,12 +1763,12 @@ namespace Game.Entities
|
||||
public AuraApplication _CreateAuraApplication(Aura aura, uint effMask)
|
||||
{
|
||||
// can't apply aura on unit which is going to be deleted - to not create a memory leak
|
||||
Contract.Assert(!m_cleanupDone);
|
||||
Cypher.Assert(!m_cleanupDone);
|
||||
// aura musn't be removed
|
||||
Contract.Assert(!aura.IsRemoved());
|
||||
Cypher.Assert(!aura.IsRemoved());
|
||||
|
||||
// aura mustn't be already applied on target
|
||||
Contract.Assert(!aura.IsAppliedOnTarget(GetGUID()), "Unit._CreateAuraApplication: aura musn't be applied on target");
|
||||
Cypher.Assert(!aura.IsAppliedOnTarget(GetGUID()), "Unit._CreateAuraApplication: aura musn't be applied on target");
|
||||
|
||||
SpellInfo aurSpellInfo = aura.GetSpellInfo();
|
||||
uint aurId = aurSpellInfo.Id;
|
||||
|
||||
@@ -22,7 +22,6 @@ using Game.DataStorage;
|
||||
using Game.Movement;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -64,9 +63,9 @@ namespace Game.Entities
|
||||
public void Dispose()
|
||||
{
|
||||
// @Uninstall must be called before this.
|
||||
Contract.Assert(_status == Status.UnInstalling);
|
||||
Cypher.Assert(_status == Status.UnInstalling);
|
||||
foreach (var pair in Seats)
|
||||
Contract.Assert(pair.Value.IsEmpty());
|
||||
Cypher.Assert(pair.Value.IsEmpty());
|
||||
}
|
||||
|
||||
public void Install()
|
||||
@@ -254,7 +253,7 @@ namespace Game.Entities
|
||||
Log.outDebug(LogFilter.Vehicle, "Vehicle ({0}, Entry {1}): installing accessory (Entry: {2}) on seat: {3}", _me.GetGUID().ToString(), GetCreatureEntry(), entry, seatId);
|
||||
|
||||
TempSummon accessory = _me.SummonCreature(entry, _me, (TempSummonType)type, summonTime);
|
||||
Contract.Assert(accessory);
|
||||
Cypher.Assert(accessory);
|
||||
|
||||
if (minion)
|
||||
accessory.AddUnitTypeMask(UnitTypeMask.Accessory);
|
||||
@@ -319,11 +318,11 @@ namespace Game.Entities
|
||||
if (!seat.Value.IsEmpty())
|
||||
{
|
||||
Unit passenger = Global.ObjAccessor.GetUnit(GetBase(), seat.Value.Passenger.Guid);
|
||||
Contract.Assert(passenger != null);
|
||||
Cypher.Assert(passenger != null);
|
||||
passenger.ExitVehicle();
|
||||
}
|
||||
|
||||
Contract.Assert(seat.Value.IsEmpty());
|
||||
Cypher.Assert(seat.Value.IsEmpty());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -335,7 +334,7 @@ namespace Game.Entities
|
||||
return null;
|
||||
|
||||
var seat = GetSeatKeyValuePairForPassenger(unit);
|
||||
Contract.Assert(seat.Value != null);
|
||||
Cypher.Assert(seat.Value != null);
|
||||
|
||||
Log.outDebug( LogFilter.Vehicle, "Unit {0} exit vehicle entry {1} id {2} dbguid {3} seat {4}",
|
||||
unit.GetName(), _me.GetEntry(), _vehicleInfo.Id, _me.GetGUID().ToString(), seat.Key);
|
||||
@@ -371,7 +370,7 @@ namespace Game.Entities
|
||||
|
||||
public void RelocatePassengers()
|
||||
{
|
||||
Contract.Assert(_me.GetMap() != null);
|
||||
Cypher.Assert(_me.GetMap() != null);
|
||||
|
||||
List<Tuple<Unit, Position>> seatRelocation = new List<Tuple<Unit, Position>>();
|
||||
|
||||
@@ -381,7 +380,7 @@ namespace Game.Entities
|
||||
Unit passenger = Global.ObjAccessor.GetUnit(GetBase(), pair.Value.Passenger.Guid);
|
||||
if (passenger != null)
|
||||
{
|
||||
Contract.Assert(passenger.IsInWorld);
|
||||
Cypher.Assert(passenger.IsInWorld);
|
||||
|
||||
float px, py, pz, po;
|
||||
passenger.m_movementInfo.transport.pos.GetPosition(out px, out py, out pz, out po);
|
||||
@@ -543,9 +542,9 @@ namespace Game.Entities
|
||||
|
||||
public override bool Execute(ulong e_time, uint p_time)
|
||||
{
|
||||
Contract.Assert(Passenger.IsInWorld);
|
||||
Contract.Assert(Target != null && Target.GetBase().IsInWorld);
|
||||
Contract.Assert(Target.GetBase().HasAuraTypeWithCaster(AuraType.ControlVehicle, Passenger.GetGUID()));
|
||||
Cypher.Assert(Passenger.IsInWorld);
|
||||
Cypher.Assert(Target != null && Target.GetBase().IsInWorld);
|
||||
Cypher.Assert(Target.GetBase().HasAuraTypeWithCaster(AuraType.ControlVehicle, Passenger.GetGUID()));
|
||||
|
||||
Target.RemovePendingEventsForSeat(Seat.Key);
|
||||
Target.RemovePendingEventsForPassenger(Passenger);
|
||||
@@ -555,7 +554,7 @@ namespace Game.Entities
|
||||
Seat.Value.Passenger.IsUnselectable = Passenger.HasFlag(UnitFields.Flags, UnitFlags.NotSelectable);
|
||||
if (Seat.Value.SeatInfo.CanEnterOrExit())
|
||||
{
|
||||
Contract.Assert(Target.UsableSeatNum != 0);
|
||||
Cypher.Assert(Target.UsableSeatNum != 0);
|
||||
--Target.UsableSeatNum;
|
||||
if (Target.UsableSeatNum == 0)
|
||||
{
|
||||
@@ -596,7 +595,7 @@ namespace Game.Entities
|
||||
|
||||
if (Target.GetBase().IsTypeId(TypeId.Unit) && Passenger.IsTypeId(TypeId.Player) &&
|
||||
Seat.Value.SeatInfo.Flags.HasAnyFlag(VehicleSeatFlags.CanControl))
|
||||
Contract.Assert(Target.GetBase().SetCharmedBy(Passenger, CharmType.Vehicle)); // SMSG_CLIENT_CONTROL
|
||||
Cypher.Assert(Target.GetBase().SetCharmedBy(Passenger, CharmType.Vehicle)); // SMSG_CLIENT_CONTROL
|
||||
|
||||
Passenger.SendClearTarget(); // SMSG_BREAK_TARGET
|
||||
Passenger.SetControlled(true, UnitState.Root); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
|
||||
|
||||
Reference in New Issue
Block a user