Core/Phases: Fixes errors in phases.
This commit is contained in:
@@ -21,7 +21,6 @@ using Game.DataStorage;
|
|||||||
using Game.Loots;
|
using Game.Loots;
|
||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.Contracts;
|
|
||||||
|
|
||||||
namespace Game.Entities
|
namespace Game.Entities
|
||||||
{
|
{
|
||||||
@@ -66,7 +65,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool Create(ulong guidlow, Player owner)
|
public bool Create(ulong guidlow, Player owner)
|
||||||
{
|
{
|
||||||
Contract.Assert(owner != null);
|
Cypher.Assert(owner != null);
|
||||||
|
|
||||||
Relocate(owner.GetPositionX(), owner.GetPositionY(), owner.GetPositionZ(), owner.GetOrientation());
|
Relocate(owner.GetPositionX(), owner.GetPositionY(), owner.GetPositionZ(), owner.GetOrientation());
|
||||||
|
|
||||||
@@ -114,12 +113,12 @@ namespace Game.Entities
|
|||||||
stmt.AddValue(index++, GetInstanceId()); // instanceId
|
stmt.AddValue(index++, GetInstanceId()); // instanceId
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
|
|
||||||
foreach (PhaseRef phase in GetPhaseShift().GetPhases())
|
foreach (var phaseId in GetPhaseShift().GetPhases().Keys)
|
||||||
{
|
{
|
||||||
index = 0;
|
index = 0;
|
||||||
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CORPSE_PHASES);
|
stmt = DB.Characters.GetPreparedStatement(CharStatements.INS_CORPSE_PHASES);
|
||||||
stmt.AddValue(index++, GetOwnerGUID().GetCounter()); // OwnerGuid
|
stmt.AddValue(index++, GetOwnerGUID().GetCounter()); // OwnerGuid
|
||||||
stmt.AddValue(index++, phase.Id); // PhaseId
|
stmt.AddValue(index++, phaseId); // PhaseId
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ using Game.Scenarios;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.Contracts;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -63,9 +62,8 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
if (IsTypeId(TypeId.Corpse))
|
if (IsTypeId(TypeId.Corpse))
|
||||||
{
|
{
|
||||||
Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() Corpse Type: {0} ({1}) deleted but still in map!!",
|
Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() Corpse Type: {0} ({1}) deleted but still in map!!", ToCorpse().GetCorpseType(), GetGUID().ToString());
|
||||||
ToCorpse().GetCorpseType(), GetGUID().ToString());
|
Cypher.Assert(false);
|
||||||
Contract.Assert(false);
|
|
||||||
}
|
}
|
||||||
ResetMap();
|
ResetMap();
|
||||||
}
|
}
|
||||||
@@ -75,13 +73,13 @@ namespace Game.Entities
|
|||||||
Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() {0} deleted but still in world!!", GetGUID().ToString());
|
Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() {0} deleted but still in world!!", GetGUID().ToString());
|
||||||
if (isTypeMask(TypeMask.Item))
|
if (isTypeMask(TypeMask.Item))
|
||||||
Log.outFatal(LogFilter.Misc, "Item slot {0}", ((Item)this).GetSlot());
|
Log.outFatal(LogFilter.Misc, "Item slot {0}", ((Item)this).GetSlot());
|
||||||
Contract.Assert(false);
|
Cypher.Assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_objectUpdated)
|
if (m_objectUpdated)
|
||||||
{
|
{
|
||||||
Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() {0} deleted but still in update list!!", GetGUID().ToString());
|
Log.outFatal(LogFilter.Misc, "WorldObject.Dispose() {0} deleted but still in update list!!", GetGUID().ToString());
|
||||||
Contract.Assert(false);
|
Cypher.Assert(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,45 +263,45 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public int GetInt32Value(object index)
|
public int GetInt32Value(object index)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
||||||
return updateValues[(int)index].SignedValue;
|
return updateValues[(int)index].SignedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetUInt32Value(object index)
|
public uint GetUInt32Value(object index)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
||||||
return updateValues[(int)index].UnsignedValue;
|
return updateValues[(int)index].UnsignedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ulong GetUInt64Value(object index)
|
public ulong GetUInt64Value(object index)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index + 1 < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index + 1 < valuesCount || PrintIndexError(index, false));
|
||||||
return ((ulong)updateValues[(int)index + 1].UnsignedValue << 32 | updateValues[(int)index].UnsignedValue);
|
return ((ulong)updateValues[(int)index + 1].UnsignedValue << 32 | updateValues[(int)index].UnsignedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetFloatValue(object index)
|
public float GetFloatValue(object index)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
||||||
return updateValues[(int)index].FloatValue;
|
return updateValues[(int)index].FloatValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte GetByteValue(object index, byte offset)
|
public byte GetByteValue(object index, byte offset)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
||||||
Contract.Assert(offset < 4);
|
Cypher.Assert(offset < 4);
|
||||||
return (byte)((updateValues[(int)index].UnsignedValue >> (offset * 8)) & 0xFF);
|
return (byte)((updateValues[(int)index].UnsignedValue >> (offset * 8)) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ushort GetUInt16Value(object index, byte offset)
|
public ushort GetUInt16Value(object index, byte offset)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
||||||
Contract.Assert(offset < 2);
|
Cypher.Assert(offset < 2);
|
||||||
return (ushort)((updateValues[(int)index].UnsignedValue >> (offset * 16)) & 0xFFFF);
|
return (ushort)((updateValues[(int)index].UnsignedValue >> (offset * 16)) & 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectGuid GetGuidValue(object index)
|
public ObjectGuid GetGuidValue(object index)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index + 3 < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index + 3 < valuesCount || PrintIndexError(index, false));
|
||||||
return new ObjectGuid(GetUInt64Value((int)index + 2), GetUInt64Value(index));
|
return new ObjectGuid(GetUInt64Value((int)index + 2), GetUInt64Value(index));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -976,7 +974,7 @@ namespace Game.Entities
|
|||||||
flags = UpdateFieldFlags.ConversationUpdateFieldFlags;
|
flags = UpdateFieldFlags.ConversationUpdateFieldFlags;
|
||||||
break;
|
break;
|
||||||
case TypeId.Object:
|
case TypeId.Object:
|
||||||
Contract.Assert(false);
|
Cypher.Assert(false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return visibleFlag;
|
return visibleFlag;
|
||||||
@@ -1051,7 +1049,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetInt32Value(object index, int value)
|
public void SetInt32Value(object index, int value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
if (updateValues[(int)index].SignedValue != value)
|
if (updateValues[(int)index].SignedValue != value)
|
||||||
{
|
{
|
||||||
@@ -1065,7 +1063,7 @@ namespace Game.Entities
|
|||||||
public void SetUInt32Value(object index, uint value)
|
public void SetUInt32Value(object index, uint value)
|
||||||
{
|
{
|
||||||
int _index = Convert.ToInt32(index);
|
int _index = Convert.ToInt32(index);
|
||||||
Contract.Assert(_index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert(_index < valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
if (updateValues[_index].UnsignedValue != value)
|
if (updateValues[_index].UnsignedValue != value)
|
||||||
{
|
{
|
||||||
@@ -1078,7 +1076,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void UpdateUInt32Value(object index, uint value)
|
public void UpdateUInt32Value(object index, uint value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
updateValues[(int)index].UnsignedValue = value;
|
updateValues[(int)index].UnsignedValue = value;
|
||||||
_changesMask.Set((int)index, true);
|
_changesMask.Set((int)index, true);
|
||||||
@@ -1086,7 +1084,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetUInt64Value(object index, ulong value)
|
public void SetUInt64Value(object index, ulong value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index + 1 < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index + 1 < valuesCount || PrintIndexError(index, true));
|
||||||
if (GetUInt64Value(index) != value)
|
if (GetUInt64Value(index) != value)
|
||||||
{
|
{
|
||||||
updateValues[(int)index].UnsignedValue = MathFunctions.Pair64_LoPart(value);
|
updateValues[(int)index].UnsignedValue = MathFunctions.Pair64_LoPart(value);
|
||||||
@@ -1100,7 +1098,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool AddGuidValue(object index, ObjectGuid value)
|
public bool AddGuidValue(object index, ObjectGuid value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index + 3 < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index + 3 < valuesCount || PrintIndexError(index, true));
|
||||||
if (!value.IsEmpty() && GetGuidValue(index).IsEmpty())
|
if (!value.IsEmpty() && GetGuidValue(index).IsEmpty())
|
||||||
{
|
{
|
||||||
SetGuidValue(index, value);
|
SetGuidValue(index, value);
|
||||||
@@ -1112,7 +1110,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool RemoveGuidValue(object index, ObjectGuid value)
|
public bool RemoveGuidValue(object index, ObjectGuid value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index + 3 < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index + 3 < valuesCount || PrintIndexError(index, true));
|
||||||
if (!value.IsEmpty() && GetGuidValue(index) == value)
|
if (!value.IsEmpty() && GetGuidValue(index) == value)
|
||||||
{
|
{
|
||||||
SetGuidValue(index, ObjectGuid.Empty);
|
SetGuidValue(index, ObjectGuid.Empty);
|
||||||
@@ -1124,7 +1122,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetFloatValue(object index, float value)
|
public void SetFloatValue(object index, float value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
if (updateValues[(int)index].FloatValue != value)
|
if (updateValues[(int)index].FloatValue != value)
|
||||||
{
|
{
|
||||||
@@ -1137,7 +1135,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetByteValue(object index, byte offset, byte value)
|
public void SetByteValue(object index, byte offset, byte value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
if (offset > 3)
|
if (offset > 3)
|
||||||
{
|
{
|
||||||
@@ -1157,7 +1155,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetUInt16Value(object index, byte offset, ushort value)
|
public void SetUInt16Value(object index, byte offset, ushort value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
if (offset > 2)
|
if (offset > 2)
|
||||||
{
|
{
|
||||||
@@ -1177,7 +1175,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetGuidValue(object index, ObjectGuid value)
|
public void SetGuidValue(object index, ObjectGuid value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index + 3 < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index + 3 < valuesCount || PrintIndexError(index, true));
|
||||||
if (GetGuidValue(index) != value)
|
if (GetGuidValue(index) != value)
|
||||||
{
|
{
|
||||||
SetUInt64Value(index, value.GetLowValue());
|
SetUInt64Value(index, value.GetLowValue());
|
||||||
@@ -1246,7 +1244,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetFlag(object index, object newflag)
|
public void SetFlag(object index, object newflag)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
uint oldval = updateValues[(int)index].UnsignedValue;
|
uint oldval = updateValues[(int)index].UnsignedValue;
|
||||||
uint newval = oldval | Convert.ToUInt32(newflag);
|
uint newval = oldval | Convert.ToUInt32(newflag);
|
||||||
|
|
||||||
@@ -1261,8 +1259,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void RemoveFlag(object index, object oldFlag)
|
public void RemoveFlag(object index, object oldFlag)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
Contract.Assert(updateValues != null);
|
Cypher.Assert(updateValues != null);
|
||||||
|
|
||||||
uint oldval = updateValues[(int)index].UnsignedValue;
|
uint oldval = updateValues[(int)index].UnsignedValue;
|
||||||
uint newval = (oldval & ~Convert.ToUInt32(oldFlag));
|
uint newval = (oldval & ~Convert.ToUInt32(oldFlag));
|
||||||
@@ -1301,7 +1299,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetByteFlag(object index, byte offset, object newFlag)
|
public void SetByteFlag(object index, byte offset, object newFlag)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
if (offset > 4)
|
if (offset > 4)
|
||||||
{
|
{
|
||||||
@@ -1320,7 +1318,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void RemoveByteFlag(object index, byte offset, object oldFlag)
|
public void RemoveByteFlag(object index, byte offset, object oldFlag)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
if (offset > 4)
|
if (offset > 4)
|
||||||
{
|
{
|
||||||
@@ -1347,8 +1345,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool HasByteFlag(object index, byte offset, object flag)
|
public bool HasByteFlag(object index, byte offset, object flag)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
||||||
Contract.Assert(offset < 4);
|
Cypher.Assert(offset < 4);
|
||||||
return Convert.ToBoolean(updateValues[(int)index].UnsignedValue >> (offset * 8) & Convert.ToUInt32(flag));
|
return Convert.ToBoolean(updateValues[(int)index].UnsignedValue >> (offset * 8) & Convert.ToUInt32(flag));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1376,7 +1374,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool HasFlag64(object index, object flag)
|
public bool HasFlag64(object index, object flag)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < valuesCount || PrintIndexError(index, false));
|
||||||
return (GetUInt64Value(index) & Convert.ToUInt64(flag)) != 0;
|
return (GetUInt64Value(index) & Convert.ToUInt64(flag)) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1390,13 +1388,13 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public uint[] GetDynamicValues(object index)
|
public uint[] GetDynamicValues(object index)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, false));
|
||||||
return _dynamicValues[(int)index];
|
return _dynamicValues[(int)index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetDynamicValue(object index, ushort offset)
|
public uint GetDynamicValue(object index, ushort offset)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, false));
|
||||||
if (offset >= _dynamicValues[(int)index].Length)
|
if (offset >= _dynamicValues[(int)index].Length)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -1405,14 +1403,14 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void AddDynamicValue(object index, uint value)
|
public void AddDynamicValue(object index, uint value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
SetDynamicValue(index, (byte)_dynamicValues[(int)index].Length, value);
|
SetDynamicValue(index, (byte)_dynamicValues[(int)index].Length, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveDynamicValue(object index, uint value)
|
public void RemoveDynamicValue(object index, uint value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, false));
|
||||||
|
|
||||||
// TODO: Research if this is blizzlike to just set value to 0
|
// TODO: Research if this is blizzlike to just set value to 0
|
||||||
for (var i = 0; i < _dynamicValues[(int)index].Length; ++i)
|
for (var i = 0; i < _dynamicValues[(int)index].Length; ++i)
|
||||||
@@ -1430,7 +1428,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void ClearDynamicValue(object index)
|
public void ClearDynamicValue(object index)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, false));
|
Cypher.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, false));
|
||||||
|
|
||||||
if (!_dynamicValues[(int)index].Empty())
|
if (!_dynamicValues[(int)index].Empty())
|
||||||
{
|
{
|
||||||
@@ -1444,7 +1442,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetDynamicValue(object index, ushort offset, uint value)
|
public void SetDynamicValue(object index, ushort offset, uint value)
|
||||||
{
|
{
|
||||||
Contract.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, true));
|
Cypher.Assert((int)index < _dynamicValuesCount || PrintIndexError(index, true));
|
||||||
|
|
||||||
DynamicFieldChangeType changeType = DynamicFieldChangeType.ValueChanged;
|
DynamicFieldChangeType changeType = DynamicFieldChangeType.ValueChanged;
|
||||||
if (_dynamicValues[(int)index].Length <= offset)
|
if (_dynamicValues[(int)index].Length <= offset)
|
||||||
@@ -1892,8 +1890,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public virtual void SetMap(Map map)
|
public virtual void SetMap(Map map)
|
||||||
{
|
{
|
||||||
Contract.Assert(map != null);
|
Cypher.Assert(map != null);
|
||||||
Contract.Assert(!IsInWorld);
|
Cypher.Assert(!IsInWorld);
|
||||||
|
|
||||||
if (_currMap == map)
|
if (_currMap == map)
|
||||||
return;
|
return;
|
||||||
@@ -1907,8 +1905,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public virtual void ResetMap()
|
public virtual void ResetMap()
|
||||||
{
|
{
|
||||||
Contract.Assert(_currMap != null);
|
Cypher.Assert(_currMap != null);
|
||||||
Contract.Assert(!IsInWorld);
|
Cypher.Assert(!IsInWorld);
|
||||||
if (IsWorldObject())
|
if (IsWorldObject())
|
||||||
_currMap.RemoveWorldObject(this);
|
_currMap.RemoveWorldObject(this);
|
||||||
_currMap = null;
|
_currMap = null;
|
||||||
@@ -2047,7 +2045,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SummonCreatureGroup(byte group, out List<TempSummon> list)
|
public void SummonCreatureGroup(byte group, out List<TempSummon> list)
|
||||||
{
|
{
|
||||||
Contract.Assert((IsTypeId(TypeId.GameObject) || IsTypeId(TypeId.Unit)), "Only GOs and creatures can summon npc groups!");
|
Cypher.Assert((IsTypeId(TypeId.GameObject) || IsTypeId(TypeId.Unit)), "Only GOs and creatures can summon npc groups!");
|
||||||
list = new List<TempSummon>();
|
list = new List<TempSummon>();
|
||||||
var data = Global.ObjectMgr.GetSummonGroup(GetEntry(), IsTypeId(TypeId.GameObject) ? SummonerType.GameObject : SummonerType.Creature, group);
|
var data = Global.ObjectMgr.GetSummonGroup(GetEntry(), IsTypeId(TypeId.GameObject) ? SummonerType.GameObject : SummonerType.Creature, group);
|
||||||
if (data.Empty())
|
if (data.Empty())
|
||||||
@@ -2128,9 +2126,9 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PhaseShift GetPhaseShift() { return _phaseShift; }
|
public PhaseShift GetPhaseShift() { return _phaseShift; }
|
||||||
public void SetPhaseShift(PhaseShift phaseShift) { _phaseShift = phaseShift; }
|
public void SetPhaseShift(PhaseShift phaseShift) { _phaseShift = new PhaseShift(phaseShift); }
|
||||||
public PhaseShift GetSuppressedPhaseShift() { return _suppressedPhaseShift; }
|
public PhaseShift GetSuppressedPhaseShift() { return _suppressedPhaseShift; }
|
||||||
public void SetSuppressedPhaseShift(PhaseShift phaseShift) { _suppressedPhaseShift = phaseShift; }
|
public void SetSuppressedPhaseShift(PhaseShift phaseShift) { _suppressedPhaseShift = new PhaseShift(phaseShift); }
|
||||||
public int GetDBPhase() { return _dbPhase; }
|
public int GetDBPhase() { return _dbPhase; }
|
||||||
|
|
||||||
// if negative it is used as PhaseGroupId
|
// if negative it is used as PhaseGroupId
|
||||||
|
|||||||
@@ -27,38 +27,65 @@ namespace Game
|
|||||||
{
|
{
|
||||||
public class PhaseShift
|
public class PhaseShift
|
||||||
{
|
{
|
||||||
|
public PhaseShift()
|
||||||
|
{
|
||||||
|
Flags = PhaseShiftFlags.Unphased;
|
||||||
|
}
|
||||||
|
public PhaseShift(PhaseShift copy)
|
||||||
|
{
|
||||||
|
Flags = copy.Flags;
|
||||||
|
PersonalGuid = copy.PersonalGuid;
|
||||||
|
Phases = new Dictionary<uint, PhaseRef>(copy.Phases);
|
||||||
|
VisibleMapIds = new Dictionary<uint, VisibleMapIdRef>(copy.VisibleMapIds);
|
||||||
|
UiWorldMapAreaIdSwaps = new Dictionary<uint, UiWorldMapAreaIdSwapRef>(copy.UiWorldMapAreaIdSwaps);
|
||||||
|
|
||||||
|
NonCosmeticReferences = copy.NonCosmeticReferences;
|
||||||
|
CosmeticReferences = copy.CosmeticReferences;
|
||||||
|
DefaultReferences = copy.DefaultReferences;
|
||||||
|
IsDbPhaseShift = copy.IsDbPhaseShift;
|
||||||
|
}
|
||||||
|
|
||||||
public bool AddPhase(uint phaseId, PhaseFlags flags, List<Condition> areaConditions, int references = 1)
|
public bool AddPhase(uint phaseId, PhaseFlags flags, List<Condition> areaConditions, int references = 1)
|
||||||
{
|
{
|
||||||
var phase = new PhaseRef(phaseId, flags, null);
|
bool newPhase = false;
|
||||||
ModifyPhasesReferences(phase, references);
|
|
||||||
|
if (!Phases.ContainsKey(phaseId))
|
||||||
|
{
|
||||||
|
newPhase = true;
|
||||||
|
Phases.Add(phaseId, new PhaseRef(flags, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
var phase = Phases.LookupByKey(phaseId);
|
||||||
|
ModifyPhasesReferences(phaseId, phase, references);
|
||||||
if (areaConditions != null)
|
if (areaConditions != null)
|
||||||
phase.AreaConditions = areaConditions;
|
phase.AreaConditions = areaConditions;
|
||||||
|
|
||||||
Phases.Add(phase);
|
return newPhase;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemovePhase(uint phaseId)
|
public bool RemovePhase(uint phaseId)
|
||||||
{
|
{
|
||||||
var phaseRef = new PhaseRef(phaseId, PhaseFlags.None, null);
|
var phaseRef = Phases.LookupByKey(phaseId);
|
||||||
if (Phases.Contains(phaseRef))
|
if (phaseRef != null)
|
||||||
{
|
{
|
||||||
ModifyPhasesReferences(phaseRef, -1);
|
ModifyPhasesReferences(phaseId, phaseRef, -1);
|
||||||
if (phaseRef.References == 0)
|
if (phaseRef.References == 0)
|
||||||
{
|
{
|
||||||
Phases.Remove(phaseRef);
|
Phases.Remove(phaseId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddVisibleMapId(uint visibleMapId, TerrainSwapInfo visibleMapInfo, int references = 1)
|
public bool AddVisibleMapId(uint visibleMapId, TerrainSwapInfo visibleMapInfo, int references = 1)
|
||||||
{
|
{
|
||||||
|
if (VisibleMapIds.ContainsKey(visibleMapId))
|
||||||
|
return false;
|
||||||
|
|
||||||
VisibleMapIds.Add(visibleMapId, new VisibleMapIdRef(references, visibleMapInfo));
|
VisibleMapIds.Add(visibleMapId, new VisibleMapIdRef(references, visibleMapInfo));
|
||||||
return true; //Tryadd? maybe Concurrent
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveVisibleMapId(uint visibleMapId)
|
public bool RemoveVisibleMapId(uint visibleMapId)
|
||||||
@@ -71,8 +98,6 @@ namespace Game
|
|||||||
VisibleMapIds.Remove(visibleMapId);
|
VisibleMapIds.Remove(visibleMapId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -80,8 +105,11 @@ namespace Game
|
|||||||
|
|
||||||
public bool AddUiWorldMapAreaIdSwap(uint uiWorldMapAreaId, int references = 1)
|
public bool AddUiWorldMapAreaIdSwap(uint uiWorldMapAreaId, int references = 1)
|
||||||
{
|
{
|
||||||
|
if (UiWorldMapAreaIdSwaps.ContainsKey(uiWorldMapAreaId))
|
||||||
|
return false;
|
||||||
|
|
||||||
UiWorldMapAreaIdSwaps.Add(uiWorldMapAreaId, new UiWorldMapAreaIdSwapRef(references));
|
UiWorldMapAreaIdSwaps.Add(uiWorldMapAreaId, new UiWorldMapAreaIdSwapRef(references));
|
||||||
return true; //Tryadd? maybe Concurrent
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool RemoveUiWorldMapAreaIdSwap(uint uiWorldMapAreaId)
|
public bool RemoveUiWorldMapAreaIdSwap(uint uiWorldMapAreaId)
|
||||||
@@ -94,8 +122,6 @@ namespace Game
|
|||||||
UiWorldMapAreaIdSwaps.Remove(uiWorldMapAreaId);
|
UiWorldMapAreaIdSwaps.Remove(uiWorldMapAreaId);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -136,7 +162,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
ObjectGuid ownerGuid = PersonalGuid;
|
ObjectGuid ownerGuid = PersonalGuid;
|
||||||
ObjectGuid otherPersonalGuid = other.PersonalGuid;
|
ObjectGuid otherPersonalGuid = other.PersonalGuid;
|
||||||
return Phases.Intersect(other.Phases, (myPhase, otherPhase) => !myPhase.Flags.HasAnyFlag(excludePhasesWithFlag) && (!myPhase.Flags.HasFlag(PhaseFlags.Personal) || ownerGuid == otherPersonalGuid)).Any();
|
return Phases.Intersect(other.Phases, (myPhase, otherPhase) => !myPhase.Value.Flags.HasAnyFlag(excludePhasesWithFlag) && (!myPhase.Value.Flags.HasFlag(PhaseFlags.Personal) || ownerGuid == otherPersonalGuid)).Any();
|
||||||
}
|
}
|
||||||
|
|
||||||
var checkInversePhaseShift = new Func<PhaseShift, PhaseShift, bool>((phaseShift, excludedPhaseShift) =>
|
var checkInversePhaseShift = new Func<PhaseShift, PhaseShift, bool>((phaseShift, excludedPhaseShift) =>
|
||||||
@@ -144,13 +170,14 @@ namespace Game
|
|||||||
if (phaseShift.Flags.HasFlag(PhaseShiftFlags.Unphased) && !excludedPhaseShift.Flags.HasFlag(PhaseShiftFlags.InverseUnphased))
|
if (phaseShift.Flags.HasFlag(PhaseShiftFlags.Unphased) && !excludedPhaseShift.Flags.HasFlag(PhaseShiftFlags.InverseUnphased))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (var itr in phaseShift.Phases)
|
var list = excludedPhaseShift.Phases.ToList();
|
||||||
|
foreach (var pair in phaseShift.Phases)
|
||||||
{
|
{
|
||||||
if (itr.Flags.HasAnyFlag(excludePhasesWithFlag))
|
if (pair.Value.Flags.HasAnyFlag(excludePhasesWithFlag))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var index = excludedPhaseShift.Phases.IndexOf(itr);
|
var ExcludedPhaseRef = excludedPhaseShift.Phases.LookupByKey(pair.Key);
|
||||||
if (index == -1 || excludedPhaseShift.Phases[index].Flags.HasAnyFlag(excludePhasesWithFlag))
|
if (ExcludedPhaseRef == null || ExcludedPhaseRef.Flags.HasAnyFlag(excludePhasesWithFlag))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +190,7 @@ namespace Game
|
|||||||
return checkInversePhaseShift(other, this);
|
return checkInversePhaseShift(other, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ModifyPhasesReferences(PhaseRef phaseRef, int references)
|
public void ModifyPhasesReferences(uint phaseId, PhaseRef phaseRef, int references)
|
||||||
{
|
{
|
||||||
phaseRef.References += references;
|
phaseRef.References += references;
|
||||||
|
|
||||||
@@ -171,7 +198,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
if (phaseRef.Flags.HasAnyFlag(PhaseFlags.Cosmetic))
|
if (phaseRef.Flags.HasAnyFlag(PhaseFlags.Cosmetic))
|
||||||
CosmeticReferences += references;
|
CosmeticReferences += references;
|
||||||
else if (phaseRef.Id != 169)
|
else if (phaseId != 169)
|
||||||
NonCosmeticReferences += references;
|
NonCosmeticReferences += references;
|
||||||
else
|
else
|
||||||
DefaultReferences += references;
|
DefaultReferences += references;
|
||||||
@@ -195,8 +222,8 @@ namespace Game
|
|||||||
Flags |= unphasedFlag;
|
Flags |= unphasedFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasPhase(uint phaseId) { return Phases.Contains(new PhaseRef(phaseId, PhaseFlags.None, null)); }
|
public bool HasPhase(uint phaseId) { return Phases.ContainsKey(phaseId); }
|
||||||
public List<PhaseRef> GetPhases() { return Phases; }
|
public Dictionary<uint, PhaseRef> GetPhases() { return Phases; }
|
||||||
|
|
||||||
public bool HasVisibleMapId(uint visibleMapId) { return VisibleMapIds.ContainsKey(visibleMapId); }
|
public bool HasVisibleMapId(uint visibleMapId) { return VisibleMapIds.ContainsKey(visibleMapId); }
|
||||||
public Dictionary<uint, VisibleMapIdRef> GetVisibleMapIds() { return VisibleMapIds; }
|
public Dictionary<uint, VisibleMapIdRef> GetVisibleMapIds() { return VisibleMapIds; }
|
||||||
@@ -204,9 +231,9 @@ namespace Game
|
|||||||
public bool HasUiWorldMapAreaIdSwap(uint uiWorldMapAreaId) { return UiWorldMapAreaIdSwaps.ContainsKey(uiWorldMapAreaId); }
|
public bool HasUiWorldMapAreaIdSwap(uint uiWorldMapAreaId) { return UiWorldMapAreaIdSwaps.ContainsKey(uiWorldMapAreaId); }
|
||||||
public Dictionary<uint, UiWorldMapAreaIdSwapRef> GetUiWorldMapAreaIdSwaps() { return UiWorldMapAreaIdSwaps; }
|
public Dictionary<uint, UiWorldMapAreaIdSwapRef> GetUiWorldMapAreaIdSwaps() { return UiWorldMapAreaIdSwaps; }
|
||||||
|
|
||||||
public PhaseShiftFlags Flags = PhaseShiftFlags.Unphased;
|
public PhaseShiftFlags Flags;
|
||||||
public ObjectGuid PersonalGuid;
|
public ObjectGuid PersonalGuid;
|
||||||
public List<PhaseRef> Phases = new List<PhaseRef>();
|
public Dictionary<uint, PhaseRef> Phases = new Dictionary<uint, PhaseRef>();
|
||||||
public Dictionary<uint, VisibleMapIdRef> VisibleMapIds = new Dictionary<uint, VisibleMapIdRef>();
|
public Dictionary<uint, VisibleMapIdRef> VisibleMapIds = new Dictionary<uint, VisibleMapIdRef>();
|
||||||
public Dictionary<uint, UiWorldMapAreaIdSwapRef> UiWorldMapAreaIdSwaps = new Dictionary<uint, UiWorldMapAreaIdSwapRef>();
|
public Dictionary<uint, UiWorldMapAreaIdSwapRef> UiWorldMapAreaIdSwaps = new Dictionary<uint, UiWorldMapAreaIdSwapRef>();
|
||||||
|
|
||||||
@@ -216,46 +243,18 @@ namespace Game
|
|||||||
public bool IsDbPhaseShift;
|
public bool IsDbPhaseShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct PhaseRef
|
public class PhaseRef
|
||||||
{
|
{
|
||||||
public PhaseRef(uint id, PhaseFlags flags, List<Condition> conditions)
|
public PhaseRef(PhaseFlags flags, List<Condition> conditions)
|
||||||
{
|
{
|
||||||
Id = id;
|
|
||||||
Flags = flags;
|
Flags = flags;
|
||||||
References = 0;
|
References = 0;
|
||||||
AreaConditions = conditions;
|
AreaConditions = conditions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint Id;
|
|
||||||
public PhaseFlags Flags;
|
public PhaseFlags Flags;
|
||||||
public int References;
|
public int References;
|
||||||
public List<Condition> AreaConditions;
|
public List<Condition> AreaConditions;
|
||||||
|
|
||||||
public static bool operator <(PhaseRef left, PhaseRef right)
|
|
||||||
{
|
|
||||||
return left.Id < right.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator >(PhaseRef left, PhaseRef right)
|
|
||||||
{
|
|
||||||
return left.Id > right.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool operator ==(PhaseRef left, PhaseRef right) { return left.Id == right.Id; }
|
|
||||||
public static bool operator !=(PhaseRef left, PhaseRef right) { return !(left == right); }
|
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
|
||||||
if (obj is PhaseRef)
|
|
||||||
return (PhaseRef)obj == this;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return Id.GetHashCode() ^ Flags.GetHashCode() ^ References.GetHashCode() ^ AreaConditions.GetHashCode();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct VisibleMapIdRef
|
public struct VisibleMapIdRef
|
||||||
|
|||||||
@@ -34,9 +34,12 @@ namespace Game
|
|||||||
|
|
||||||
public static void ForAllControlled(Unit unit, Action<Unit> func)
|
public static void ForAllControlled(Unit unit, Action<Unit> func)
|
||||||
{
|
{
|
||||||
foreach (Unit controlled in unit.m_Controlled)
|
for (var i = 0; i < unit.m_Controlled.Count; ++i)
|
||||||
|
{
|
||||||
|
Unit controlled = unit.m_Controlled[i];
|
||||||
if (controlled.GetTypeId() != TypeId.Player)
|
if (controlled.GetTypeId() != TypeId.Player)
|
||||||
func(controlled);
|
func(controlled);
|
||||||
|
}
|
||||||
|
|
||||||
for (byte i = 0; i < SharedConst.MaxSummonSlot; ++i)
|
for (byte i = 0; i < SharedConst.MaxSummonSlot; ++i)
|
||||||
{
|
{
|
||||||
@@ -287,23 +290,23 @@ namespace Game
|
|||||||
ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj);
|
ConditionSourceInfo srcInfo = new ConditionSourceInfo(obj);
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
foreach (var phaseRef in phaseShift.Phases.ToArray())
|
foreach (var pair in phaseShift.Phases.ToList())
|
||||||
{
|
{
|
||||||
if (!phaseRef.AreaConditions.Empty() && !Global.ConditionMgr.IsObjectMeetToConditions(srcInfo, phaseRef.AreaConditions))
|
if (pair.Value.AreaConditions != null && !Global.ConditionMgr.IsObjectMeetToConditions(srcInfo, pair.Value.AreaConditions))
|
||||||
{
|
{
|
||||||
newSuppressions.AddPhase(phaseRef.Id, phaseRef.Flags, phaseRef.AreaConditions, phaseRef.References);
|
newSuppressions.AddPhase(pair.Key, pair.Value.Flags, pair.Value.AreaConditions, pair.Value.References);
|
||||||
phaseShift.ModifyPhasesReferences(phaseRef, -phaseRef.References);
|
phaseShift.ModifyPhasesReferences(pair.Key, pair.Value, -pair.Value.References);
|
||||||
phaseShift.Phases.Remove(phaseRef);
|
phaseShift.Phases.Remove(pair.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var phaseRef in suppressedPhaseShift.Phases.ToArray())
|
foreach (var pair in suppressedPhaseShift.Phases.ToList())
|
||||||
{
|
{
|
||||||
if (Global.ConditionMgr.IsObjectMeetToConditions(srcInfo, phaseRef.AreaConditions))
|
if (Global.ConditionMgr.IsObjectMeetToConditions(srcInfo, pair.Value.AreaConditions))
|
||||||
{
|
{
|
||||||
changed = phaseShift.AddPhase(phaseRef.Id, phaseRef.Flags, phaseRef.AreaConditions, phaseRef.References) || changed;
|
changed = phaseShift.AddPhase(pair.Key, pair.Value.Flags, pair.Value.AreaConditions, pair.Value.References) || changed;
|
||||||
suppressedPhaseShift.ModifyPhasesReferences(phaseRef, -phaseRef.References);
|
suppressedPhaseShift.ModifyPhasesReferences(pair.Key, pair.Value, -pair.Value.References);
|
||||||
suppressedPhaseShift.Phases.Remove(phaseRef);
|
suppressedPhaseShift.Phases.Remove(pair.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,8 +362,8 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
changed = changed || !newSuppressions.Phases.Empty() || !newSuppressions.VisibleMapIds.Empty();
|
changed = changed || !newSuppressions.Phases.Empty() || !newSuppressions.VisibleMapIds.Empty();
|
||||||
foreach (var phaseRef in newSuppressions.Phases)
|
foreach (var pair in newSuppressions.Phases)
|
||||||
suppressedPhaseShift.AddPhase(phaseRef.Id, phaseRef.Flags, phaseRef.AreaConditions, phaseRef.References);
|
suppressedPhaseShift.AddPhase(pair.Key, pair.Value.Flags, pair.Value.AreaConditions, pair.Value.References);
|
||||||
|
|
||||||
foreach (var pair in newSuppressions.VisibleMapIds)
|
foreach (var pair in newSuppressions.VisibleMapIds)
|
||||||
suppressedPhaseShift.AddVisibleMapId(pair.Key, pair.Value.VisibleMapInfo, pair.Value.References);
|
suppressedPhaseShift.AddVisibleMapId(pair.Key, pair.Value.VisibleMapInfo, pair.Value.References);
|
||||||
@@ -389,8 +392,8 @@ namespace Game
|
|||||||
phaseShiftChange.Phaseshift.PhaseShiftFlags = (uint)phaseShift.Flags;
|
phaseShiftChange.Phaseshift.PhaseShiftFlags = (uint)phaseShift.Flags;
|
||||||
phaseShiftChange.Phaseshift.PersonalGUID = phaseShift.PersonalGuid;
|
phaseShiftChange.Phaseshift.PersonalGUID = phaseShift.PersonalGuid;
|
||||||
|
|
||||||
foreach (var phaseRef in phaseShift.Phases)
|
foreach (var pair in phaseShift.Phases)
|
||||||
phaseShiftChange.Phaseshift.Phases.Add(new PhaseShiftDataPhase((uint)phaseRef.Flags, phaseRef.Id));
|
phaseShiftChange.Phaseshift.Phases.Add(new PhaseShiftDataPhase((uint)pair.Value.Flags, pair.Key));
|
||||||
|
|
||||||
foreach (var visibleMapId in phaseShift.VisibleMapIds)
|
foreach (var visibleMapId in phaseShift.VisibleMapIds)
|
||||||
phaseShiftChange.VisibleMapIDs.Add((ushort)visibleMapId.Key);
|
phaseShiftChange.VisibleMapIDs.Add((ushort)visibleMapId.Key);
|
||||||
@@ -411,8 +414,8 @@ namespace Game
|
|||||||
partyMemberPhases.PhaseShiftFlags = (int)phaseShift.Flags;
|
partyMemberPhases.PhaseShiftFlags = (int)phaseShift.Flags;
|
||||||
partyMemberPhases.PersonalGUID = phaseShift.PersonalGuid;
|
partyMemberPhases.PersonalGUID = phaseShift.PersonalGuid;
|
||||||
|
|
||||||
foreach (var phase in phaseShift.Phases)
|
foreach (var pair in phaseShift.Phases)
|
||||||
partyMemberPhases.List.Add(new PartyMemberPhase((uint)phase.Flags, phase.Id));
|
partyMemberPhases.List.Add(new PartyMemberPhase((uint)pair.Value.Flags, pair.Key));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InitDbPhaseShift(PhaseShift phaseShift, PhaseUseFlagsValues phaseUseFlags, uint phaseId, uint phaseGroupId)
|
public static void InitDbPhaseShift(PhaseShift phaseShift, PhaseUseFlagsValues phaseUseFlags, uint phaseId, uint phaseGroupId)
|
||||||
@@ -512,12 +515,12 @@ namespace Game
|
|||||||
StringBuilder phases = new StringBuilder();
|
StringBuilder phases = new StringBuilder();
|
||||||
string cosmetic = Global.ObjectMgr.GetCypherString(CypherStrings.PhaseFlagCosmetic, chat.GetSessionDbcLocale());
|
string cosmetic = Global.ObjectMgr.GetCypherString(CypherStrings.PhaseFlagCosmetic, chat.GetSessionDbcLocale());
|
||||||
string personal = Global.ObjectMgr.GetCypherString(CypherStrings.PhaseFlagPersonal, chat.GetSessionDbcLocale());
|
string personal = Global.ObjectMgr.GetCypherString(CypherStrings.PhaseFlagPersonal, chat.GetSessionDbcLocale());
|
||||||
foreach (PhaseRef phase in phaseShift.Phases)
|
foreach (var pair in phaseShift.Phases)
|
||||||
{
|
{
|
||||||
phases.Append(phase.Id);
|
phases.Append(pair.Key);
|
||||||
if (phase.Flags.HasFlag(PhaseFlags.Cosmetic))
|
if (pair.Value.Flags.HasFlag(PhaseFlags.Cosmetic))
|
||||||
phases.Append(' ' + '(' + cosmetic + ')');
|
phases.Append(' ' + '(' + cosmetic + ')');
|
||||||
if (phase.Flags.HasFlag(PhaseFlags.Personal))
|
if (pair.Value.Flags.HasFlag(PhaseFlags.Personal))
|
||||||
phases.Append(' ' + '(' + personal + ')');
|
phases.Append(' ' + '(' + personal + ')');
|
||||||
phases.Append(", ");
|
phases.Append(", ");
|
||||||
}
|
}
|
||||||
@@ -547,8 +550,8 @@ namespace Game
|
|||||||
public static string FormatPhases(PhaseShift phaseShift)
|
public static string FormatPhases(PhaseShift phaseShift)
|
||||||
{
|
{
|
||||||
StringBuilder phases = new StringBuilder();
|
StringBuilder phases = new StringBuilder();
|
||||||
foreach (var phase in phaseShift.Phases)
|
foreach (var phaseId in phaseShift.Phases.Keys)
|
||||||
phases.Append(phase.Id + ',');
|
phases.Append(phaseId + ',');
|
||||||
|
|
||||||
return phases.ToString();
|
return phases.ToString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ namespace Scripts.Northrend.AzjolNerub.Ahnkahet.HeraldVolazj
|
|||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextPhase = visage.GetPhaseShift().GetPhases().First().Id;
|
nextPhase = visage.GetPhaseShift().GetPhases().First().Key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user