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:
@@ -20,6 +20,7 @@ using Framework.Configuration;
|
||||
using Framework.Database;
|
||||
using Framework.Networking;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Timers;
|
||||
|
||||
@@ -41,7 +42,7 @@ namespace BNetServer
|
||||
Environment.Exit(-1);
|
||||
};
|
||||
|
||||
if (!ConfigMgr.Load(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf"))
|
||||
if (!ConfigMgr.Load(Process.GetCurrentProcess().ProcessName + ".conf"))
|
||||
ExitNow();
|
||||
|
||||
// Initialize the database connection
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace System.Collections
|
||||
{
|
||||
@@ -27,7 +26,6 @@ namespace System.Collections
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length");
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
_mArray = new uint[GetArrayLength(length, BitsPerInt32)];
|
||||
_mLength = length;
|
||||
@@ -47,7 +45,7 @@ namespace System.Collections
|
||||
{
|
||||
throw new ArgumentNullException("values");
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
// this value is chosen to prevent overflow when computing m_length
|
||||
if (values.Length > UInt32.MaxValue / BitsPerInt32)
|
||||
{
|
||||
@@ -68,7 +66,6 @@ namespace System.Collections
|
||||
{
|
||||
throw new ArgumentNullException("bits");
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
int arrayLength = GetArrayLength(bits._mLength, BitsPerInt32);
|
||||
_mArray = new uint[arrayLength];
|
||||
@@ -97,7 +94,6 @@ namespace System.Collections
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
return (Convert.ToInt64(_mArray[index / 32]) & (1 << (index % 32))) != 0;
|
||||
}
|
||||
@@ -108,7 +104,6 @@ namespace System.Collections
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
if (value)
|
||||
{
|
||||
@@ -140,7 +135,6 @@ namespace System.Collections
|
||||
throw new ArgumentNullException("value");
|
||||
if (Length != value.Length)
|
||||
throw new ArgumentException();
|
||||
Contract.EndContractBlock();
|
||||
|
||||
int ints = GetArrayLength(_mLength, BitsPerInt32);
|
||||
for (int i = 0; i < ints; i++)
|
||||
@@ -158,7 +152,6 @@ namespace System.Collections
|
||||
throw new ArgumentNullException("value");
|
||||
if (Length != value.Length)
|
||||
throw new ArgumentException();
|
||||
Contract.EndContractBlock();
|
||||
|
||||
int ints = GetArrayLength(_mLength, BitsPerInt32);
|
||||
for (int i = 0; i < ints; i++)
|
||||
@@ -176,7 +169,6 @@ namespace System.Collections
|
||||
throw new ArgumentNullException("value");
|
||||
if (Length != value.Length)
|
||||
throw new ArgumentException();
|
||||
Contract.EndContractBlock();
|
||||
|
||||
int ints = GetArrayLength(_mLength, BitsPerInt32);
|
||||
for (int i = 0; i < ints; i++)
|
||||
@@ -204,7 +196,6 @@ namespace System.Collections
|
||||
{
|
||||
get
|
||||
{
|
||||
Contract.Ensures(Contract.Result<int>() >= 0);
|
||||
return _mLength;
|
||||
}
|
||||
set
|
||||
@@ -213,7 +204,6 @@ namespace System.Collections
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value");
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
int newints = GetArrayLength(value, BitsPerInt32);
|
||||
if (newints > _mArray.Length || newints + ShrinkThreshold < _mArray.Length)
|
||||
@@ -255,8 +245,6 @@ namespace System.Collections
|
||||
if (array.Rank != 1)
|
||||
throw new ArgumentException();
|
||||
|
||||
Contract.EndContractBlock();
|
||||
|
||||
if (array is uint[])
|
||||
{
|
||||
Array.Copy(_mArray, 0, array, index, GetArrayLength(_mLength, BitsPerInt32));
|
||||
@@ -288,17 +276,12 @@ namespace System.Collections
|
||||
{
|
||||
get
|
||||
{
|
||||
Contract.Ensures(Contract.Result<int>() >= 0);
|
||||
|
||||
return _mLength;
|
||||
}
|
||||
}
|
||||
|
||||
public Object Clone()
|
||||
{
|
||||
Contract.Ensures(Contract.Result<Object>() != null);
|
||||
Contract.Ensures(((BitArray)Contract.Result<Object>()).Length == this.Length);
|
||||
|
||||
BitSet bitArray = new BitSet(_mArray);
|
||||
bitArray._version = _version;
|
||||
bitArray._mLength = _mLength;
|
||||
@@ -345,7 +328,7 @@ namespace System.Collections
|
||||
|
||||
private static int GetArrayLength(int n, int div)
|
||||
{
|
||||
Contract.Assert(div > 0, "GetArrayLength: div arg must be greater than 0");
|
||||
Cypher.Assert(div > 0, "GetArrayLength: div arg must be greater than 0");
|
||||
return n > 0 ? (((n - 1) / div) + 1) : 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Framework.Database
|
||||
@@ -68,7 +67,7 @@ namespace Framework.Database
|
||||
bool hasNext = _result != null;
|
||||
if (_callbacks.Count == 0)
|
||||
{
|
||||
Contract.Assert(!hasNext);
|
||||
Cypher.Assert(!hasNext);
|
||||
return QueryCallbackStatus.Completed;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2012-2018 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
public class Cypher
|
||||
{
|
||||
public static void Assert(bool value, string message = "", [CallerMemberName]string memberName = "")
|
||||
{
|
||||
if (!value)
|
||||
{
|
||||
if (!message.IsEmpty())
|
||||
Log.outFatal(LogFilter.Server, message);
|
||||
|
||||
throw new Exception(memberName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,21 @@
|
||||
using System;
|
||||
/*
|
||||
* Copyright (C) 2012-2018 CypherCore <http://github.com/CypherCore>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Framework.Dynamic
|
||||
@@ -112,13 +111,13 @@ namespace Framework.Dynamic
|
||||
|
||||
public void ScheduleAbort()
|
||||
{
|
||||
Contract.Assert(IsRunning(), "Tried to scheduled the abortion of an event twice!");
|
||||
Cypher.Assert(IsRunning(), "Tried to scheduled the abortion of an event twice!");
|
||||
m_abortState = AbortState.Scheduled;
|
||||
}
|
||||
|
||||
public void SetAborted()
|
||||
{
|
||||
Contract.Assert(!IsAborted(), "Tried to abort an already aborted event!");
|
||||
Cypher.Assert(!IsAborted(), "Tried to abort an already aborted event!");
|
||||
m_abortState = AbortState.Aborted;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using Framework.Collections;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Framework.Dynamic
|
||||
{
|
||||
@@ -42,7 +41,7 @@ namespace Framework.Dynamic
|
||||
// Create new link
|
||||
public void link(TO toObj, FROM fromObj)
|
||||
{
|
||||
Contract.Assert(fromObj != null); // fromObj MUST not be NULL
|
||||
Cypher.Assert(fromObj != null); // fromObj MUST not be NULL
|
||||
if (isValid())
|
||||
unlink();
|
||||
if (toObj != null)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Framework.Dynamic
|
||||
@@ -622,7 +621,7 @@ namespace Framework.Dynamic
|
||||
{
|
||||
// This was adapted to TC to prevent static analysis tools from complaining.
|
||||
// If you encounter this assertion check if you repeat a TaskContext more then 1 time!
|
||||
Contract.Assert(!_consumed, "Bad task logic, task context was consumed already!");
|
||||
Cypher.Assert(!_consumed, "Bad task logic, task context was consumed already!");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Framework.IO
|
||||
@@ -47,7 +46,6 @@ namespace Framework.IO
|
||||
if (!MoveNext(delimiters))
|
||||
return "";
|
||||
|
||||
Contract.Assume(Current != null);
|
||||
return Current;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Net.Sockets;
|
||||
|
||||
namespace Framework.Networking
|
||||
@@ -25,7 +24,7 @@ namespace Framework.Networking
|
||||
{
|
||||
public virtual bool StartNetwork(string bindIp, int port, int threadCount = 1)
|
||||
{
|
||||
Contract.Assert(threadCount > 0);
|
||||
Cypher.Assert(threadCount > 0);
|
||||
|
||||
Acceptor = new AsyncAcceptor();
|
||||
if (!Acceptor.Start(bindIp, port))
|
||||
|
||||
@@ -207,7 +207,7 @@ public static class MathFunctions
|
||||
return val1 <= val2;
|
||||
default:
|
||||
// incorrect parameter
|
||||
//Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public static class MathFunctions
|
||||
return val1 <= val2;
|
||||
default:
|
||||
// incorrect parameter
|
||||
//Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
public class RandomHelper
|
||||
{
|
||||
@@ -70,7 +69,7 @@ public class RandomHelper
|
||||
}
|
||||
public static float FRand(float min, float max)
|
||||
{
|
||||
Contract.Assert(max >= min);
|
||||
Cypher.Assert(max >= min);
|
||||
return (float)(rand.NextDouble() * (max - min) + min);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ using Game.Entities;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.AI
|
||||
@@ -472,7 +471,7 @@ namespace Game.AI
|
||||
_caster = caster;
|
||||
_spellInfo = Global.SpellMgr.GetSpellInfo(spellId);
|
||||
|
||||
Contract.Assert(_spellInfo != null);
|
||||
Cypher.Assert(_spellInfo != null);
|
||||
}
|
||||
|
||||
public bool Check(Unit target)
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Database;
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
@@ -46,7 +45,7 @@ namespace Game
|
||||
DB.Login.DirectExecute(stmt);
|
||||
|
||||
uint newAccountId = GetId(email);
|
||||
Contract.Assert(newAccountId != 0);
|
||||
Cypher.Assert(newAccountId != 0);
|
||||
|
||||
if (withGameAccount)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@ using Game.Network;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -586,7 +585,7 @@ namespace Game.Achievements
|
||||
uint timeElapsed = 0;
|
||||
if (criteria.Entry.StartTimer != 0)
|
||||
{
|
||||
Contract.Assert(trees != null);
|
||||
Cypher.Assert(trees != null);
|
||||
|
||||
foreach (CriteriaTree tree in trees)
|
||||
{
|
||||
@@ -1554,7 +1553,7 @@ namespace Game.Achievements
|
||||
uint questObjectiveCriterias = 0;
|
||||
foreach (CriteriaRecord criteriaEntry in CliDB.CriteriaStorage.Values)
|
||||
{
|
||||
Contract.Assert(criteriaEntry.Type < CriteriaTypes.TotalTypes,
|
||||
Cypher.Assert(criteriaEntry.Type < CriteriaTypes.TotalTypes,
|
||||
$"CRITERIA_TYPE_TOTAL must be greater than or equal to {criteriaEntry.Type + 1} but is currently equal to {CriteriaTypes.TotalTypes}");
|
||||
|
||||
var treeList = _criteriaTreeByCriteria.LookupByKey(criteriaEntry.Id);
|
||||
|
||||
@@ -24,7 +24,6 @@ using Game.Mails;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
@@ -327,8 +326,8 @@ namespace Game
|
||||
|
||||
public void AddAItem(Item it)
|
||||
{
|
||||
Contract.Assert(it);
|
||||
Contract.Assert(!mAitems.ContainsKey(it.GetGUID().GetCounter()));
|
||||
Cypher.Assert(it);
|
||||
Cypher.Assert(!mAitems.ContainsKey(it.GetGUID().GetCounter()));
|
||||
mAitems[it.GetGUID().GetCounter()] = it;
|
||||
}
|
||||
|
||||
@@ -419,7 +418,7 @@ namespace Game
|
||||
{
|
||||
public void AddAuction(AuctionEntry auction)
|
||||
{
|
||||
Contract.Assert(auction != null);
|
||||
Cypher.Assert(auction != null);
|
||||
|
||||
AuctionsMap[auction.Id] = auction;
|
||||
Global.ScriptMgr.OnAuctionAdd(this, auction);
|
||||
|
||||
@@ -25,7 +25,6 @@ using Game.Network;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.BattleFields
|
||||
@@ -1078,7 +1077,7 @@ namespace Game.BattleFields
|
||||
|
||||
public bool SetCapturePointData(GameObject capturePoint)
|
||||
{
|
||||
Contract.Assert(capturePoint);
|
||||
Cypher.Assert(capturePoint);
|
||||
|
||||
Log.outError(LogFilter.Battlefield, "Creating capture point {0}", capturePoint.GetEntry());
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ using Game.Entities;
|
||||
using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.BattleFields
|
||||
{
|
||||
@@ -1591,7 +1590,7 @@ namespace Game.BattleFields
|
||||
|
||||
public override void ChangeTeam(uint oldteam)
|
||||
{
|
||||
Contract.Assert(m_Workshop != null);
|
||||
Cypher.Assert(m_Workshop != null);
|
||||
m_Workshop.GiveControlTo(m_team, false);
|
||||
}
|
||||
uint GetTeam() { return m_team; }
|
||||
|
||||
@@ -29,7 +29,6 @@ using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.BattleGrounds
|
||||
@@ -520,13 +519,13 @@ namespace Game.BattleGrounds
|
||||
|
||||
public BattlegroundMap GetBgMap()
|
||||
{
|
||||
Contract.Assert(m_Map);
|
||||
Cypher.Assert(m_Map);
|
||||
return m_Map;
|
||||
}
|
||||
|
||||
public void SetTeamStartPosition(int teamIndex, Position pos)
|
||||
{
|
||||
Contract.Assert(teamIndex < TeamId.Neutral);
|
||||
Cypher.Assert(teamIndex < TeamId.Neutral);
|
||||
StartPosition[teamIndex] = pos;
|
||||
}
|
||||
|
||||
@@ -1892,7 +1891,7 @@ namespace Game.BattleGrounds
|
||||
|
||||
public Position GetTeamStartPosition(int teamIndex)
|
||||
{
|
||||
Contract.Assert(teamIndex < TeamId.Neutral);
|
||||
Cypher.Assert(teamIndex < TeamId.Neutral);
|
||||
return StartPosition[teamIndex];
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using System.Diagnostics.Contracts;
|
||||
using Game.Network.Packets;
|
||||
|
||||
namespace Game.BattleGrounds
|
||||
@@ -53,7 +52,7 @@ namespace Game.BattleGrounds
|
||||
HealingDone += value;
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Not implemented Battleground score type!");
|
||||
Cypher.Assert(false, "Not implemented Battleground score type!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ using Game.Entities;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.BattleGrounds.Zones
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@ using Game.Maps;
|
||||
using Game.SupportSystem;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Chat.Commands
|
||||
{
|
||||
@@ -419,7 +418,7 @@ namespace Game.Chat.Commands
|
||||
|
||||
// update to parent zone if exist (client map show only zones without parents)
|
||||
AreaTableRecord zoneEntry = areaEntry.ParentAreaID != 0 ? CliDB.AreaTableStorage.LookupByKey(areaEntry.ParentAreaID) : areaEntry;
|
||||
Contract.Assert(zoneEntry != null);
|
||||
Cypher.Assert(zoneEntry != null);
|
||||
|
||||
Map map = Global.MapMgr.CreateBaseMap(zoneEntry.ContinentID);
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
using Framework.GameMath;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
@@ -68,7 +67,7 @@ namespace Game.Collision
|
||||
bool result = false;
|
||||
float maxDist = (endPos - startPos).magnitude();
|
||||
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
||||
Contract.Assert(maxDist < float.MaxValue);
|
||||
Cypher.Assert(maxDist < float.MaxValue);
|
||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||
if (maxDist < 1e-10f)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Collision
|
||||
{
|
||||
@@ -221,7 +220,7 @@ namespace Game.Collision
|
||||
if (instanceTree.GetLocationInfo(pos, info))
|
||||
{
|
||||
floor = info.ground_Z;
|
||||
Contract.Assert(floor < float.MaxValue);
|
||||
Cypher.Assert(floor < float.MaxValue);
|
||||
type = info.hitModel.GetLiquidType(); // entry from LiquidType.dbc
|
||||
if (reqLiquidType != 0 && !Convert.ToBoolean(Global.DB2Mgr.GetLiquidFlags(type) & reqLiquidType))
|
||||
return false;
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.IO;
|
||||
|
||||
namespace Game.Collision
|
||||
@@ -328,7 +327,7 @@ namespace Game.Collision
|
||||
bool result = false;
|
||||
float maxDist = (pPos2 - pPos1).magnitude();
|
||||
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
||||
Contract.Assert(maxDist < float.MaxValue);
|
||||
Cypher.Assert(maxDist < float.MaxValue);
|
||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||
if (maxDist < 1e-10f)
|
||||
{
|
||||
@@ -375,7 +374,7 @@ namespace Game.Collision
|
||||
return false;
|
||||
|
||||
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
||||
Contract.Assert(maxDist < float.MaxValue);
|
||||
Cypher.Assert(maxDist < float.MaxValue);
|
||||
// prevent NaN values which can cause BIH intersection to enter infinite loop
|
||||
if (maxDist < 1e-10f)
|
||||
return true;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Game.Collision
|
||||
@@ -102,7 +101,7 @@ namespace Game.Collision
|
||||
|
||||
Node getGrid(int x, int y)
|
||||
{
|
||||
Contract.Assert(x < CELL_NUMBER && y < CELL_NUMBER);
|
||||
Cypher.Assert(x < CELL_NUMBER && y < CELL_NUMBER);
|
||||
if (nodes[x][y] == null)
|
||||
nodes[x][y] = new Node();
|
||||
return nodes[x][y];
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Combat
|
||||
@@ -313,7 +312,7 @@ namespace Game.Combat
|
||||
if (threatSpell != null && threatSpell.HasAttribute(SpellAttr1.NoThreat))
|
||||
return false;
|
||||
|
||||
Contract.Assert(hatingUnit.IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(hatingUnit.IsTypeId(TypeId.Unit));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -395,7 +394,7 @@ namespace Game.Combat
|
||||
currentRef = threatList[i];
|
||||
|
||||
Unit target = currentRef.getTarget();
|
||||
Contract.Assert(target); // if the ref has status online the target must be there !
|
||||
Cypher.Assert(target); // if the ref has status online the target must be there !
|
||||
|
||||
// some units are prefered in comparison to others
|
||||
if (!noPriorityTargetFound && (target.IsImmunedToDamage(attacker.GetMeleeDamageSchoolMask()) || target.HasNegativeAuraWithInterruptFlag(SpellAuraInterruptFlags.TakeDamage)))
|
||||
|
||||
@@ -21,7 +21,6 @@ using Game.Entities;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Text;
|
||||
|
||||
namespace Game.Conditions
|
||||
@@ -36,7 +35,7 @@ namespace Game.Conditions
|
||||
|
||||
public bool Meets(ConditionSourceInfo sourceInfo)
|
||||
{
|
||||
Contract.Assert(ConditionTarget < SharedConst.MaxConditionTargets);
|
||||
Cypher.Assert(ConditionTarget < SharedConst.MaxConditionTargets);
|
||||
WorldObject obj = sourceInfo.mConditionTargets[ConditionTarget];
|
||||
// object not present, return false
|
||||
if (obj == null)
|
||||
@@ -62,7 +61,7 @@ namespace Game.Conditions
|
||||
if (player != null)
|
||||
{
|
||||
// don't allow 0 items (it's checked during table load)
|
||||
Contract.Assert(ConditionValue2 != 0);
|
||||
Cypher.Assert(ConditionValue2 != 0);
|
||||
bool checkBank = ConditionValue3 != 0 ? true : false;
|
||||
condMeets = player.HasItemCount(ConditionValue1, ConditionValue2, checkBank);
|
||||
}
|
||||
@@ -486,7 +485,7 @@ namespace Game.Conditions
|
||||
mask |= GridMapTypeMask.Player;
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Condition.GetSearcherTypeMaskForCondition - missing condition handling!");
|
||||
Cypher.Assert(false, "Condition.GetSearcherTypeMaskForCondition - missing condition handling!");
|
||||
break;
|
||||
}
|
||||
return mask;
|
||||
|
||||
@@ -25,7 +25,6 @@ using Game.Loots;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game
|
||||
@@ -43,7 +42,7 @@ namespace Game
|
||||
foreach (var i in conditions)
|
||||
{
|
||||
// no point of having not loaded conditions in list
|
||||
Contract.Assert(i.isLoaded(), "ConditionMgr.GetSearcherTypeMaskForConditionList - not yet loaded condition found in list");
|
||||
Cypher.Assert(i.isLoaded(), "ConditionMgr.GetSearcherTypeMaskForConditionList - not yet loaded condition found in list");
|
||||
// group not filled yet, fill with widest mask possible
|
||||
if (!elseGroupSearcherTypeMasks.ContainsKey(i.ElseGroup))
|
||||
elseGroupSearcherTypeMasks[i.ElseGroup] = GridMapTypeMask.All;
|
||||
@@ -54,7 +53,7 @@ namespace Game
|
||||
if (i.ReferenceId != 0) // handle reference
|
||||
{
|
||||
var refe = ConditionReferenceStore.LookupByKey(i.ReferenceId);
|
||||
Contract.Assert(refe.Empty(), "ConditionMgr.GetSearcherTypeMaskForConditionList - incorrect reference");
|
||||
Cypher.Assert(refe.Empty(), "ConditionMgr.GetSearcherTypeMaskForConditionList - incorrect reference");
|
||||
elseGroupSearcherTypeMasks[i.ElseGroup] &= GetSearcherTypeMaskForConditionList(refe);
|
||||
}
|
||||
else // handle normal condition
|
||||
@@ -579,7 +578,7 @@ namespace Game
|
||||
{
|
||||
uint conditionEffMask = cond.SourceGroup;
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo((uint)cond.SourceEntry);
|
||||
Contract.Assert(spellInfo != null);
|
||||
Cypher.Assert(spellInfo != null);
|
||||
List<uint> sharedMasks = new List<uint>();
|
||||
for (byte i = 0; i < SpellConst.MaxEffects; ++i)
|
||||
{
|
||||
@@ -1644,7 +1643,7 @@ namespace Game
|
||||
|
||||
static bool PlayerConditionLogic(uint logic, bool[] results)
|
||||
{
|
||||
Contract.Assert(results.Length < 16, "Logic array size must be equal to or less than 16");
|
||||
Cypher.Assert(results.Length < 16, "Logic array size must be equal to or less than 16");
|
||||
|
||||
for (var i = 0; i < results.Length; ++i)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@ using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
@@ -288,7 +287,7 @@ namespace Game
|
||||
|
||||
public bool IsDisabledFor(DisableType type, uint entry, Unit unit, byte flags = 0)
|
||||
{
|
||||
Contract.Assert(type < DisableType.Max);
|
||||
Cypher.Assert(type < DisableType.Max);
|
||||
if (!m_DisableMap.ContainsKey(type) || m_DisableMap[type].Empty())
|
||||
return false;
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ using Framework.Database;
|
||||
using Framework.GameMath;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
@@ -73,8 +72,8 @@ namespace Game.DataStorage
|
||||
CharBaseSectionVariation[] sectionToBase = new CharBaseSectionVariation[(int)CharSectionType.Max];
|
||||
foreach (CharBaseSectionRecord charBaseSection in CliDB.CharBaseSectionStorage.Values)
|
||||
{
|
||||
Contract.Assert(charBaseSection.ResolutionVariationEnum < (byte)CharSectionType.Max, $"SECTION_TYPE_MAX ({(byte)CharSectionType.Max}) must be equal to or greater than {charBaseSection.ResolutionVariationEnum + 1}");
|
||||
Contract.Assert(charBaseSection.VariationEnum < CharBaseSectionVariation.Max, $"CharBaseSectionVariation.Max {(byte)CharBaseSectionVariation.Max} must be equal to or greater than {charBaseSection.VariationEnum + 1}");
|
||||
Cypher.Assert(charBaseSection.ResolutionVariationEnum < (byte)CharSectionType.Max, $"SECTION_TYPE_MAX ({(byte)CharSectionType.Max}) must be equal to or greater than {charBaseSection.ResolutionVariationEnum + 1}");
|
||||
Cypher.Assert(charBaseSection.VariationEnum < CharBaseSectionVariation.Max, $"CharBaseSectionVariation.Max {(byte)CharBaseSectionVariation.Max} must be equal to or greater than {charBaseSection.VariationEnum + 1}");
|
||||
|
||||
sectionToBase[charBaseSection.ResolutionVariationEnum] = charBaseSection.VariationEnum;
|
||||
}
|
||||
@@ -84,7 +83,7 @@ namespace Game.DataStorage
|
||||
MultiMap<Tuple<byte, byte, CharBaseSectionVariation>, Tuple<byte, byte>> addedSections = new MultiMap<Tuple<byte, byte, CharBaseSectionVariation>, Tuple<byte, byte>>();
|
||||
foreach (CharSectionsRecord charSection in CliDB.CharSectionsStorage.Values)
|
||||
{
|
||||
Contract.Assert(charSection.BaseSection < (byte)CharSectionType.Max, $"SECTION_TYPE_MAX ({(byte)CharSectionType.Max}) must be equal to or greater than {charSection.BaseSection + 1}");
|
||||
Cypher.Assert(charSection.BaseSection < (byte)CharSectionType.Max, $"SECTION_TYPE_MAX ({(byte)CharSectionType.Max}) must be equal to or greater than {charSection.BaseSection + 1}");
|
||||
|
||||
Tuple<byte, byte, CharBaseSectionVariation> sectionKey = Tuple.Create(charSection.RaceID, charSection.SexID, sectionToBase[charSection.BaseSection]);
|
||||
Tuple<byte, byte> sectionCombination = Tuple.Create(charSection.VariationIndex, charSection.ColorIndex);
|
||||
@@ -299,7 +298,7 @@ namespace Game.DataStorage
|
||||
|
||||
foreach (var namesProfanity in CliDB.NamesProfanityStorage.Values)
|
||||
{
|
||||
Contract.Assert(namesProfanity.Language < (int)LocaleConstant.Total || namesProfanity.Language == -1);
|
||||
Cypher.Assert(namesProfanity.Language < (int)LocaleConstant.Total || namesProfanity.Language == -1);
|
||||
if (namesProfanity.Language != -1)
|
||||
_nameValidators[namesProfanity.Language].Add(new Regex(namesProfanity.Name, RegexOptions.IgnoreCase | RegexOptions.Compiled));
|
||||
else
|
||||
@@ -321,7 +320,7 @@ namespace Game.DataStorage
|
||||
|
||||
foreach (var namesReserved in CliDB.NamesReservedLocaleStorage.Values)
|
||||
{
|
||||
Contract.Assert(!Convert.ToBoolean(namesReserved.LocaleMask & ~((1 << (int)LocaleConstant.Total) - 1)));
|
||||
Cypher.Assert(!Convert.ToBoolean(namesReserved.LocaleMask & ~((1 << (int)LocaleConstant.Total) - 1)));
|
||||
for (int i = 0; i < (int)LocaleConstant.Total; ++i)
|
||||
{
|
||||
if (i == (int)LocaleConstant.None)
|
||||
@@ -343,7 +342,7 @@ namespace Game.DataStorage
|
||||
|
||||
foreach (PowerTypeRecord powerType in CliDB.PowerTypeStorage.Values)
|
||||
{
|
||||
Contract.Assert(powerType.PowerTypeEnum < PowerType.Max);
|
||||
Cypher.Assert(powerType.PowerTypeEnum < PowerType.Max);
|
||||
|
||||
_powerTypes[powerType.PowerTypeEnum] = powerType;
|
||||
}
|
||||
@@ -1116,7 +1115,7 @@ namespace Game.DataStorage
|
||||
|
||||
public string GetNameGenEntry(uint race, uint gender)
|
||||
{
|
||||
Contract.Assert(gender < (int)Gender.None);
|
||||
Cypher.Assert(gender < (int)Gender.None);
|
||||
var listNameGen = _nameGenData.LookupByKey(race);
|
||||
if (listNameGen == null)
|
||||
return "";
|
||||
@@ -1443,7 +1442,6 @@ namespace Game.DataStorage
|
||||
{
|
||||
newPos = new Vector2();
|
||||
|
||||
//Contract.Assert(newMapId != 0 || newPos != );
|
||||
WorldMapTransformsRecord transformation = null;
|
||||
foreach (WorldMapTransformsRecord transform in CliDB.WorldMapTransformsStorage.Values)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,6 @@ using Game.Groups;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Game.Network.Packets;
|
||||
@@ -757,8 +756,8 @@ namespace Game.DungeonFinding
|
||||
if (it2.Value.lockStatus == LfgLockStatusType.RaidLocked && isContinue)
|
||||
{
|
||||
LFGDungeonData dungeon = GetLFGDungeon(dungeonId);
|
||||
Contract.Assert(dungeon != null);
|
||||
Contract.Assert(player);
|
||||
Cypher.Assert(dungeon != null);
|
||||
Cypher.Assert(player);
|
||||
InstanceBind playerBind = player.GetBoundInstance(dungeon.map, dungeon.difficulty);
|
||||
if (playerBind != null)
|
||||
{
|
||||
@@ -873,7 +872,7 @@ namespace Game.DungeonFinding
|
||||
|
||||
// Set the dungeon difficulty
|
||||
LFGDungeonData dungeon = GetLFGDungeon(proposal.dungeonId);
|
||||
Contract.Assert(dungeon != null);
|
||||
Cypher.Assert(dungeon != null);
|
||||
|
||||
Group grp = !proposal.group.IsEmpty() ? Global.GroupMgr.GetGroupByGUID(proposal.group) : null;
|
||||
foreach (var pguid in players)
|
||||
@@ -1431,7 +1430,7 @@ namespace Game.DungeonFinding
|
||||
|
||||
public bool IsVoteKickActive(ObjectGuid gguid)
|
||||
{
|
||||
Contract.Assert(gguid.IsParty());
|
||||
Cypher.Assert(gguid.IsParty());
|
||||
|
||||
bool active = GroupsStore[gguid].IsVoteKickActive();
|
||||
Log.outInfo(LogFilter.Lfg, "Group: {0}, Active: {1}", gguid.ToString(), active);
|
||||
@@ -1591,7 +1590,7 @@ namespace Game.DungeonFinding
|
||||
|
||||
void SetVoteKick(ObjectGuid gguid, bool active)
|
||||
{
|
||||
Contract.Assert(gguid.IsParty());
|
||||
Cypher.Assert(gguid.IsParty());
|
||||
|
||||
var data = GroupsStore[gguid];
|
||||
Log.outInfo(LogFilter.Lfg, "Group: {0}, New state: {1}, Previous: {2}", gguid.ToString(), active, data.IsVoteKickActive());
|
||||
|
||||
@@ -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,6 +162,7 @@ namespace Game.Entities
|
||||
|
||||
minion.SetOwnerGUID(GetGUID());
|
||||
|
||||
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,6 +612,7 @@ namespace Game.Entities
|
||||
if (_isWalkingBeforeCharm)
|
||||
charm.SetWalk(false);
|
||||
|
||||
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)
|
||||
|
||||
@@ -21,7 +21,6 @@ using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Garrisons
|
||||
@@ -173,7 +172,7 @@ namespace Game.Garrisons
|
||||
//todo check this method, might be slow.....
|
||||
public List<GarrAbilityRecord> RollFollowerAbilities(uint garrFollowerId, GarrFollowerRecord follower, uint quality, uint faction, bool initial)
|
||||
{
|
||||
Contract.Assert(faction< 2);
|
||||
Cypher.Assert(faction< 2);
|
||||
|
||||
bool hasForcedExclusiveTrait = false;
|
||||
List<GarrAbilityRecord> result = new List<GarrAbilityRecord>();
|
||||
|
||||
@@ -25,7 +25,6 @@ using Game.Maps;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Garrisons
|
||||
{
|
||||
@@ -426,7 +425,7 @@ namespace Game.Garrisons
|
||||
{
|
||||
// Restore previous level building
|
||||
uint restored = Global.GarrisonMgr.GetPreviousLevelBuilding(constructing.BuildingType, constructing.UpgradeLevel);
|
||||
Contract.Assert(restored != 0);
|
||||
Cypher.Assert(restored != 0);
|
||||
|
||||
GarrisonPlaceBuildingResult placeBuildingResult = new GarrisonPlaceBuildingResult();
|
||||
placeBuildingResult.GarrTypeID = GarrisonType.Garrison;
|
||||
|
||||
@@ -29,7 +29,6 @@ using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Framework.Dynamic;
|
||||
@@ -3017,7 +3016,7 @@ namespace Game
|
||||
{
|
||||
if (spellEffect != null && spellEffect.IsEffect(SpellEffectName.LearnSpell))
|
||||
{
|
||||
Contract.Assert(spell.LearnedSpellId == spell.SpellId, $"Only one learned spell is currently supported - spell {spell.SpellId} already teaches {spell.LearnedSpellId} but it tried to overwrite it with {spellEffect.TriggerSpell}");
|
||||
Cypher.Assert(spell.LearnedSpellId == spell.SpellId, $"Only one learned spell is currently supported - spell {spell.SpellId} already teaches {spell.LearnedSpellId} but it tried to overwrite it with {spellEffect.TriggerSpell}");
|
||||
spell.LearnedSpellId = spellEffect.TriggerSpell;
|
||||
break;
|
||||
}
|
||||
@@ -9267,7 +9266,7 @@ namespace Game
|
||||
}
|
||||
public ObjectGuidGenerator GetGenerator(HighGuid high)
|
||||
{
|
||||
Contract.Assert(ObjectGuid.IsGlobal(high) || ObjectGuid.IsRealmSpecific(high), "Only global guid can be generated in ObjectMgr context");
|
||||
Cypher.Assert(ObjectGuid.IsGlobal(high) || ObjectGuid.IsRealmSpecific(high), "Only global guid can be generated in ObjectMgr context");
|
||||
|
||||
return GetGuidSequenceGenerator(high);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ using Game.Network;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Groups
|
||||
@@ -113,7 +112,7 @@ namespace Game.Groups
|
||||
|
||||
ConvertLeaderInstancesToGroup(leader, this, false);
|
||||
|
||||
Contract.Assert(AddMember(leader)); // If the leader can't be added to a new group because it appears full, something is clearly wrong.
|
||||
Cypher.Assert(AddMember(leader)); // If the leader can't be added to a new group because it appears full, something is clearly wrong.
|
||||
}
|
||||
else if (!AddMember(leader))
|
||||
return false;
|
||||
@@ -898,7 +897,7 @@ namespace Game.Groups
|
||||
// notify group members which player is the allowed looter for the given creature
|
||||
public void SendLooter(Creature creature, Player groupLooter)
|
||||
{
|
||||
Contract.Assert(creature);
|
||||
Cypher.Assert(creature);
|
||||
|
||||
LootList lootList = new LootList();
|
||||
lootList.Owner = creature.GetGUID();
|
||||
|
||||
+11
-12
@@ -25,7 +25,6 @@ using Game.Network;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Guilds
|
||||
@@ -2087,7 +2086,7 @@ namespace Game.Guilds
|
||||
|
||||
void _SendBankContentUpdate(MoveItemData pSrc, MoveItemData pDest)
|
||||
{
|
||||
Contract.Assert(pSrc.IsBank() || pDest.IsBank());
|
||||
Cypher.Assert(pSrc.IsBank() || pDest.IsBank());
|
||||
|
||||
byte tabId = 0;
|
||||
List<byte> slots = new List<byte>();
|
||||
@@ -2249,7 +2248,7 @@ namespace Game.Guilds
|
||||
void SendGuildRanksUpdate(ObjectGuid setterGuid, ObjectGuid targetGuid, uint rank)
|
||||
{
|
||||
Member member = GetMember(targetGuid);
|
||||
Contract.Assert(member != null);
|
||||
Cypher.Assert(member != null);
|
||||
|
||||
GuildSendRankChange rankChange = new GuildSendRankChange();
|
||||
rankChange.Officer = setterGuid;
|
||||
@@ -3468,7 +3467,7 @@ namespace Game.Guilds
|
||||
|
||||
public virtual bool CheckItem(ref uint splitedAmount)
|
||||
{
|
||||
Contract.Assert(m_pItem != null);
|
||||
Cypher.Assert(m_pItem != null);
|
||||
if (splitedAmount > m_pItem.GetCount())
|
||||
return false;
|
||||
if (splitedAmount == m_pItem.GetCount())
|
||||
@@ -3487,7 +3486,7 @@ namespace Game.Guilds
|
||||
|
||||
public bool CloneItem(uint count)
|
||||
{
|
||||
Contract.Assert(m_pItem != null);
|
||||
Cypher.Assert(m_pItem != null);
|
||||
m_pClonedItem = m_pItem.CloneItem(count);
|
||||
if (m_pClonedItem == null)
|
||||
{
|
||||
@@ -3499,7 +3498,7 @@ namespace Game.Guilds
|
||||
|
||||
public virtual void LogAction(MoveItemData pFrom)
|
||||
{
|
||||
Contract.Assert(pFrom.GetItem() != null);
|
||||
Cypher.Assert(pFrom.GetItem() != null);
|
||||
|
||||
Global.ScriptMgr.OnGuildItemMove(m_pGuild, m_pPlayer, pFrom.GetItem(),
|
||||
pFrom.IsBank(), pFrom.GetContainer(), pFrom.GetSlotId(),
|
||||
@@ -3588,7 +3587,7 @@ namespace Game.Guilds
|
||||
|
||||
public override Item StoreItem(SQLTransaction trans, Item pItem)
|
||||
{
|
||||
Contract.Assert(pItem != null);
|
||||
Cypher.Assert(pItem != null);
|
||||
m_pPlayer.MoveItemToInventory(m_vec, pItem, true);
|
||||
m_pPlayer.SaveInventoryAndGoldToDB(trans);
|
||||
return pItem;
|
||||
@@ -3596,7 +3595,7 @@ namespace Game.Guilds
|
||||
|
||||
public override void LogBankEvent(SQLTransaction trans, MoveItemData pFrom, uint count)
|
||||
{
|
||||
Contract.Assert(pFrom != null);
|
||||
Cypher.Assert(pFrom != null);
|
||||
// Bank . Char
|
||||
m_pGuild._LogBankEvent(trans, GuildBankEventLogTypes.WithdrawItem, pFrom.GetContainer(), m_pPlayer.GetGUID().GetCounter(),
|
||||
pFrom.GetItem().GetEntry(), (ushort)count);
|
||||
@@ -3622,7 +3621,7 @@ namespace Game.Guilds
|
||||
}
|
||||
public override bool HasStoreRights(MoveItemData pOther)
|
||||
{
|
||||
Contract.Assert(pOther != null);
|
||||
Cypher.Assert(pOther != null);
|
||||
// Do not check rights if item is being swapped within the same bank tab
|
||||
if (pOther.IsBank() && pOther.GetContainer() == m_container)
|
||||
return true;
|
||||
@@ -3631,7 +3630,7 @@ namespace Game.Guilds
|
||||
|
||||
public override bool HasWithdrawRights(MoveItemData pOther)
|
||||
{
|
||||
Contract.Assert(pOther != null);
|
||||
Cypher.Assert(pOther != null);
|
||||
// Do not check rights if item is being swapped within the same bank tab
|
||||
if (pOther.IsBank() && pOther.GetContainer() == m_container)
|
||||
return true;
|
||||
@@ -3646,7 +3645,7 @@ namespace Game.Guilds
|
||||
|
||||
public override void RemoveItem(SQLTransaction trans, MoveItemData pOther, uint splitedAmount = 0)
|
||||
{
|
||||
Contract.Assert(m_pItem != null);
|
||||
Cypher.Assert(m_pItem != null);
|
||||
if (splitedAmount != 0)
|
||||
{
|
||||
m_pItem.SetCount(m_pItem.GetCount() - splitedAmount);
|
||||
@@ -3684,7 +3683,7 @@ namespace Game.Guilds
|
||||
|
||||
public override void LogBankEvent(SQLTransaction trans, MoveItemData pFrom, uint count)
|
||||
{
|
||||
Contract.Assert(pFrom.GetItem() != null);
|
||||
Cypher.Assert(pFrom.GetItem() != null);
|
||||
if (pFrom.IsBank())
|
||||
// Bank . Bank
|
||||
m_pGuild._LogBankEvent(trans, GuildBankEventLogTypes.MoveItem, pFrom.GetContainer(), m_pPlayer.GetGUID().GetCounter(),
|
||||
|
||||
@@ -21,7 +21,6 @@ using Game.Entities;
|
||||
using Game.Network;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
@@ -52,7 +51,7 @@ namespace Game
|
||||
if (vehicle)
|
||||
{
|
||||
VehicleSeatRecord seat = vehicle.GetSeatForPassenger(GetPlayer());
|
||||
Contract.Assert(seat != null);
|
||||
Cypher.Assert(seat != null);
|
||||
if (!seat.Flags.HasAnyFlag(VehicleSeatFlags.CanAttack))
|
||||
{
|
||||
SendAttackStop(enemy);
|
||||
|
||||
@@ -20,7 +20,6 @@ using Game.Entities;
|
||||
using Game.Groups;
|
||||
using Game.Network;
|
||||
using Game.Network.Packets;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
@@ -204,7 +203,7 @@ namespace Game
|
||||
}
|
||||
|
||||
// If we're about to create a group there really should be a leader present
|
||||
Contract.Assert(leader);
|
||||
Cypher.Assert(leader);
|
||||
group.RemoveInvite(leader);
|
||||
group.Create(leader);
|
||||
Global.GroupMgr.AddGroup(group);
|
||||
@@ -253,7 +252,7 @@ namespace Game
|
||||
|
||||
Group grp = GetPlayer().GetGroup();
|
||||
// grp is checked already above in CanUninviteFromGroup()
|
||||
Contract.Assert(grp);
|
||||
Cypher.Assert(grp);
|
||||
|
||||
if (grp.IsMember(packet.TargetGUID))
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@ using Game.Network;
|
||||
using Game.Network.Packets;
|
||||
using Game.Spells;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
@@ -231,7 +230,7 @@ namespace Game
|
||||
GetPlayer().StopCastingCharm();
|
||||
else if (pet.GetOwnerGUID() == GetPlayer().GetGUID())
|
||||
{
|
||||
Contract.Assert(pet.IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(pet.IsTypeId(TypeId.Unit));
|
||||
if (pet.IsPet())
|
||||
{
|
||||
if (pet.ToPet().getPetType() == PetType.Hunter)
|
||||
|
||||
@@ -20,7 +20,6 @@ using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using Game.Network;
|
||||
using Game.Network.Packets;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game
|
||||
{
|
||||
@@ -185,7 +184,7 @@ namespace Game
|
||||
}
|
||||
|
||||
VehicleSeatRecord seat = vehicle.GetSeatForPassenger(unit);
|
||||
Contract.Assert(seat != null);
|
||||
Cypher.Assert(seat != null);
|
||||
if (seat.IsEjectable())
|
||||
unit.ExitVehicle();
|
||||
else
|
||||
|
||||
@@ -28,7 +28,7 @@ using System.Collections.Concurrent;
|
||||
|
||||
namespace Game.Maps
|
||||
{
|
||||
public abstract class Notifier
|
||||
public class Notifier
|
||||
{
|
||||
public virtual void Visit(IList<WorldObject> objs) { }
|
||||
public virtual void Visit(IList<Creature> objs) { }
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.Groups;
|
||||
using Game.Scenarios;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Maps
|
||||
@@ -426,7 +425,7 @@ namespace Game.Maps
|
||||
InstanceBind bind = player.GetBoundInstance(pair.Value.GetMapId(), pair.Value.GetDifficultyID());
|
||||
if (bind != null)
|
||||
{
|
||||
Contract.Assert(bind.save == pair.Value);
|
||||
Cypher.Assert(bind.save == pair.Value);
|
||||
if (bind.perm && bind.extendState != 0) // permanent and not already expired
|
||||
{
|
||||
// actual promotion in DB already happened in caller
|
||||
@@ -602,7 +601,7 @@ namespace Game.Maps
|
||||
void SetResetTimeFor(uint mapid, Difficulty d, long t)
|
||||
{
|
||||
var key = MathFunctions.MakePair64(mapid, (uint)d);
|
||||
Contract.Assert(m_resetTimeByMapDifficulty.ContainsKey(key));
|
||||
Cypher.Assert(m_resetTimeByMapDifficulty.ContainsKey(key));
|
||||
m_resetTimeByMapDifficulty[key] = t;
|
||||
}
|
||||
|
||||
@@ -662,7 +661,7 @@ namespace Game.Maps
|
||||
Map map = Global.MapMgr.FindMap(GetMapId(), m_instanceid);
|
||||
if (map != null)
|
||||
{
|
||||
Contract.Assert(map.IsDungeon());
|
||||
Cypher.Assert(map.IsDungeon());
|
||||
InstanceScript instanceScript = ((InstanceMap)map).GetInstanceScript();
|
||||
if (instanceScript != null)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.Groups;
|
||||
using Game.Network.Packets;
|
||||
using Game.Scenarios;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Text;
|
||||
|
||||
namespace Game.Maps
|
||||
@@ -157,7 +156,7 @@ namespace Game.Maps
|
||||
{
|
||||
foreach (var data in objectData)
|
||||
{
|
||||
Contract.Assert(!objectInfo.ContainsKey(data.entry));
|
||||
Cypher.Assert(!objectInfo.ContainsKey(data.entry));
|
||||
objectInfo[data.entry] = data.type;
|
||||
}
|
||||
}
|
||||
@@ -216,7 +215,7 @@ namespace Game.Maps
|
||||
|
||||
public BossInfo GetBossInfo(uint id)
|
||||
{
|
||||
Contract.Assert(id < bosses.Count);
|
||||
Cypher.Assert(id < bosses.Count);
|
||||
return bosses[id];
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.Garrisons;
|
||||
using Game.Groups;
|
||||
using Game.Scenarios;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Maps
|
||||
@@ -181,13 +180,13 @@ namespace Game.Maps
|
||||
if (entry == null)
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "CreateInstance: no record for map {0}", GetId());
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
InstanceTemplate iTemplate = Global.ObjectMgr.GetInstanceTemplate(GetId());
|
||||
if (iTemplate == null)
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "CreateInstance: no instance template for map {0}", GetId());
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
// some instances only have one difficulty
|
||||
@@ -196,7 +195,7 @@ namespace Game.Maps
|
||||
Log.outDebug(LogFilter.Maps, "MapInstanced.CreateInstance: {0} map instance {1} for {2} created with difficulty {3}", save != null ? "" : "new ", InstanceId, GetId(), difficulty);
|
||||
|
||||
InstanceMap map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this);
|
||||
Contract.Assert(map.IsDungeon());
|
||||
Cypher.Assert(map.IsDungeon());
|
||||
|
||||
map.LoadRespawnTimes();
|
||||
map.LoadCorpseData();
|
||||
@@ -222,7 +221,7 @@ namespace Game.Maps
|
||||
Log.outDebug(LogFilter.Maps, "MapInstanced.CreateBattleground: map bg {0} for {1} created.", InstanceId, GetId());
|
||||
|
||||
BattlegroundMap map = new BattlegroundMap(GetId(), (uint)GetGridExpiry(), InstanceId, this, Difficulty.None);
|
||||
Contract.Assert(map.IsBattlegroundOrArena());
|
||||
Cypher.Assert(map.IsBattlegroundOrArena());
|
||||
map.SetBG(bg);
|
||||
bg.SetBgMap(map);
|
||||
|
||||
@@ -236,7 +235,7 @@ namespace Game.Maps
|
||||
lock (_mapLock)
|
||||
{
|
||||
GarrisonMap map = new GarrisonMap(GetId(), GetGridExpiry(), instanceId, this, owner.GetGUID());
|
||||
Contract.Assert(map.IsGarrison());
|
||||
Cypher.Assert(map.IsGarrison());
|
||||
|
||||
m_InstancedMaps[instanceId] = map;
|
||||
return map;
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Game.DataStorage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -116,7 +115,7 @@ namespace Game
|
||||
|
||||
// get this mmap data
|
||||
MMapData mmap = loadedMMaps[mapId];
|
||||
Contract.Assert(mmap.navMesh != null);
|
||||
Cypher.Assert(mmap.navMesh != null);
|
||||
|
||||
// check if we already have this tile loaded
|
||||
uint packedGridPos = packTileID(x, y);
|
||||
@@ -247,7 +246,7 @@ namespace Game
|
||||
// if the grid is later reloaded, dtNavMesh.addTile will return error but no extra memory is used
|
||||
// we cannot recover from this error - assert out
|
||||
Log.outError(LogFilter.Maps, "MMAP:unloadMap: Could not unload {0:D4}{1:D2}{2:D2}.mmtile from navmesh", mapId, x, y);
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+20
-21
@@ -30,7 +30,6 @@ using Game.Scenarios;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
@@ -93,7 +92,7 @@ namespace Game.Maps
|
||||
for (var i = 0; i < i_worldObjects.Count; ++i)
|
||||
{
|
||||
WorldObject obj = i_worldObjects[i];
|
||||
Contract.Assert(obj.IsWorldObject());
|
||||
Cypher.Assert(obj.IsWorldObject());
|
||||
obj.RemoveFromWorld();
|
||||
obj.ResetMap();
|
||||
}
|
||||
@@ -334,7 +333,7 @@ namespace Game.Maps
|
||||
|
||||
Log.outDebug(LogFilter.Maps, "Switch object {0} from grid[{1}, {2}] {3}", obj.GetGUID(), cell.GetGridX(), cell.GetGridY(), on);
|
||||
Grid ngrid = getGrid(cell.GetGridX(), cell.GetGridY());
|
||||
Contract.Assert(ngrid != null);
|
||||
Cypher.Assert(ngrid != null);
|
||||
|
||||
RemoveFromGrid(obj, cell);
|
||||
|
||||
@@ -462,7 +461,7 @@ namespace Game.Maps
|
||||
EnsureGridLoadedForActiveObject(cell, player);
|
||||
AddToGrid(player, cell);
|
||||
|
||||
Contract.Assert(player.GetMap() == this);
|
||||
Cypher.Assert(player.GetMap() == this);
|
||||
player.SetMap(this);
|
||||
player.AddToWorld();
|
||||
|
||||
@@ -986,7 +985,7 @@ namespace Game.Maps
|
||||
Cell integrity_check = new Cell(dynObj.GetPositionX(), dynObj.GetPositionY());
|
||||
Cell old_cell = dynObj.GetCurrentCell();
|
||||
|
||||
Contract.Assert(integrity_check == old_cell);
|
||||
Cypher.Assert(integrity_check == old_cell);
|
||||
|
||||
Cell new_cell = new Cell(x, y);
|
||||
|
||||
@@ -1013,7 +1012,7 @@ namespace Game.Maps
|
||||
old_cell = dynObj.GetCurrentCell();
|
||||
integrity_check = new Cell(dynObj.GetPositionX(), dynObj.GetPositionY());
|
||||
|
||||
Contract.Assert(integrity_check == old_cell);
|
||||
Cypher.Assert(integrity_check == old_cell);
|
||||
}
|
||||
|
||||
public void AreaTriggerRelocation(AreaTrigger at, float x, float y, float z, float orientation)
|
||||
@@ -1021,7 +1020,7 @@ namespace Game.Maps
|
||||
Cell integrity_check = new Cell(at.GetPositionX(), at.GetPositionY());
|
||||
Cell old_cell = at.GetCurrentCell();
|
||||
|
||||
Contract.Assert(integrity_check == old_cell);
|
||||
Cypher.Assert(integrity_check == old_cell);
|
||||
Cell new_cell = new Cell(x, y);
|
||||
|
||||
if (getGrid(new_cell.GetGridX(), new_cell.GetGridY()) == null)
|
||||
@@ -1045,7 +1044,7 @@ namespace Game.Maps
|
||||
|
||||
old_cell = at.GetCurrentCell();
|
||||
integrity_check = new Cell(at.GetPositionX(), at.GetPositionY());
|
||||
Contract.Assert(integrity_check == old_cell);
|
||||
Cypher.Assert(integrity_check == old_cell);
|
||||
}
|
||||
|
||||
void AddCreatureToMoveList(Creature c, float x, float y, float z, float ang)
|
||||
@@ -1595,7 +1594,7 @@ namespace Game.Maps
|
||||
grid.VisitAllGrids(visitor);
|
||||
}
|
||||
|
||||
Contract.Assert(i_objectsToRemove.Empty());
|
||||
Cypher.Assert(i_objectsToRemove.Empty());
|
||||
setGrid(null, x, y);
|
||||
|
||||
uint gx = (MapConst.MaxGrids - 1) - x;
|
||||
@@ -2221,7 +2220,7 @@ namespace Game.Maps
|
||||
while (!_updateObjects.Empty())
|
||||
{
|
||||
WorldObject obj = _updateObjects[0];
|
||||
Contract.Assert(obj.IsInWorld);
|
||||
Cypher.Assert(obj.IsInWorld);
|
||||
_updateObjects.RemoveAt(0);
|
||||
obj.BuildUpdate(update_players);
|
||||
}
|
||||
@@ -2265,7 +2264,7 @@ namespace Game.Maps
|
||||
|
||||
public void AddObjectToRemoveList(WorldObject obj)
|
||||
{
|
||||
Contract.Assert(obj.GetMapId() == GetId() && obj.GetInstanceId() == GetInstanceId());
|
||||
Cypher.Assert(obj.GetMapId() == GetId() && obj.GetInstanceId() == GetInstanceId());
|
||||
|
||||
obj.CleanupsBeforeDelete(false); // remove or simplify at least cross referenced links
|
||||
|
||||
@@ -2274,7 +2273,7 @@ namespace Game.Maps
|
||||
|
||||
public void AddObjectToSwitchList(WorldObject obj, bool on)
|
||||
{
|
||||
Contract.Assert(obj.GetMapId() == GetId() && obj.GetInstanceId() == GetInstanceId());
|
||||
Cypher.Assert(obj.GetMapId() == GetId() && obj.GetInstanceId() == GetInstanceId());
|
||||
// i_objectsToSwitch is iterated only in Map::RemoveAllObjectsInRemoveList() and it uses
|
||||
// the contained objects only if GetTypeId() == TYPEID_UNIT , so we can return in all other cases
|
||||
if (!obj.IsTypeId(TypeId.Unit) && !obj.IsTypeId(TypeId.GameObject))
|
||||
@@ -2285,7 +2284,7 @@ namespace Game.Maps
|
||||
else if (i_objectsToSwitch[obj] != on)
|
||||
i_objectsToSwitch.Remove(obj);
|
||||
else
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
void RemoveAllObjectsInRemoveList()
|
||||
@@ -2678,7 +2677,7 @@ namespace Game.Maps
|
||||
|
||||
void RemoveCorpse(Corpse corpse)
|
||||
{
|
||||
Contract.Assert(corpse);
|
||||
Cypher.Assert(corpse);
|
||||
|
||||
corpse.DestroyForNearbyPlayers();
|
||||
if (corpse.GetCurrentCell() != null)
|
||||
@@ -3368,7 +3367,7 @@ namespace Game.Maps
|
||||
|
||||
public ulong GenerateLowGuid(HighGuid high)
|
||||
{
|
||||
//Contract.Assert(!ObjectGuid.IsMapSpecific(high), "Only map specific guid can be generated in Map context");
|
||||
//Cypher.Assert(!ObjectGuid.IsMapSpecific(high), "Only map specific guid can be generated in Map context");
|
||||
|
||||
return GetGuidSequenceGenerator(high).Generate();
|
||||
}
|
||||
@@ -4402,7 +4401,7 @@ namespace Game.Maps
|
||||
if (player.GetMap() == this)
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "InstanceMap:CannotEnter - player {0} ({1}) already in map {2}, {3}, {4}!", player.GetName(), player.GetGUID().ToString(), GetId(), GetInstanceId(), GetSpawnMode());
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
return EnterState.CannotEnterAlreadyInMap;
|
||||
}
|
||||
|
||||
@@ -4456,7 +4455,7 @@ namespace Game.Maps
|
||||
mapSave = Global.InstanceSaveMgr.AddInstanceSave(GetId(), GetInstanceId(), GetSpawnMode(), 0, 0, true);
|
||||
}
|
||||
|
||||
Contract.Assert(mapSave != null);
|
||||
Cypher.Assert(mapSave != null);
|
||||
|
||||
// check for existing instance binds
|
||||
InstanceBind playerBind = player.GetBoundInstance(GetId(), GetSpawnMode());
|
||||
@@ -4497,7 +4496,7 @@ namespace Game.Maps
|
||||
GetMapName(), groupBind.save.GetMapId(), groupBind.save.GetInstanceId(),
|
||||
groupBind.save.GetDifficultyID(), groupBind.save.GetPlayerCount(),
|
||||
groupBind.save.GetGroupCount(), groupBind.save.CanReset());
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
return false;
|
||||
}
|
||||
// bind to the group or keep using the group save
|
||||
@@ -4544,7 +4543,7 @@ namespace Game.Maps
|
||||
player.BindToInstance(mapSave, false);
|
||||
else
|
||||
// cannot jump to a different instance without resetting it
|
||||
Contract.Assert(playerBind.save == mapSave);
|
||||
Cypher.Assert(playerBind.save == mapSave);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4753,7 +4752,7 @@ namespace Game.Maps
|
||||
|
||||
public override void UnloadAll()
|
||||
{
|
||||
Contract.Assert(!HavePlayers());
|
||||
Cypher.Assert(!HavePlayers());
|
||||
|
||||
if (m_resetAfterUnload)
|
||||
{
|
||||
@@ -4849,7 +4848,7 @@ namespace Game.Maps
|
||||
if (player.GetMap() == this)
|
||||
{
|
||||
Log.outError(LogFilter.Maps, "BGMap:CannotEnter - player {0} is already in map!", player.GetGUID().ToString());
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
return EnterState.CannotEnterAlreadyInMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ using Game.Groups;
|
||||
using Game.Maps;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Entities
|
||||
@@ -60,7 +59,7 @@ namespace Game.Entities
|
||||
if (map == null)
|
||||
{
|
||||
var entry = CliDB.MapStorage.LookupByKey(id);
|
||||
Contract.Assert(entry != null);
|
||||
Cypher.Assert(entry != null);
|
||||
if (entry.ParentMapID != -1)
|
||||
{
|
||||
CreateBaseMap((uint)entry.ParentMapID);
|
||||
@@ -73,7 +72,7 @@ namespace Game.Entities
|
||||
lock(_mapsLock)
|
||||
map = CreateBaseMap_i(entry);
|
||||
}
|
||||
Contract.Assert(map != null);
|
||||
Cypher.Assert(map != null);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.Entities;
|
||||
using Game.Movement;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Maps
|
||||
@@ -161,12 +160,12 @@ namespace Game.Maps
|
||||
}
|
||||
}
|
||||
|
||||
Contract.Assert(!keyFrames.Empty());
|
||||
Cypher.Assert(!keyFrames.Empty());
|
||||
|
||||
if (transport.mapsUsed.Count > 1)
|
||||
{
|
||||
foreach (var mapId in transport.mapsUsed)
|
||||
Contract.Assert(!CliDB.MapStorage.LookupByKey(mapId).Instanceable());
|
||||
Cypher.Assert(!CliDB.MapStorage.LookupByKey(mapId).Instanceable());
|
||||
|
||||
transport.inInstance = false;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ using Framework.GameMath;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Movement
|
||||
@@ -49,7 +48,7 @@ namespace Game.Movement
|
||||
uint SendPathSpline(Unit me, List<Vector3> wp)
|
||||
{
|
||||
int numWp = wp.Count;
|
||||
Contract.Assert(numWp > 1, "Every path must have source & destination");
|
||||
Cypher.Assert(numWp > 1, "Every path must have source & destination");
|
||||
MoveSplineInit init = new MoveSplineInit(me);
|
||||
if (numWp > 2)
|
||||
init.MovebyPath(wp.ToArray());
|
||||
@@ -61,7 +60,7 @@ namespace Game.Movement
|
||||
|
||||
void SendSplineFor(Unit me, int index, uint toNext)
|
||||
{
|
||||
Contract.Assert(index < _chainSize);
|
||||
Cypher.Assert(index < _chainSize);
|
||||
Log.outDebug(LogFilter.Movement, "{0}: Sending spline for {1}.", me.GetGUID().ToString(), index);
|
||||
|
||||
SplineChainLink thisLink = _chain[index];
|
||||
|
||||
@@ -278,6 +278,7 @@ namespace Game.Movement
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void LoadPath(Creature creature)
|
||||
{
|
||||
if (loadedFromDB)
|
||||
@@ -298,6 +299,7 @@ namespace Game.Movement
|
||||
if (!Stopped())
|
||||
StartMoveNow(creature);
|
||||
}
|
||||
|
||||
void OnArrived(Creature creature)
|
||||
{
|
||||
if (path == null || path.nodes.Empty())
|
||||
|
||||
@@ -22,7 +22,6 @@ using Game.DataStorage;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Movement
|
||||
{
|
||||
@@ -78,7 +77,7 @@ namespace Game.Movement
|
||||
if (_owner.HasUnitState(UnitState.Root | UnitState.Stunned))
|
||||
return;
|
||||
|
||||
Contract.Assert(!empty());
|
||||
Cypher.Assert(!empty());
|
||||
|
||||
_cleanFlag |= MMCleanFlag.Update;
|
||||
bool isMoveGenUpdateSuccess = top().Update(_owner, diff);
|
||||
@@ -157,7 +156,7 @@ namespace Game.Movement
|
||||
|
||||
public IMovementGenerator GetMotionSlot(int slot)
|
||||
{
|
||||
Contract.Assert(slot >= 0);
|
||||
Cypher.Assert(slot >= 0);
|
||||
return _slot[slot];
|
||||
}
|
||||
|
||||
@@ -744,7 +743,7 @@ namespace Game.Movement
|
||||
|
||||
public IMovementGenerator top()
|
||||
{
|
||||
Contract.Assert(!empty());
|
||||
Cypher.Assert(!empty());
|
||||
return _slot[_top];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Network
|
||||
{
|
||||
@@ -24,7 +23,7 @@ namespace Game.Network
|
||||
{
|
||||
public void Insert(int index, int value)
|
||||
{
|
||||
Contract.Assert(index < 0x20);
|
||||
Cypher.Assert(index < 0x20);
|
||||
|
||||
_mask |= 1u << index;
|
||||
if (_contents.Length <= index)
|
||||
|
||||
@@ -23,7 +23,6 @@ using Framework.IO;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Network.Packets
|
||||
{
|
||||
@@ -583,7 +582,7 @@ namespace Game.Network.Packets
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
Contract.Assert(UndeleteInfo != null);
|
||||
Cypher.Assert(UndeleteInfo != null);
|
||||
_worldPacket.WriteInt32(UndeleteInfo.ClientToken);
|
||||
_worldPacket.WriteUInt32(Result);
|
||||
_worldPacket.WritePackedGuid(UndeleteInfo.CharacterGuid);
|
||||
|
||||
@@ -23,7 +23,6 @@ using Framework.IO;
|
||||
using Game.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Network.Packets
|
||||
{
|
||||
@@ -621,7 +620,7 @@ namespace Game.Network.Packets
|
||||
|
||||
if (player)
|
||||
{
|
||||
Contract.Assert(player.GetGUID() == guid);
|
||||
Cypher.Assert(player.GetGUID() == guid);
|
||||
|
||||
AccountID = player.GetSession().GetAccountGUID();
|
||||
BnetAccountID = player.GetSession().GetBattlenetAccountGUID();
|
||||
|
||||
@@ -27,7 +27,6 @@ using Game.Network;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.PvP
|
||||
@@ -297,9 +296,9 @@ namespace Game.PvP
|
||||
public void SetMapFromZone(uint zone)
|
||||
{
|
||||
AreaTableRecord areaTable = CliDB.AreaTableStorage.LookupByKey(zone);
|
||||
Contract.Assert(areaTable != null);
|
||||
Cypher.Assert(areaTable != null);
|
||||
Map map = Global.MapMgr.CreateBaseMap(areaTable.ContinentID);
|
||||
Contract.Assert(!map.Instanceable());
|
||||
Cypher.Assert(!map.Instanceable());
|
||||
m_map = map;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ using Game.Spells;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -584,8 +583,8 @@ namespace Game.Scripting
|
||||
}
|
||||
public void OnGainCalculation(uint gain, Player player, Unit unit)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(unit != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(unit != null);
|
||||
|
||||
ForEach<FormulaScript>(p => p.OnGainCalculation(gain, player, unit));
|
||||
}
|
||||
@@ -597,7 +596,7 @@ namespace Game.Scripting
|
||||
//MapScript
|
||||
public void OnCreateMap(Map map)
|
||||
{
|
||||
Contract.Assert(map != null);
|
||||
Cypher.Assert(map != null);
|
||||
var record = map.GetEntry();
|
||||
|
||||
if (record != null && record.IsWorldMap())
|
||||
@@ -611,7 +610,7 @@ namespace Game.Scripting
|
||||
}
|
||||
public void OnDestroyMap(Map map)
|
||||
{
|
||||
Contract.Assert(map != null);
|
||||
Cypher.Assert(map != null);
|
||||
var record = map.GetEntry();
|
||||
|
||||
if (record != null && record.IsWorldMap())
|
||||
@@ -625,8 +624,8 @@ namespace Game.Scripting
|
||||
}
|
||||
public void OnLoadGridMap(Map map, GridMap gmap, uint gx, uint gy)
|
||||
{
|
||||
Contract.Assert(map != null);
|
||||
Contract.Assert(gmap != null);
|
||||
Cypher.Assert(map != null);
|
||||
Cypher.Assert(gmap != null);
|
||||
var record = map.GetEntry();
|
||||
|
||||
if (record != null && record.IsWorldMap())
|
||||
@@ -641,8 +640,8 @@ namespace Game.Scripting
|
||||
}
|
||||
public void OnUnloadGridMap(Map map, GridMap gmap, uint gx, uint gy)
|
||||
{
|
||||
Contract.Assert(map != null);
|
||||
Contract.Assert(gmap != null);
|
||||
Cypher.Assert(map != null);
|
||||
Cypher.Assert(gmap != null);
|
||||
var record = map.GetEntry();
|
||||
|
||||
if (record != null && record.IsWorldMap())
|
||||
@@ -656,8 +655,8 @@ namespace Game.Scripting
|
||||
}
|
||||
public void OnPlayerEnterMap(Map map, Player player)
|
||||
{
|
||||
Contract.Assert(map != null);
|
||||
Contract.Assert(player != null);
|
||||
Cypher.Assert(map != null);
|
||||
Cypher.Assert(player != null);
|
||||
|
||||
ForEach<PlayerScript>(p => p.OnMapChanged(player));
|
||||
|
||||
@@ -674,7 +673,7 @@ namespace Game.Scripting
|
||||
}
|
||||
public void OnPlayerLeaveMap(Map map, Player player)
|
||||
{
|
||||
Contract.Assert(map != null);
|
||||
Cypher.Assert(map != null);
|
||||
var record = map.GetEntry();
|
||||
|
||||
if (record != null && record.IsWorldMap())
|
||||
@@ -688,7 +687,7 @@ namespace Game.Scripting
|
||||
}
|
||||
public void OnMapUpdate(Map map, uint diff)
|
||||
{
|
||||
Contract.Assert(map != null);
|
||||
Cypher.Assert(map != null);
|
||||
var record = map.GetEntry();
|
||||
|
||||
if (record != null && record.IsWorldMap())
|
||||
@@ -704,7 +703,7 @@ namespace Game.Scripting
|
||||
//InstanceMapScript
|
||||
public InstanceScript CreateInstanceData(InstanceMap map)
|
||||
{
|
||||
Contract.Assert(map != null);
|
||||
Cypher.Assert(map != null);
|
||||
|
||||
return RunScriptRet<InstanceMapScript, InstanceScript>(p => p.GetInstanceScript(map), map.GetScriptId(), null);
|
||||
}
|
||||
@@ -712,30 +711,30 @@ namespace Game.Scripting
|
||||
//ItemScript
|
||||
public bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, Item target)
|
||||
{
|
||||
Contract.Assert(caster != null);
|
||||
Contract.Assert(target != null);
|
||||
Cypher.Assert(caster != null);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
return RunScriptRet<ItemScript>(p => p.OnDummyEffect(caster, spellId, effIndex, target), target.GetScriptId());
|
||||
}
|
||||
public bool OnQuestAccept(Player player, Item item, Quest quest)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(item != null);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(item != null);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
return RunScriptRet<ItemScript>(p => p.OnQuestAccept(player, item, quest), item.GetScriptId());
|
||||
}
|
||||
public bool OnItemUse(Player player, Item item, SpellCastTargets targets, ObjectGuid castId)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(item);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(item);
|
||||
|
||||
return RunScriptRet<ItemScript>(p => p.OnUse(player, item, targets, castId), item.GetScriptId());
|
||||
}
|
||||
public bool OnItemExpire(Player player, ItemTemplate proto)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(proto != null);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(proto != null);
|
||||
|
||||
return RunScriptRet<ItemScript>(p => p.OnExpire(player, proto), proto.ScriptId);
|
||||
}
|
||||
@@ -743,76 +742,76 @@ namespace Game.Scripting
|
||||
//CreatureScript
|
||||
public bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, Creature target)
|
||||
{
|
||||
Contract.Assert(caster);
|
||||
Contract.Assert(target);
|
||||
Cypher.Assert(caster);
|
||||
Cypher.Assert(target);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnDummyEffect(caster, spellId, effIndex, target), target.GetScriptId());
|
||||
}
|
||||
public bool OnGossipHello(Player player, Creature creature)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(creature);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(creature);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnGossipHello(player, creature), creature.GetScriptId());
|
||||
}
|
||||
public bool OnGossipSelect(Player player, Creature creature, uint sender, uint action)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(creature != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(creature != null);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnGossipSelect(player, creature, sender, action), creature.GetScriptId());
|
||||
}
|
||||
public bool OnGossipSelectCode(Player player, Creature creature, uint sender, uint action, string code)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(creature != null);
|
||||
Contract.Assert(code != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(creature != null);
|
||||
Cypher.Assert(code != null);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnGossipSelectCode(player, creature, sender, action, code), creature.GetScriptId());
|
||||
}
|
||||
public bool OnQuestAccept(Player player, Creature creature, Quest quest)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(creature != null);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(creature != null);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnQuestAccept(player, creature, quest), creature.GetScriptId());
|
||||
}
|
||||
public bool OnQuestSelect(Player player, Creature creature, Quest quest)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(creature != null);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(creature != null);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnQuestSelect(player, creature, quest), creature.GetScriptId());
|
||||
}
|
||||
public bool OnQuestComplete(Player player, Creature creature, Quest quest)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(creature != null);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(creature != null);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnQuestComplete(player, creature, quest), creature.GetScriptId());
|
||||
}
|
||||
public bool OnQuestReward(Player player, Creature creature, Quest quest, uint opt)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(creature != null);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(creature != null);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
return RunScriptRet<CreatureScript>(p => p.OnQuestReward(player, creature, quest, opt), creature.GetScriptId());
|
||||
}
|
||||
public uint GetDialogStatus(Player player, Creature creature)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(creature != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(creature != null);
|
||||
|
||||
player.PlayerTalkClass.ClearMenus();
|
||||
return RunScriptRet<CreatureScript, uint>(p => p.GetDialogStatus(player, creature), creature.GetScriptId(), (uint)QuestGiverStatus.ScriptedNoStatus);
|
||||
}
|
||||
public bool CanSpawn(ulong spawnId, uint entry, CreatureTemplate actTemplate, CreatureData cData, Map map)
|
||||
{
|
||||
Contract.Assert(actTemplate != null);
|
||||
Cypher.Assert(actTemplate != null);
|
||||
|
||||
CreatureTemplate baseTemplate = Global.ObjectMgr.GetCreatureTemplate(entry);
|
||||
if (baseTemplate == null)
|
||||
@@ -821,13 +820,13 @@ namespace Game.Scripting
|
||||
}
|
||||
public CreatureAI GetCreatureAI(Creature creature)
|
||||
{
|
||||
Contract.Assert(creature != null);
|
||||
Cypher.Assert(creature != null);
|
||||
|
||||
return RunScriptRet<CreatureScript, CreatureAI>(p => p.GetAI(creature), creature.GetScriptId());
|
||||
}
|
||||
public void OnCreatureUpdate(Creature creature, uint diff)
|
||||
{
|
||||
Contract.Assert(creature != null);
|
||||
Cypher.Assert(creature != null);
|
||||
|
||||
RunScript<CreatureScript>(p => p.OnUpdate(creature, diff), creature.GetScriptId());
|
||||
}
|
||||
@@ -835,90 +834,90 @@ namespace Game.Scripting
|
||||
//GameObjectScript
|
||||
public bool OnDummyEffect(Unit caster, uint spellId, uint effIndex, GameObject target)
|
||||
{
|
||||
Contract.Assert(caster != null);
|
||||
Contract.Assert(target != null);
|
||||
Cypher.Assert(caster != null);
|
||||
Cypher.Assert(target != null);
|
||||
|
||||
return RunScriptRet<GameObjectScript>(p => p.OnDummyEffect(caster, spellId, effIndex, target), target.GetScriptId());
|
||||
}
|
||||
public bool OnGossipHello(Player player, GameObject go)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
player.PlayerTalkClass.ClearMenus();
|
||||
return RunScriptRet<GameObjectScript>(p => p.OnGossipHello(player, go), go.GetScriptId());
|
||||
}
|
||||
public bool OnGossipSelect(Player player, GameObject go, uint sender, uint action)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
return RunScriptRet<GameObjectScript>(p => p.OnGossipSelect(player, go, sender, action), go.GetScriptId());
|
||||
}
|
||||
public bool OnGossipSelectCode(Player player, GameObject go, uint sender, uint action, string code)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(go != null);
|
||||
Contract.Assert(code != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(go != null);
|
||||
Cypher.Assert(code != null);
|
||||
|
||||
return RunScriptRet<GameObjectScript>(p => p.OnGossipSelectCode(player, go, sender, action, code), go.GetScriptId());
|
||||
}
|
||||
public bool OnQuestAccept(Player player, GameObject go, Quest quest)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(go != null);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(go != null);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
return RunScriptRet<GameObjectScript>(p => p.OnQuestAccept(player, go, quest), go.GetScriptId());
|
||||
}
|
||||
public bool OnQuestReward(Player player, GameObject go, Quest quest, uint opt)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(go != null);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(go != null);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
return RunScriptRet<GameObjectScript>(p => p.OnQuestReward(player, go, quest, opt), go.GetScriptId());
|
||||
}
|
||||
public uint GetDialogStatus(Player player, GameObject go)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
return RunScriptRet<GameObjectScript, uint>(p => p.GetDialogStatus(player, go), go.GetScriptId(), (uint)QuestGiverStatus.ScriptedNoStatus);
|
||||
}
|
||||
public void OnGameObjectDestroyed(GameObject go, Player player)
|
||||
{
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
RunScript<GameObjectScript>(p => p.OnDestroyed(go, player), go.GetScriptId());
|
||||
}
|
||||
public void OnGameObjectDamaged(GameObject go, Player player)
|
||||
{
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
RunScript<GameObjectScript>(p => p.OnDamaged(go, player), go.GetScriptId());
|
||||
}
|
||||
public void OnGameObjectLootStateChanged(GameObject go, uint state, Unit unit)
|
||||
{
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
RunScript<GameObjectScript>(p => p.OnLootStateChanged(go, state, unit), go.GetScriptId());
|
||||
}
|
||||
public void OnGameObjectStateChanged(GameObject go, GameObjectState state)
|
||||
{
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
RunScript<GameObjectScript>(p => p.OnGameObjectStateChanged(go, state), go.GetScriptId());
|
||||
}
|
||||
public void OnGameObjectUpdate(GameObject go, uint diff)
|
||||
{
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
RunScript<GameObjectScript>(p => p.OnUpdate(go, diff), go.GetScriptId());
|
||||
}
|
||||
public GameObjectAI GetGameObjectAI(GameObject go)
|
||||
{
|
||||
Contract.Assert(go != null);
|
||||
Cypher.Assert(go != null);
|
||||
|
||||
return RunScriptRet<GameObjectScript, GameObjectAI>(p => p.GetAI(go), go.GetScriptId());
|
||||
}
|
||||
@@ -926,8 +925,8 @@ namespace Game.Scripting
|
||||
//AreaTriggerScript
|
||||
public bool OnAreaTrigger(Player player, AreaTriggerRecord trigger, bool entered)
|
||||
{
|
||||
Contract.Assert(player != null);
|
||||
Contract.Assert(trigger != null);
|
||||
Cypher.Assert(player != null);
|
||||
Cypher.Assert(trigger != null);
|
||||
|
||||
return RunScriptRet<AreaTriggerScript>(p => p.OnTrigger(player, trigger, entered), Global.ObjectMgr.GetAreaTriggerScriptId(trigger.Id));
|
||||
}
|
||||
@@ -936,59 +935,59 @@ namespace Game.Scripting
|
||||
public Battleground CreateBattleground(BattlegroundTypeId typeId)
|
||||
{
|
||||
// @todo Implement script-side Battlegrounds.
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
return null;
|
||||
}
|
||||
|
||||
// OutdoorPvPScript
|
||||
public OutdoorPvP CreateOutdoorPvP(OutdoorPvPData data)
|
||||
{
|
||||
Contract.Assert(data != null);
|
||||
Cypher.Assert(data != null);
|
||||
return RunScriptRet<OutdoorPvPScript, OutdoorPvP>(p => p.GetOutdoorPvP(), data.ScriptId, null);
|
||||
}
|
||||
|
||||
// WeatherScript
|
||||
public void OnWeatherChange(Weather weather, WeatherState state, float grade)
|
||||
{
|
||||
Contract.Assert(weather != null);
|
||||
Cypher.Assert(weather != null);
|
||||
RunScript<WeatherScript>(p => p.OnChange(weather, state, grade), weather.GetScriptId());
|
||||
}
|
||||
public void OnWeatherUpdate(Weather weather, uint diff)
|
||||
{
|
||||
Contract.Assert(weather != null);
|
||||
Cypher.Assert(weather != null);
|
||||
RunScript<WeatherScript>(p => p.OnUpdate(weather, diff), weather.GetScriptId());
|
||||
}
|
||||
|
||||
// AuctionHouseScript
|
||||
public void OnAuctionAdd(AuctionHouseObject ah, AuctionEntry entry)
|
||||
{
|
||||
Contract.Assert(ah != null);
|
||||
Contract.Assert(entry != null);
|
||||
Cypher.Assert(ah != null);
|
||||
Cypher.Assert(entry != null);
|
||||
ForEach<AuctionHouseScript>(p => p.OnAuctionAdd(ah, entry));
|
||||
}
|
||||
public void OnAuctionRemove(AuctionHouseObject ah, AuctionEntry entry)
|
||||
{
|
||||
Contract.Assert(ah != null);
|
||||
Contract.Assert(entry != null);
|
||||
Cypher.Assert(ah != null);
|
||||
Cypher.Assert(entry != null);
|
||||
ForEach<AuctionHouseScript>(p => p.OnAuctionRemove(ah, entry));
|
||||
}
|
||||
public void OnAuctionSuccessful(AuctionHouseObject ah, AuctionEntry entry)
|
||||
{
|
||||
Contract.Assert(ah != null);
|
||||
Contract.Assert(entry != null);
|
||||
Cypher.Assert(ah != null);
|
||||
Cypher.Assert(entry != null);
|
||||
ForEach<AuctionHouseScript>(p => p.OnAuctionSuccessful(ah, entry));
|
||||
}
|
||||
public void OnAuctionExpire(AuctionHouseObject ah, AuctionEntry entry)
|
||||
{
|
||||
Contract.Assert(ah != null);
|
||||
Contract.Assert(entry != null);
|
||||
Cypher.Assert(ah != null);
|
||||
Cypher.Assert(entry != null);
|
||||
ForEach<AuctionHouseScript>(p => p.OnAuctionExpire(ah, entry));
|
||||
}
|
||||
|
||||
// ConditionScript
|
||||
public bool OnConditionCheck(Condition condition, ConditionSourceInfo sourceInfo)
|
||||
{
|
||||
Contract.Assert(condition != null);
|
||||
Cypher.Assert(condition != null);
|
||||
|
||||
return RunScriptRet<ConditionScript>(p => p.OnConditionCheck(condition, sourceInfo), condition.ScriptId, true);
|
||||
}
|
||||
@@ -996,46 +995,46 @@ namespace Game.Scripting
|
||||
// VehicleScript
|
||||
public void OnInstall(Vehicle veh)
|
||||
{
|
||||
Contract.Assert(veh != null);
|
||||
Contract.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(veh != null);
|
||||
Cypher.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
|
||||
RunScript<VehicleScript>(p => p.OnInstall(veh), veh.GetBase().ToCreature().GetScriptId());
|
||||
}
|
||||
public void OnUninstall(Vehicle veh)
|
||||
{
|
||||
Contract.Assert(veh != null);
|
||||
Contract.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(veh != null);
|
||||
Cypher.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
|
||||
RunScript<VehicleScript>(p => p.OnUninstall(veh), veh.GetBase().ToCreature().GetScriptId());
|
||||
}
|
||||
public void OnReset(Vehicle veh)
|
||||
{
|
||||
Contract.Assert(veh != null);
|
||||
Contract.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(veh != null);
|
||||
Cypher.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
|
||||
RunScript<VehicleScript>(p => p.OnReset(veh), veh.GetBase().ToCreature().GetScriptId());
|
||||
}
|
||||
public void OnInstallAccessory(Vehicle veh, Creature accessory)
|
||||
{
|
||||
Contract.Assert(veh != null);
|
||||
Contract.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Contract.Assert(accessory != null);
|
||||
Cypher.Assert(veh != null);
|
||||
Cypher.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(accessory != null);
|
||||
|
||||
RunScript<VehicleScript>(p => p.OnInstallAccessory(veh, accessory), veh.GetBase().ToCreature().GetScriptId());
|
||||
}
|
||||
public void OnAddPassenger(Vehicle veh, Unit passenger, sbyte seatId)
|
||||
{
|
||||
Contract.Assert(veh != null);
|
||||
Contract.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Contract.Assert(passenger != null);
|
||||
Cypher.Assert(veh != null);
|
||||
Cypher.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(passenger != null);
|
||||
|
||||
RunScript<VehicleScript>(p => p.OnAddPassenger(veh, passenger, seatId), veh.GetBase().ToCreature().GetScriptId());
|
||||
}
|
||||
public void OnRemovePassenger(Vehicle veh, Unit passenger)
|
||||
{
|
||||
Contract.Assert(veh != null);
|
||||
Contract.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Contract.Assert(passenger != null);
|
||||
Cypher.Assert(veh != null);
|
||||
Cypher.Assert(veh.GetBase().IsTypeId(TypeId.Unit));
|
||||
Cypher.Assert(passenger != null);
|
||||
|
||||
RunScript<VehicleScript>(p => p.OnRemovePassenger(veh, passenger), veh.GetBase().ToCreature().GetScriptId());
|
||||
}
|
||||
@@ -1043,7 +1042,7 @@ namespace Game.Scripting
|
||||
// DynamicObjectScript
|
||||
public void OnDynamicObjectUpdate(DynamicObject dynobj, uint diff)
|
||||
{
|
||||
Contract.Assert(dynobj != null);
|
||||
Cypher.Assert(dynobj != null);
|
||||
|
||||
ForEach<DynamicObjectScript>(p => p.OnUpdate(dynobj, diff));
|
||||
}
|
||||
@@ -1051,28 +1050,28 @@ namespace Game.Scripting
|
||||
// TransportScript
|
||||
public void OnAddPassenger(Transport transport, Player player)
|
||||
{
|
||||
Contract.Assert(transport != null);
|
||||
Contract.Assert(player != null);
|
||||
Cypher.Assert(transport != null);
|
||||
Cypher.Assert(player != null);
|
||||
|
||||
RunScript<TransportScript>(p => p.OnAddPassenger(transport, player), transport.GetScriptId());
|
||||
}
|
||||
public void OnAddCreaturePassenger(Transport transport, Creature creature)
|
||||
{
|
||||
Contract.Assert(transport != null);
|
||||
Contract.Assert(creature != null);
|
||||
Cypher.Assert(transport != null);
|
||||
Cypher.Assert(creature != null);
|
||||
|
||||
RunScript<TransportScript>(p => p.OnAddCreaturePassenger(transport, creature), transport.GetScriptId());
|
||||
}
|
||||
public void OnRemovePassenger(Transport transport, Player player)
|
||||
{
|
||||
Contract.Assert(transport != null);
|
||||
Contract.Assert(player != null);
|
||||
Cypher.Assert(transport != null);
|
||||
Cypher.Assert(player != null);
|
||||
|
||||
RunScript<TransportScript>(p => p.OnRemovePassenger(transport, player), transport.GetScriptId());
|
||||
}
|
||||
public void OnTransportUpdate(Transport transport, uint diff)
|
||||
{
|
||||
Contract.Assert(transport != null);
|
||||
Cypher.Assert(transport != null);
|
||||
|
||||
RunScript<TransportScript>(p => p.OnUpdate(transport, diff), transport.GetScriptId());
|
||||
}
|
||||
@@ -1084,7 +1083,7 @@ namespace Game.Scripting
|
||||
// AchievementCriteriaScript
|
||||
public bool OnCriteriaCheck(uint ScriptId, Player source, Unit target)
|
||||
{
|
||||
Contract.Assert(source != null);
|
||||
Cypher.Assert(source != null);
|
||||
// target can be NULL.
|
||||
|
||||
return RunScriptRet<AchievementCriteriaScript>(p => p.OnCheck(source, target), ScriptId);
|
||||
@@ -1261,27 +1260,27 @@ namespace Game.Scripting
|
||||
// GroupScript
|
||||
public void OnGroupAddMember(Group group, ObjectGuid guid)
|
||||
{
|
||||
Contract.Assert(group);
|
||||
Cypher.Assert(group);
|
||||
ForEach<GroupScript>(p => p.OnAddMember(group, guid));
|
||||
}
|
||||
public void OnGroupInviteMember(Group group, ObjectGuid guid)
|
||||
{
|
||||
Contract.Assert(group);
|
||||
Cypher.Assert(group);
|
||||
ForEach<GroupScript>(p => p.OnInviteMember(group, guid));
|
||||
}
|
||||
public void OnGroupRemoveMember(Group group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, string reason)
|
||||
{
|
||||
Contract.Assert(group);
|
||||
Cypher.Assert(group);
|
||||
ForEach<GroupScript>(p => p.OnRemoveMember(group, guid, method, kicker, reason));
|
||||
}
|
||||
public void OnGroupChangeLeader(Group group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
|
||||
{
|
||||
Contract.Assert(group);
|
||||
Cypher.Assert(group);
|
||||
ForEach<GroupScript>(p => p.OnChangeLeader(group, newLeaderGuid, oldLeaderGuid));
|
||||
}
|
||||
public void OnGroupDisband(Group group)
|
||||
{
|
||||
Contract.Assert(group);
|
||||
Cypher.Assert(group);
|
||||
ForEach<GroupScript>(p => p.OnDisband(group));
|
||||
}
|
||||
|
||||
@@ -1320,7 +1319,7 @@ namespace Game.Scripting
|
||||
// AreaTriggerEntityScript
|
||||
public AreaTriggerAI GetAreaTriggerAI(AreaTrigger areaTrigger)
|
||||
{
|
||||
Contract.Assert(areaTrigger);
|
||||
Cypher.Assert(areaTrigger);
|
||||
|
||||
return RunScriptRet<AreaTriggerEntityScript, AreaTriggerAI>(p => p.GetAI(areaTrigger), areaTrigger.GetScriptId(), null);
|
||||
}
|
||||
@@ -1328,7 +1327,7 @@ namespace Game.Scripting
|
||||
// ConversationScript
|
||||
public void OnConversationCreate(Conversation conversation, Unit creator)
|
||||
{
|
||||
Contract.Assert(conversation != null);
|
||||
Cypher.Assert(conversation != null);
|
||||
|
||||
RunScript<ConversationScript>(script => script.OnConversationCreate(conversation, creator), conversation.GetScriptId());
|
||||
}
|
||||
@@ -1336,29 +1335,29 @@ namespace Game.Scripting
|
||||
//SceneScript
|
||||
public void OnSceneStart(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(sceneTemplate != null);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(sceneTemplate != null);
|
||||
|
||||
RunScript<SceneScript>(script => script.OnSceneStart(player, sceneInstanceID, sceneTemplate), sceneTemplate.ScriptId);
|
||||
}
|
||||
public void OnSceneTrigger(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate, string triggerName)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(sceneTemplate != null);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(sceneTemplate != null);
|
||||
|
||||
RunScript<SceneScript>(script => script.OnSceneTriggerEvent(player, sceneInstanceID, sceneTemplate, triggerName), sceneTemplate.ScriptId);
|
||||
}
|
||||
public void OnSceneCancel(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(sceneTemplate != null);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(sceneTemplate != null);
|
||||
|
||||
RunScript<SceneScript>(script => script.OnSceneCancel(player, sceneInstanceID, sceneTemplate), sceneTemplate.ScriptId);
|
||||
}
|
||||
public void OnSceneComplete(Player player, uint sceneInstanceID, SceneTemplate sceneTemplate)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(sceneTemplate != null);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(sceneTemplate != null);
|
||||
|
||||
RunScript<SceneScript>(script => script.OnSceneComplete(player, sceneInstanceID, sceneTemplate), sceneTemplate.ScriptId);
|
||||
}
|
||||
@@ -1366,15 +1365,15 @@ namespace Game.Scripting
|
||||
//QuestScript
|
||||
public void OnQuestStatusChange(Player player, Quest quest, QuestStatus oldStatus, QuestStatus newStatus)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
RunScript<QuestScript>(script => script.OnQuestStatusChange(player, quest, oldStatus, newStatus), quest.ScriptId);
|
||||
}
|
||||
public void OnQuestObjectiveChange(Player player, Quest quest, QuestObjective objective, int oldAmount, int newAmount)
|
||||
{
|
||||
Contract.Assert(player);
|
||||
Contract.Assert(quest != null);
|
||||
Cypher.Assert(player);
|
||||
Cypher.Assert(quest != null);
|
||||
|
||||
RunScript<QuestScript>(script => script.OnQuestObjectiveChange(player, quest, objective, oldAmount, newAmount), quest.ScriptId);
|
||||
}
|
||||
@@ -1416,7 +1415,7 @@ namespace Game.Scripting
|
||||
}
|
||||
public void AddScript<T>(T script) where T : ScriptObject
|
||||
{
|
||||
Contract.Assert(script != null);
|
||||
Cypher.Assert(script != null);
|
||||
|
||||
if (!ScriptStorage.ContainsKey(typeof(T)))
|
||||
ScriptStorage[typeof(T)] = new ScriptRegistry<T>();
|
||||
@@ -1456,7 +1455,7 @@ namespace Game.Scripting
|
||||
{
|
||||
public void AddScript(TValue script)
|
||||
{
|
||||
Contract.Assert(script != null);
|
||||
Cypher.Assert(script != null);
|
||||
|
||||
if (!script.IsDatabaseBound())
|
||||
{
|
||||
@@ -1493,7 +1492,7 @@ namespace Game.Scripting
|
||||
// If the script is already assigned . delete it!
|
||||
Log.outError(LogFilter.Scripts, "Script '{0}' already assigned with the same script name, so the script can't work.", script.GetName());
|
||||
|
||||
Contract.Assert(false); // Error that should be fixed ASAP.
|
||||
Cypher.Assert(false); // Error that should be fixed ASAP.
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -31,7 +31,6 @@ using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game
|
||||
@@ -124,7 +123,7 @@ namespace Game
|
||||
|
||||
void AddSession_(WorldSession s)
|
||||
{
|
||||
Contract.Assert(s != null);
|
||||
Cypher.Assert(s != null);
|
||||
|
||||
//NOTE - Still there is race condition in WorldSession* being used in the Sockets
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ using Game.Network.Packets;
|
||||
using Game.Scripting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Spells
|
||||
@@ -75,7 +74,7 @@ namespace Game.Spells
|
||||
_effectsToApply = effMask;
|
||||
_needClientUpdate = false;
|
||||
|
||||
Contract.Assert(GetTarget() != null && GetBase() != null);
|
||||
Cypher.Assert(GetTarget() != null && GetBase() != null);
|
||||
|
||||
// Try find slot for aura
|
||||
byte slot = 0;
|
||||
@@ -165,20 +164,20 @@ namespace Game.Spells
|
||||
Log.outError(LogFilter.Spells, "Aura {0} has no effect at effectIndex {1} but _HandleEffect was called", GetBase().GetSpellInfo().Id, effIndex);
|
||||
return;
|
||||
}
|
||||
Contract.Assert(aurEff != null);
|
||||
Contract.Assert(HasEffect(effIndex) == (!apply));
|
||||
Contract.Assert(Convert.ToBoolean((1 << (int)effIndex) & _effectsToApply));
|
||||
Cypher.Assert(aurEff != null);
|
||||
Cypher.Assert(HasEffect(effIndex) == (!apply));
|
||||
Cypher.Assert(Convert.ToBoolean((1 << (int)effIndex) & _effectsToApply));
|
||||
Log.outDebug(LogFilter.Spells, "AuraApplication._HandleEffect: {0}, apply: {1}: amount: {2}", aurEff.GetAuraType(), apply, aurEff.GetAmount());
|
||||
|
||||
if (apply)
|
||||
{
|
||||
Contract.Assert(!Convert.ToBoolean(_effectMask & (1 << (int)effIndex)));
|
||||
Cypher.Assert(!Convert.ToBoolean(_effectMask & (1 << (int)effIndex)));
|
||||
_effectMask |= (uint)(1 << (int)effIndex);
|
||||
aurEff.HandleEffect(this, AuraEffectHandleModes.Real, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Contract.Assert(Convert.ToBoolean(_effectMask & (1 << (int)effIndex)));
|
||||
Cypher.Assert(Convert.ToBoolean(_effectMask & (1 << (int)effIndex)));
|
||||
_effectMask &= ~(uint)(1 << (int)effIndex);
|
||||
aurEff.HandleEffect(this, AuraEffectHandleModes.Real, false);
|
||||
}
|
||||
@@ -196,7 +195,7 @@ namespace Game.Spells
|
||||
|
||||
public void BuildUpdatePacket(ref AuraInfo auraInfo, bool remove)
|
||||
{
|
||||
Contract.Assert(_target.HasVisibleAura(this) != remove);
|
||||
Cypher.Assert(_target.HasVisibleAura(this) != remove);
|
||||
|
||||
auraInfo.Slot = GetSlot();
|
||||
if (remove)
|
||||
@@ -264,7 +263,7 @@ namespace Game.Spells
|
||||
public uint GetEffectMask() { return _effectMask; }
|
||||
public bool HasEffect(uint effect)
|
||||
{
|
||||
Contract.Assert(effect < SpellConst.MaxEffects);
|
||||
Cypher.Assert(effect < SpellConst.MaxEffects);
|
||||
return Convert.ToBoolean(_effectMask & (1 << (int)effect));
|
||||
}
|
||||
public bool IsPositive() { return _flags.HasAnyFlag(AuraFlags.Positive); }
|
||||
@@ -363,10 +362,10 @@ namespace Game.Spells
|
||||
|
||||
public virtual void _ApplyForTarget(Unit target, Unit caster, AuraApplication auraApp)
|
||||
{
|
||||
Contract.Assert(target != null);
|
||||
Contract.Assert(auraApp != null);
|
||||
Cypher.Assert(target != null);
|
||||
Cypher.Assert(auraApp != null);
|
||||
// aura mustn't be already applied on target
|
||||
//Contract.Assert(!IsAppliedOnTarget(target.GetGUID()) && "Aura._ApplyForTarget: aura musn't be already applied on target");
|
||||
//Cypher.Assert(!IsAppliedOnTarget(target.GetGUID()) && "Aura._ApplyForTarget: aura musn't be already applied on target");
|
||||
|
||||
m_applications[target.GetGUID()] = auraApp;
|
||||
|
||||
@@ -382,9 +381,9 @@ namespace Game.Spells
|
||||
}
|
||||
public virtual void _UnapplyForTarget(Unit target, Unit caster, AuraApplication auraApp)
|
||||
{
|
||||
Contract.Assert(target != null);
|
||||
Contract.Assert(auraApp.HasRemoveMode());
|
||||
Contract.Assert(auraApp != null);
|
||||
Cypher.Assert(target != null);
|
||||
Cypher.Assert(auraApp.HasRemoveMode());
|
||||
Cypher.Assert(auraApp != null);
|
||||
|
||||
var app = m_applications.LookupByKey(target.GetGUID());
|
||||
|
||||
@@ -393,11 +392,11 @@ namespace Game.Spells
|
||||
{
|
||||
Log.outError(LogFilter.Spells, "Aura._UnapplyForTarget, target: {0}, caster: {1}, spell: {2} was not found in owners application map!",
|
||||
target.GetGUID().ToString(), caster ? caster.GetGUID().ToString() : "", auraApp.GetBase().GetSpellInfo().Id);
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
|
||||
// aura has to be already applied
|
||||
Contract.Assert(app == auraApp);
|
||||
Cypher.Assert(app == auraApp);
|
||||
m_applications.Remove(target.GetGUID());
|
||||
|
||||
m_removedApplications.Add(auraApp);
|
||||
@@ -412,7 +411,7 @@ namespace Game.Spells
|
||||
// and marks aura as removed
|
||||
public void _Remove(AuraRemoveMode removeMode)
|
||||
{
|
||||
Contract.Assert(!m_isRemoved);
|
||||
Cypher.Assert(!m_isRemoved);
|
||||
m_isRemoved = true;
|
||||
foreach (var pair in m_applications.ToList())
|
||||
{
|
||||
@@ -482,7 +481,7 @@ namespace Game.Spells
|
||||
else
|
||||
{
|
||||
// ok, we have one unit twice in target map (impossible, but...)
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,7 +563,7 @@ namespace Game.Spells
|
||||
if (aurApp != null)
|
||||
{
|
||||
// owner has to be in world, or effect has to be applied to self
|
||||
Contract.Assert((!m_owner.IsInWorld && m_owner == pair.Key) || m_owner.IsInMap(pair.Key));
|
||||
Cypher.Assert((!m_owner.IsInWorld && m_owner == pair.Key) || m_owner.IsInMap(pair.Key));
|
||||
pair.Key._ApplyAura(aurApp, pair.Value);
|
||||
}
|
||||
}
|
||||
@@ -587,7 +586,7 @@ namespace Game.Spells
|
||||
if (GetApplicationOfTarget(unit.GetGUID()) != null)
|
||||
{
|
||||
// owner has to be in world, or effect has to be applied to self
|
||||
Contract.Assert((!GetOwner().IsInWorld && GetOwner() == unit) || GetOwner().IsInMap(unit));
|
||||
Cypher.Assert((!GetOwner().IsInWorld && GetOwner() == unit) || GetOwner().IsInMap(unit));
|
||||
unit._ApplyAuraEffect(this, effIndex);
|
||||
}
|
||||
}
|
||||
@@ -595,7 +594,7 @@ namespace Game.Spells
|
||||
|
||||
public void UpdateOwner(uint diff, WorldObject owner)
|
||||
{
|
||||
Contract.Assert(owner == m_owner);
|
||||
Cypher.Assert(owner == m_owner);
|
||||
|
||||
Unit caster = GetCaster();
|
||||
// Apply spellmods for channeled auras
|
||||
@@ -994,9 +993,9 @@ namespace Game.Spells
|
||||
|
||||
public void UnregisterSingleTarget()
|
||||
{
|
||||
Contract.Assert(m_isSingleTarget);
|
||||
Cypher.Assert(m_isSingleTarget);
|
||||
Unit caster = GetCaster();
|
||||
Contract.Assert(caster != null);
|
||||
Cypher.Assert(caster != null);
|
||||
caster.GetSingleCastAuras().Remove(this);
|
||||
SetIsSingleTarget(false);
|
||||
}
|
||||
@@ -1076,7 +1075,7 @@ namespace Game.Spells
|
||||
|
||||
public void RecalculateAmountOfEffects()
|
||||
{
|
||||
Contract.Assert(!IsRemoved());
|
||||
Cypher.Assert(!IsRemoved());
|
||||
Unit caster = GetCaster();
|
||||
foreach (AuraEffect effect in GetAuraEffects())
|
||||
if (effect != null && !IsRemoved())
|
||||
@@ -1085,7 +1084,7 @@ namespace Game.Spells
|
||||
|
||||
public void HandleAllEffects(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||
{
|
||||
Contract.Assert(!IsRemoved());
|
||||
Cypher.Assert(!IsRemoved());
|
||||
foreach (AuraEffect effect in GetAuraEffects())
|
||||
if (effect != null && !IsRemoved())
|
||||
effect.HandleEffect(aurApp, mode, apply);
|
||||
@@ -1625,7 +1624,7 @@ namespace Game.Spells
|
||||
|
||||
SpellProcEntry procEntry = Global.SpellMgr.GetSpellProcEntry(GetId());
|
||||
|
||||
Contract.Assert(procEntry != null);
|
||||
Cypher.Assert(procEntry != null);
|
||||
|
||||
// cooldowns should be added to the whole aura (see 51698 area aura)
|
||||
AddProcCooldown(now + TimeSpan.FromMilliseconds(procEntry.Cooldown));
|
||||
@@ -2227,12 +2226,12 @@ namespace Game.Spells
|
||||
public WorldObject GetOwner() { return m_owner; }
|
||||
public Unit GetUnitOwner()
|
||||
{
|
||||
Contract.Assert(GetAuraType() == AuraObjectType.Unit);
|
||||
Cypher.Assert(GetAuraType() == AuraObjectType.Unit);
|
||||
return m_owner.ToUnit();
|
||||
}
|
||||
public DynamicObject GetDynobjOwner()
|
||||
{
|
||||
Contract.Assert(GetAuraType() == AuraObjectType.DynObj);
|
||||
Cypher.Assert(GetAuraType() == AuraObjectType.DynObj);
|
||||
return m_owner.ToDynamicObject();
|
||||
}
|
||||
|
||||
@@ -2345,8 +2344,8 @@ namespace Game.Spells
|
||||
//Static Methods
|
||||
public static uint BuildEffectMaskForOwner(SpellInfo spellProto, uint availableEffectMask, WorldObject owner)
|
||||
{
|
||||
Contract.Assert(spellProto != null);
|
||||
Contract.Assert(owner != null);
|
||||
Cypher.Assert(spellProto != null);
|
||||
Cypher.Assert(owner != null);
|
||||
uint effMask = 0;
|
||||
switch (owner.GetTypeId())
|
||||
{
|
||||
@@ -2377,10 +2376,10 @@ namespace Game.Spells
|
||||
}
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, out bool refresh, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
|
||||
{
|
||||
Contract.Assert(spellproto != null);
|
||||
Contract.Assert(owner != null);
|
||||
Contract.Assert(caster || !casterGUID.IsEmpty());
|
||||
Contract.Assert(tryEffMask <= SpellConst.MaxEffectMask);
|
||||
Cypher.Assert(spellproto != null);
|
||||
Cypher.Assert(owner != null);
|
||||
Cypher.Assert(caster || !casterGUID.IsEmpty());
|
||||
Cypher.Assert(tryEffMask <= SpellConst.MaxEffectMask);
|
||||
refresh = false;
|
||||
|
||||
uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
|
||||
@@ -2402,10 +2401,10 @@ namespace Game.Spells
|
||||
}
|
||||
public static Aura TryCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
|
||||
{
|
||||
Contract.Assert(spellproto != null);
|
||||
Contract.Assert(owner != null);
|
||||
Contract.Assert(caster != null || !casterGUID.IsEmpty());
|
||||
Contract.Assert(tryEffMask <= SpellConst.MaxEffectMask);
|
||||
Cypher.Assert(spellproto != null);
|
||||
Cypher.Assert(owner != null);
|
||||
Cypher.Assert(caster != null || !casterGUID.IsEmpty());
|
||||
Cypher.Assert(tryEffMask <= SpellConst.MaxEffectMask);
|
||||
uint effMask = BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
|
||||
if (effMask == 0)
|
||||
return null;
|
||||
@@ -2413,11 +2412,11 @@ namespace Game.Spells
|
||||
}
|
||||
public static Aura Create(SpellInfo spellproto, ObjectGuid castId, uint effMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem, ObjectGuid casterGUID, ObjectGuid castItemGuid, int castItemLevel)
|
||||
{
|
||||
Contract.Assert(effMask != 0);
|
||||
Contract.Assert(spellproto != null);
|
||||
Contract.Assert(owner != null);
|
||||
Contract.Assert(caster != null || !casterGUID.IsEmpty());
|
||||
Contract.Assert(effMask <= SpellConst.MaxEffectMask);
|
||||
Cypher.Assert(effMask != 0);
|
||||
Cypher.Assert(spellproto != null);
|
||||
Cypher.Assert(owner != null);
|
||||
Cypher.Assert(caster != null || !casterGUID.IsEmpty());
|
||||
Cypher.Assert(effMask <= SpellConst.MaxEffectMask);
|
||||
// try to get caster of aura
|
||||
if (!casterGUID.IsEmpty())
|
||||
{
|
||||
@@ -2447,7 +2446,7 @@ namespace Game.Spells
|
||||
aura = new DynObjAura(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemLevel);
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
return null;
|
||||
}
|
||||
// aura can be removed in Unit:_AddAura call
|
||||
@@ -2613,9 +2612,9 @@ namespace Game.Spells
|
||||
: base(spellproto, castId, owner, caster, castItem, casterGUID, castItemGuid, castItemLevel)
|
||||
{
|
||||
LoadScripts();
|
||||
Contract.Assert(GetDynobjOwner() != null);
|
||||
Contract.Assert(GetDynobjOwner().IsInWorld);
|
||||
Contract.Assert(GetDynobjOwner().GetMap() == caster.GetMap());
|
||||
Cypher.Assert(GetDynobjOwner() != null);
|
||||
Cypher.Assert(GetDynobjOwner().IsInWorld);
|
||||
Cypher.Assert(GetDynobjOwner().GetMap() == caster.GetMap());
|
||||
_InitEffects(effMask, caster, baseAmount);
|
||||
GetDynobjOwner().SetAura(this);
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ using Game.Maps;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Spells
|
||||
@@ -305,7 +304,7 @@ namespace Game.Spells
|
||||
public void HandleEffect(AuraApplication aurApp, AuraEffectHandleModes mode, bool apply)
|
||||
{
|
||||
// check if call is correct, we really don't want using bitmasks here (with 1 exception)
|
||||
Contract.Assert(mode == AuraEffectHandleModes.Real || mode == AuraEffectHandleModes.SendForClient
|
||||
Cypher.Assert(mode == AuraEffectHandleModes.Real || mode == AuraEffectHandleModes.SendForClient
|
||||
|| mode == AuraEffectHandleModes.ChangeAmount || mode == AuraEffectHandleModes.Stat
|
||||
|| mode == AuraEffectHandleModes.Skill || mode == AuraEffectHandleModes.Reapply
|
||||
|| mode == (AuraEffectHandleModes.ChangeAmount | AuraEffectHandleModes.Reapply));
|
||||
@@ -345,7 +344,7 @@ namespace Game.Spells
|
||||
public void HandleEffect(Unit target, AuraEffectHandleModes mode, bool apply)
|
||||
{
|
||||
AuraApplication aurApp = GetBase().GetApplicationOfTarget(target.GetGUID());
|
||||
Contract.Assert(aurApp != null);
|
||||
Cypher.Assert(aurApp != null);
|
||||
HandleEffect(aurApp, mode, apply);
|
||||
}
|
||||
|
||||
@@ -578,7 +577,7 @@ namespace Game.Spells
|
||||
|
||||
bool CanPeriodicTickCrit(Unit caster)
|
||||
{
|
||||
Contract.Assert(caster);
|
||||
Cypher.Assert(caster);
|
||||
|
||||
return caster.HasAuraTypeWithAffectMask(AuraType.AbilityPeriodicCrit, m_spellInfo);
|
||||
}
|
||||
|
||||
+20
-20
@@ -29,7 +29,6 @@ using Game.Network.Packets;
|
||||
using Game.Scripting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Game.AI;
|
||||
@@ -124,7 +123,7 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
if (m_caster && m_caster.GetTypeId() == TypeId.Player)
|
||||
Contract.Assert(m_caster.ToPlayer().m_spellModTakingSpell != this);
|
||||
Cypher.Assert(m_caster.ToPlayer().m_spellModTakingSpell != this);
|
||||
}
|
||||
|
||||
void InitExplicitTargets(SpellCastTargets targets)
|
||||
@@ -282,8 +281,9 @@ namespace Game.Spells
|
||||
else if (m_auraScaleMask != 0)
|
||||
{
|
||||
bool checkLvl = !m_UniqueTargetInfo.Empty();
|
||||
foreach (var ihit in m_UniqueTargetInfo)
|
||||
for (var i = 0; i < m_UniqueTargetInfo.Count; ++i)
|
||||
{
|
||||
var ihit = m_UniqueTargetInfo[i];
|
||||
// remove targets which did not pass min level check
|
||||
if (m_auraScaleMask != 0 && ihit.effectMask == m_auraScaleMask)
|
||||
{
|
||||
@@ -388,7 +388,7 @@ namespace Game.Spells
|
||||
m_targets.SetSrc(m_caster);
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_SRC");
|
||||
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_SRC");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -405,7 +405,7 @@ namespace Game.Spells
|
||||
SelectImplicitDestDestTargets(effIndex, targetType);
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
|
||||
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT_DEST");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -419,7 +419,7 @@ namespace Game.Spells
|
||||
SelectImplicitTargetObjectTargets(effIndex, targetType);
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT");
|
||||
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target reference type for TARGET_TYPE_OBJECT");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -429,7 +429,7 @@ namespace Game.Spells
|
||||
Log.outDebug(LogFilter.Spells, "SPELL: target type {0}, found in spellID {1}, effect {2} is not implemented yet!", m_spellInfo.Id, effIndex, targetType.GetTarget());
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target category");
|
||||
Cypher.Assert(false, "Spell.SelectEffectImplicitTargets: received not implemented select target category");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -438,7 +438,7 @@ namespace Game.Spells
|
||||
{
|
||||
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
|
||||
{
|
||||
Contract.Assert(false, "Spell.SelectImplicitChannelTargets: received not implemented target reference type");
|
||||
Cypher.Assert(false, "Spell.SelectImplicitChannelTargets: received not implemented target reference type");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ namespace Game.Spells
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectImplicitChannelTargets: received not implemented target type");
|
||||
Cypher.Assert(false, "Spell.SelectImplicitChannelTargets: received not implemented target type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -507,7 +507,7 @@ namespace Game.Spells
|
||||
{
|
||||
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
|
||||
{
|
||||
Contract.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented target reference type");
|
||||
Cypher.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented target reference type");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -532,7 +532,7 @@ namespace Game.Spells
|
||||
range = m_spellInfo.GetMaxRange(m_spellInfo.IsPositive(), m_caster, this);
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented selection check type");
|
||||
Cypher.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented selection check type");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -629,7 +629,7 @@ namespace Game.Spells
|
||||
m_targets.SetDst(dest);
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented target object type");
|
||||
Cypher.Assert(false, "Spell.SelectImplicitNearbyTargets: received not implemented target object type");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ namespace Game.Spells
|
||||
{
|
||||
if (targetType.GetReferenceType() != SpellTargetReferenceTypes.Caster)
|
||||
{
|
||||
Contract.Assert(false, "Spell.SelectImplicitConeTargets: received not implemented target reference type");
|
||||
Cypher.Assert(false, "Spell.SelectImplicitConeTargets: received not implemented target reference type");
|
||||
return;
|
||||
}
|
||||
List<WorldObject> targets = new List<WorldObject>();
|
||||
@@ -709,7 +709,7 @@ namespace Game.Spells
|
||||
break;
|
||||
}
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
|
||||
Cypher.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
|
||||
return;
|
||||
}
|
||||
if (referer == null)
|
||||
@@ -730,7 +730,7 @@ namespace Game.Spells
|
||||
center = referer.GetPosition();
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
|
||||
Cypher.Assert(false, "Spell.SelectImplicitAreaTargets: received not implemented target reference type");
|
||||
return;
|
||||
}
|
||||
List<WorldObject> targets = new List<WorldObject>();
|
||||
@@ -2182,7 +2182,7 @@ namespace Game.Spells
|
||||
if (scaleAura)
|
||||
{
|
||||
aurSpellInfo = m_spellInfo.GetAuraRankForLevel(unitTarget.getLevel());
|
||||
Contract.Assert(aurSpellInfo != null);
|
||||
Cypher.Assert(aurSpellInfo != null);
|
||||
foreach (SpellEffectInfo effect in aurSpellInfo.GetEffectsForDifficulty(0))
|
||||
{
|
||||
if (effect == null)
|
||||
@@ -3507,7 +3507,7 @@ namespace Game.Spells
|
||||
}
|
||||
case SpellCastResult.CantUntalent:
|
||||
{
|
||||
Contract.Assert(param1.HasValue);
|
||||
Cypher.Assert(param1.HasValue);
|
||||
packet.FailedArg1 = (int)param1;
|
||||
break;
|
||||
}
|
||||
@@ -6844,7 +6844,7 @@ namespace Game.Spells
|
||||
hookType = SpellScriptHookType.EffectHitTarget;
|
||||
break;
|
||||
default:
|
||||
Contract.Assert(false);
|
||||
Cypher.Assert(false);
|
||||
return false;
|
||||
}
|
||||
script._PrepareScriptCall(hookType);
|
||||
@@ -7528,7 +7528,7 @@ namespace Game.Spells
|
||||
public SpellValue(Difficulty difficulty, SpellInfo proto)
|
||||
{
|
||||
var effects = proto.GetEffectsForDifficulty(difficulty);
|
||||
Contract.Assert(effects.Length <= SpellConst.MaxEffects);
|
||||
Cypher.Assert(effects.Length <= SpellConst.MaxEffects);
|
||||
foreach (SpellEffectInfo effect in effects)
|
||||
if (effect != null)
|
||||
EffectBasePoints[effect.EffectIndex] = effect.BasePoints;
|
||||
@@ -7795,7 +7795,7 @@ namespace Game.Spells
|
||||
if (!m_Spell.m_targets.HasDst())
|
||||
{
|
||||
ulong n_offset = m_Spell.handle_delayed(0);
|
||||
Contract.Assert(n_offset == m_Spell.GetDelayMoment());
|
||||
Cypher.Assert(n_offset == m_Spell.GetDelayMoment());
|
||||
}
|
||||
// re-plan the event for the delay moment
|
||||
m_Spell.GetCaster().m_Events.AddEvent(this, e_time + m_Spell.GetDelayMoment(), false);
|
||||
|
||||
@@ -19,7 +19,6 @@ using Framework.Constants;
|
||||
using Game.Entities;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Game.Spells
|
||||
{
|
||||
@@ -280,7 +279,7 @@ namespace Game.Spells
|
||||
|
||||
public void ModSrc(Position pos)
|
||||
{
|
||||
Contract.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation));
|
||||
Cypher.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.SourceLocation));
|
||||
m_src.Relocate(pos);
|
||||
}
|
||||
|
||||
@@ -331,13 +330,13 @@ namespace Game.Spells
|
||||
|
||||
public void ModDst(Position pos)
|
||||
{
|
||||
Contract.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.DestLocation));
|
||||
Cypher.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.DestLocation));
|
||||
m_dst.Relocate(pos);
|
||||
}
|
||||
|
||||
public void ModDst(SpellDestination spellDest)
|
||||
{
|
||||
Contract.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.DestLocation));
|
||||
Cypher.Assert(m_targetMask.HasAnyFlag(SpellCastTargetFlags.DestLocation));
|
||||
m_dst = spellDest;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@ using Game.Movement;
|
||||
using Game.Network.Packets;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using System.Linq;
|
||||
|
||||
namespace Game.Spells
|
||||
@@ -770,7 +769,7 @@ namespace Game.Spells
|
||||
if (m_spellAura == null || unitTarget == null)
|
||||
return;
|
||||
|
||||
Contract.Assert(unitTarget == m_spellAura.GetOwner());
|
||||
Cypher.Assert(unitTarget == m_spellAura.GetOwner());
|
||||
m_spellAura._ApplyEffectForTargets(effIndex);
|
||||
}
|
||||
|
||||
@@ -787,7 +786,7 @@ namespace Game.Spells
|
||||
|
||||
if (m_spellAura == null || unitTarget == null)
|
||||
return;
|
||||
Contract.Assert(unitTarget == m_spellAura.GetOwner());
|
||||
Cypher.Assert(unitTarget == m_spellAura.GetOwner());
|
||||
m_spellAura._ApplyEffectForTargets(effIndex);
|
||||
}
|
||||
|
||||
@@ -1253,7 +1252,7 @@ namespace Game.Spells
|
||||
return;
|
||||
}
|
||||
|
||||
Contract.Assert(m_spellAura.GetDynobjOwner());
|
||||
Cypher.Assert(m_spellAura.GetDynobjOwner());
|
||||
m_spellAura._ApplyEffectForTargets(effIndex);
|
||||
}
|
||||
|
||||
@@ -2436,7 +2435,7 @@ namespace Game.Spells
|
||||
if (OldSummon.IsDead())
|
||||
return;
|
||||
|
||||
Contract.Assert(OldSummon.GetMap() == owner.GetMap());
|
||||
Cypher.Assert(OldSummon.GetMap() == owner.GetMap());
|
||||
|
||||
float px, py, pz;
|
||||
owner.GetClosePoint(out px, out py, out pz, OldSummon.GetObjectSize());
|
||||
|
||||
@@ -1956,11 +1956,11 @@ namespace Game.Entities
|
||||
Dictionary<uint, MultiMap<uint, SpellXSpellVisualRecord>> visualsBySpell = new Dictionary<uint, MultiMap<uint, SpellXSpellVisualRecord>>();
|
||||
foreach (var effect in CliDB.SpellEffectStorage.Values)
|
||||
{
|
||||
/*Contract.Assert(effect.EffectIndex < MAX_SPELL_EFFECTS, "MAX_SPELL_EFFECTS must be at least {0}", effect.EffectIndex);
|
||||
Contract.Assert(effect.Effect < TOTAL_SPELL_EFFECTS, "TOTAL_SPELL_EFFECTS must be at least {0}", effect.Effect);
|
||||
Contract.Assert(effect.EffectAura < TOTAL_AURAS, "TOTAL_AURAS must be at least {0}", effect.EffectAura);
|
||||
Contract.Assert(effect.ImplicitTarget[0] < TOTAL_SPELL_TARGETS, "TOTAL_SPELL_TARGETS must be at least {0}", effect.ImplicitTarget[0]);
|
||||
Contract.Assert(effect.ImplicitTarget[1] < TOTAL_SPELL_TARGETS, "TOTAL_SPELL_TARGETS must be at least {0}", effect.ImplicitTarget[1]);*/
|
||||
Cypher.Assert(effect.EffectIndex < SpellConst.MaxEffects, $"MAX_SPELL_EFFECTS must be at least {effect.EffectIndex}");
|
||||
Cypher.Assert(effect.Effect < (int)SpellEffectName.TotalSpellEffects, $"TOTAL_SPELL_EFFECTS must be at least {effect.Effect}");
|
||||
Cypher.Assert(effect.EffectAura < (int)AuraType.Total, $"TOTAL_AURAS must be at least {effect.EffectAura}");
|
||||
Cypher.Assert(effect.ImplicitTarget[0] < (int)Targets.TotalSpellTargets, $"TOTAL_SPELL_TARGETS must be at least {effect.ImplicitTarget[0]}");
|
||||
Cypher.Assert(effect.ImplicitTarget[1] < (int)Targets.TotalSpellTargets, $"TOTAL_SPELL_TARGETS must be at least {effect.ImplicitTarget[1]}");
|
||||
|
||||
if (!effectsBySpell.ContainsKey(effect.SpellID))
|
||||
effectsBySpell[effect.SpellID] = new Dictionary<uint, SpellEffectRecord[]>();
|
||||
|
||||
@@ -24,7 +24,6 @@ using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Scripts.Northrend.IcecrownCitadel
|
||||
{
|
||||
@@ -398,11 +397,10 @@ namespace Scripts.Northrend.IcecrownCitadel
|
||||
[Script]
|
||||
class npc_bone_spike : ScriptedAI
|
||||
{
|
||||
public npc_bone_spike(Creature creature)
|
||||
: base(creature)
|
||||
public npc_bone_spike(Creature creature) : base(creature)
|
||||
{
|
||||
_hasTrappedUnit = false;
|
||||
Contract.Assert(creature.GetVehicleKit());
|
||||
Cypher.Assert(creature.GetVehicleKit());
|
||||
|
||||
SetCombatMovement(false);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ using Game.Scripting;
|
||||
using Game.Spells;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
namespace Scripts.Northrend.Ulduar.FlameLeviathan
|
||||
{
|
||||
@@ -217,7 +216,7 @@ namespace Scripts.Northrend.Ulduar.FlameLeviathan
|
||||
|
||||
public override void InitializeAI()
|
||||
{
|
||||
Contract.Assert(vehicle);
|
||||
Cypher.Assert(vehicle);
|
||||
if (!me.IsDead())
|
||||
Reset();
|
||||
|
||||
@@ -558,7 +557,7 @@ namespace Scripts.Northrend.Ulduar.FlameLeviathan
|
||||
: base(creature)
|
||||
{
|
||||
vehicle = creature.GetVehicleKit();
|
||||
Contract.Assert(vehicle);
|
||||
Cypher.Assert(vehicle);
|
||||
me.SetReactState(ReactStates.Passive);
|
||||
me.SetDisplayId(me.GetCreatureTemplate().ModelId2);
|
||||
instance = creature.GetInstanceScript();
|
||||
@@ -736,7 +735,7 @@ namespace Scripts.Northrend.Ulduar.FlameLeviathan
|
||||
{
|
||||
public npc_mechanolift(Creature creature) : base(creature)
|
||||
{
|
||||
Contract.Assert(me.GetVehicleKit());
|
||||
Cypher.Assert(me.GetVehicleKit());
|
||||
}
|
||||
|
||||
uint MoveTimer;
|
||||
|
||||
@@ -22,6 +22,7 @@ using Game;
|
||||
using Game.Chat;
|
||||
using Game.Network;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
|
||||
@@ -39,7 +40,7 @@ namespace WorldServer
|
||||
|
||||
Console.CancelKeyPress += (o, e) => Global.WorldMgr.StopNow(ShutdownExitCode.Shutdown);
|
||||
|
||||
if (!ConfigMgr.Load(System.Diagnostics.Process.GetCurrentProcess().ProcessName + ".conf"))
|
||||
if (!ConfigMgr.Load(Process.GetCurrentProcess().ProcessName + ".conf"))
|
||||
ExitNow();
|
||||
|
||||
if (!StartDB())
|
||||
|
||||
Reference in New Issue
Block a user