Core/Refactor: Part 1

This commit is contained in:
hondacrx
2018-05-07 18:56:09 -04:00
parent b2c1554065
commit 216db1c23a
83 changed files with 298 additions and 296 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ using System.Net.Sockets;
namespace BNetServer.Networking namespace BNetServer.Networking
{ {
public partial class Session : SSLSocket public class Session : SSLSocket
{ {
public Session(Socket socket) : base(socket) public Session(Socket socket) : base(socket)
{ {
+1 -1
View File
@@ -369,7 +369,7 @@ namespace System.Collections
return MemberwiseClone(); return MemberwiseClone();
} }
public virtual bool MoveNext() public bool MoveNext()
{ {
//if (version != bitarray._version) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion)); //if (version != bitarray._version) throw new InvalidOperationException(Environment.GetResourceString(ResId.InvalidOperation_EnumFailedVersion));
if (index < (bitarray.Count - 1)) if (index < (bitarray.Count - 1))
@@ -40,7 +40,6 @@ namespace Framework.Configuration
int lineCounter = 0; int lineCounter = 0;
try try
{ {
string name = string.Empty;
foreach (var line in ConfigContent) foreach (var line in ConfigContent)
{ {
lineCounter++; lineCounter++;
@@ -13,7 +13,9 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
using System;
namespace Framework.Constants namespace Framework.Constants
{ {
@@ -46,6 +48,7 @@ namespace Framework.Constants
SumChildrenWeight = 9 SumChildrenWeight = 9
} }
[Flags]
public enum AchievementFlags public enum AchievementFlags
{ {
Counter = 0x01, Counter = 0x01,
@@ -71,6 +74,7 @@ namespace Framework.Constants
TrackingFlag = 0x00100000 TrackingFlag = 0x00100000
} }
[Flags]
public enum CriteriaFlagsCu public enum CriteriaFlagsCu
{ {
Player = 0x1, Player = 0x1,
+1 -1
View File
@@ -849,7 +849,7 @@ namespace Framework.Constants
FlyWarriorChargeEnd = 821 FlyWarriorChargeEnd = 821
} }
public enum AreaFlags : int public enum AreaFlags
{ {
Snow = 0x01, // Snow (Only Dun Morogh, Naxxramas, Razorfen Downs And Winterspring) Snow = 0x01, // Snow (Only Dun Morogh, Naxxramas, Razorfen Downs And Winterspring)
Unk1 = 0x02, // Razorfen Downs, Naxxramas And Acherus: The Ebon Hold (3.3.5a) Unk1 = 0x02, // Razorfen Downs, Naxxramas And Acherus: The Ebon Hold (3.3.5a)
+1 -1
View File
@@ -191,7 +191,7 @@ namespace Framework.Constants
InvalidVendor = 5 InvalidVendor = 5
} }
public enum GuildBankRights : int public enum GuildBankRights
{ {
ViewTab = 0x01, ViewTab = 0x01,
PutItem = 0x02, PutItem = 0x02,
+1 -1
View File
@@ -17,7 +17,7 @@
namespace Framework.Constants namespace Framework.Constants
{ {
public enum Language : int public enum Language
{ {
Universal = 0, Universal = 0,
Orcish = 1, Orcish = 1,
+1 -1
View File
@@ -32,7 +32,7 @@ namespace Framework.Constants
public const int ReqPrimaryTreeTalents = 31; public const int ReqPrimaryTreeTalents = 31;
public const int ExploredZonesSize = 320; public const int ExploredZonesSize = 320;
public const ulong MaxMoneyAmount = ulong.MaxValue; public const ulong MaxMoneyAmount = 99999999999UL;
public const int MaxActionButtons = 132; public const int MaxActionButtons = 132;
public const int MaxActionButtonActionValue = 0x00FFFFFF + 1; public const int MaxActionButtonActionValue = 0x00FFFFFF + 1;
@@ -267,7 +267,7 @@ namespace Framework.Constants
} }
// Spell mechanics // Spell mechanics
public enum Mechanics : int public enum Mechanics
{ {
None = 0, None = 0,
Charm = 1, Charm = 1,
@@ -277,7 +277,7 @@ namespace Framework.Constants
Fear = 5, Fear = 5,
Grip = 6, Grip = 6,
Root = 7, Root = 7,
Slow_Attack = 8, SlowAttack = 8,
Silence = 9, Silence = 9,
Sleep = 10, Sleep = 10,
Snare = 11, Snare = 11,
+2
View File
@@ -450,6 +450,8 @@ namespace Framework.Constants
Dead = 3, Dead = 3,
JustRespawned = 4 JustRespawned = 4
} }
[Flags]
public enum UnitState : uint public enum UnitState : uint
{ {
Died = 0x01, // Player Has Fake Death Aura Died = 0x01, // Player Has Fake Death Aura
-5
View File
@@ -114,11 +114,6 @@ namespace Framework.Cryptography
public class HmacSha256 : HMACSHA256 public class HmacSha256 : HMACSHA256
{ {
public HmacSha256() : base()
{
Initialize();
}
public HmacSha256(byte[] key) : base(key) public HmacSha256(byte[] key) : base(key)
{ {
Initialize(); Initialize();
+2 -5
View File
@@ -54,8 +54,7 @@ namespace Framework.Database
{ {
QueryCallbackData callback = _callbacks.Dequeue(); QueryCallbackData callback = _callbacks.Dequeue();
bool hasNext = true; while (true)
while (hasNext)
{ {
if (_result != null && _result.Wait(0)) if (_result != null && _result.Wait(0))
{ {
@@ -65,7 +64,7 @@ namespace Framework.Database
cb(this, f.Result); cb(this, f.Result);
hasNext = _result != null; bool hasNext = _result != null;
if (_callbacks.Count == 0) if (_callbacks.Count == 0)
{ {
Contract.Assert(!hasNext); Contract.Assert(!hasNext);
@@ -81,8 +80,6 @@ namespace Framework.Database
else else
return QueryCallbackStatus.NotReady; return QueryCallbackStatus.NotReady;
} }
return QueryCallbackStatus.Completed;
} }
Task<SQLResult> _result; Task<SQLResult> _result;
-10
View File
@@ -28,16 +28,6 @@ namespace Framework.Dynamic
_values[i] = parts[i]; _values[i] = parts[i];
} }
public override int GetHashCode()
{
return base.GetHashCode();
}
public override bool Equals(object obj)
{
return base.Equals(obj);
}
public bool IsEqual(params uint[] parts) public bool IsEqual(params uint[] parts)
{ {
for (var i = 0; i < _values.Length; ++i) for (var i = 0; i < _values.Length; ++i)
+4 -1
View File
@@ -266,7 +266,7 @@ namespace Framework.IO
/// <summary> /// <summary>
/// Writes a string to the packet with a null terminated (0) /// Writes a string to the packet with a null terminated (0)
/// </summary> /// </summary>
/// <param name="data"></param> /// <param name="str"></param>
public void WriteCString(string str) public void WriteCString(string str)
{ {
if (string.IsNullOrEmpty(str)) if (string.IsNullOrEmpty(str))
@@ -281,6 +281,9 @@ namespace Framework.IO
public void WriteString(string str) public void WriteString(string str)
{ {
if (str.IsEmpty())
return;
byte[] sBytes = Encoding.UTF8.GetBytes(str); byte[] sBytes = Encoding.UTF8.GetBytes(str);
WriteBytes(sBytes); WriteBytes(sBytes);
} }
+2 -2
View File
@@ -100,9 +100,9 @@ class FileAppender : Appender, IDisposable
} }
#region IDisposable Support #region IDisposable Support
private bool disposedValue = false; private bool disposedValue;
protected virtual void Dispose(bool disposing) private void Dispose(bool disposing)
{ {
if (!disposedValue) if (!disposedValue)
{ {
+9 -10
View File
@@ -21,7 +21,7 @@ using System.Threading;
namespace Framework.Networking namespace Framework.Networking
{ {
public class NetworkThread<SocketType> where SocketType : ISocket public class NetworkThread<TSocketType> where TSocketType : ISocket
{ {
public void Stop() public void Stop()
{ {
@@ -43,15 +43,15 @@ namespace Framework.Networking
return _connections; return _connections;
} }
public virtual void AddSocket(SocketType sock) public virtual void AddSocket(TSocketType sock)
{ {
Interlocked.Increment(ref _connections); Interlocked.Increment(ref _connections);
_newSockets.Add(sock); _newSockets.Add(sock);
SocketAdded(sock); SocketAdded(sock);
} }
public virtual void SocketAdded(SocketType sock) { } protected virtual void SocketAdded(TSocketType sock) { }
public virtual void SocketRemoved(SocketType sock) { } protected virtual void SocketRemoved(TSocketType sock) { }
void AddNewSockets() void AddNewSockets()
{ {
@@ -78,12 +78,11 @@ namespace Framework.Networking
Log.outDebug(LogFilter.Network, "Network Thread Starting"); Log.outDebug(LogFilter.Network, "Network Thread Starting");
int sleepTime = 10; int sleepTime = 10;
uint tickStart = 0, diff = 0;
while (!_stopped) while (!_stopped)
{ {
Thread.Sleep(sleepTime); Thread.Sleep(sleepTime);
tickStart = Time.GetMSTime(); uint tickStart = Time.GetMSTime();
AddNewSockets(); AddNewSockets();
@@ -101,7 +100,7 @@ namespace Framework.Networking
} }
} }
diff = Time.GetMSTimeDiffToNow(tickStart); uint diff = Time.GetMSTimeDiffToNow(tickStart);
sleepTime = (int)(diff > 10 ? 0 : 10 - diff); sleepTime = (int)(diff > 10 ? 0 : 10 - diff);
} }
@@ -110,12 +109,12 @@ namespace Framework.Networking
_Sockets.Clear(); _Sockets.Clear();
} }
volatile int _connections; int _connections;
volatile bool _stopped; volatile bool _stopped;
Thread _thread; Thread _thread;
List<SocketType> _Sockets = new List<SocketType>(); List<TSocketType> _Sockets = new List<TSocketType>();
List<SocketType> _newSockets = new List<SocketType>(); List<TSocketType> _newSockets = new List<TSocketType>();
} }
} }
+5 -5
View File
@@ -21,7 +21,7 @@ using System.Net.Sockets;
namespace Framework.Networking namespace Framework.Networking
{ {
public class SocketManager<SocketType> where SocketType : ISocket public class SocketManager<TSocketType> where TSocketType : ISocket
{ {
public virtual bool StartNetwork(string bindIp, int port, int threadCount = 1) public virtual bool StartNetwork(string bindIp, int port, int threadCount = 1)
{ {
@@ -30,11 +30,11 @@ namespace Framework.Networking
Acceptor = new AsyncAcceptor(bindIp, port); Acceptor = new AsyncAcceptor(bindIp, port);
_threadCount = threadCount; _threadCount = threadCount;
_threads = new NetworkThread<SocketType>[GetNetworkThreadCount()]; _threads = new NetworkThread<TSocketType>[GetNetworkThreadCount()];
for (int i = 0; i < _threadCount; ++i) for (int i = 0; i < _threadCount; ++i)
{ {
_threads[i] = new NetworkThread<SocketType>(); _threads[i] = new NetworkThread<TSocketType>();
_threads[i].Start(); _threads[i].Start();
} }
@@ -69,7 +69,7 @@ namespace Framework.Networking
{ {
try try
{ {
SocketType newSocket = (SocketType)Activator.CreateInstance(typeof(SocketType), sock); TSocketType newSocket = (TSocketType)Activator.CreateInstance(typeof(TSocketType), sock);
newSocket.Start(); newSocket.Start();
_threads[SelectThreadWithMinConnections()].AddSocket(newSocket); _threads[SelectThreadWithMinConnections()].AddSocket(newSocket);
@@ -94,7 +94,7 @@ namespace Framework.Networking
} }
public AsyncAcceptor Acceptor; public AsyncAcceptor Acceptor;
NetworkThread<SocketType>[] _threads; NetworkThread<TSocketType>[] _threads;
int _threadCount; int _threadCount;
} }
} }
@@ -168,13 +168,13 @@ public static partial class Detour
private class dtQueryData private class dtQueryData
{ {
public dtStatus status; public dtStatus status;
public dtNode lastBestNode = null; public dtNode lastBestNode;
public float lastBestNodeCost; public float lastBestNodeCost;
public dtPolyRef startRef; public dtPolyRef startRef;
public dtPolyRef endRef; public dtPolyRef endRef;
public float[] startPos = new float[3]; public float[] startPos = new float[3];
public float[] endPos = new float[3]; public float[] endPos = new float[3];
public dtQueryFilter filter = null; public dtQueryFilter filter;
public void dtcsClear() public void dtcsClear()
{ {
+3
View File
@@ -289,6 +289,9 @@ namespace System
public static int GetByteCount(this string str) public static int GetByteCount(this string str)
{ {
if (str.IsEmpty())
return 0;
return Encoding.UTF8.GetByteCount(str); return Encoding.UTF8.GetByteCount(str);
} }
#endregion #endregion
@@ -703,28 +703,22 @@ namespace Game.BattleGrounds.Zones
public override WorldSafeLocsRecord GetClosestGraveYard(Player player) public override WorldSafeLocsRecord GetClosestGraveYard(Player player)
{ {
uint safeloc = 0; uint safeloc = 0;
WorldSafeLocsRecord ret;
WorldSafeLocsRecord closest;
float dist, nearest;
float x, y, z;
player.GetPosition(out x, out y, out z);
if (player.GetTeamId() == Attackers) if (player.GetTeamId() == Attackers)
safeloc = SAMiscConst.GYEntries[SAGraveyards.BeachGy]; safeloc = SAMiscConst.GYEntries[SAGraveyards.BeachGy];
else else
safeloc = SAMiscConst.GYEntries[SAGraveyards.DefenderLastGy]; safeloc = SAMiscConst.GYEntries[SAGraveyards.DefenderLastGy];
closest = CliDB.WorldSafeLocsStorage.LookupByKey(safeloc); WorldSafeLocsRecord closest = CliDB.WorldSafeLocsStorage.LookupByKey(safeloc);
nearest = player.GetExactDistSq(closest.Loc.X, closest.Loc.Y, closest.Loc.Z); float nearest = player.GetExactDistSq(closest.Loc.X, closest.Loc.Y, closest.Loc.Z);
for (byte i = SAGraveyards.RightCapturableGy; i < SAGraveyards.Max; i++) for (byte i = SAGraveyards.RightCapturableGy; i < SAGraveyards.Max; i++)
{ {
if (GraveyardStatus[i] != player.GetTeamId()) if (GraveyardStatus[i] != player.GetTeamId())
continue; continue;
ret = CliDB.WorldSafeLocsStorage.LookupByKey(SAMiscConst.GYEntries[i]); WorldSafeLocsRecord ret = CliDB.WorldSafeLocsStorage.LookupByKey(SAMiscConst.GYEntries[i]);
dist = player.GetExactDistSq(ret.Loc.X, ret.Loc.Y, ret.Loc.Z); float dist = player.GetExactDistSq(ret.Loc.X, ret.Loc.Y, ret.Loc.Z);
if (dist < nearest) if (dist < nearest)
{ {
closest = ret; closest = ret;
+1 -1
View File
@@ -27,7 +27,7 @@ namespace Game.Chat.Commands
[Command("god", RBACPermissions.CommandCheatGod)] [Command("god", RBACPermissions.CommandCheatGod)]
static bool HandleGodModeCheat(StringArguments args, CommandHandler handler) static bool HandleGodModeCheat(StringArguments args, CommandHandler handler)
{ {
if (handler.GetSession() == null || handler.GetSession().GetPlayer()) if (handler.GetSession() == null || !handler.GetSession().GetPlayer())
return false; return false;
string argstr = args.NextString(); string argstr = args.NextString();
@@ -34,7 +34,6 @@ namespace Game.Chat.Commands
if (entry == 0) if (entry == 0)
return false; return false;
string flagsStr = args.NextString();
uint flags = args.NextUInt32(); uint flags = args.NextUInt32();
string disableComment = args.NextString(""); string disableComment = args.NextString("");
-1
View File
@@ -570,7 +570,6 @@ namespace Game.Chat.Commands
string goX = args.NextString(); string goX = args.NextString();
string goY = args.NextString(); string goY = args.NextString();
string goZ = args.NextString(); string goZ = args.NextString();
string id = args.NextString();
string port = args.NextString(); string port = args.NextString();
float x, y, z, o; float x, y, z, o;
@@ -98,7 +98,6 @@ namespace Game.Chat.Commands
return false; return false;
} }
string countStr = args.NextString();
if (!uint.TryParse(args.NextString(), out uint count)) if (!uint.TryParse(args.NextString(), out uint count))
count = 10; count = 10;
+6 -6
View File
@@ -277,7 +277,7 @@ namespace Game.Chat
if (moneyToAdd < 0) if (moneyToAdd < 0)
{ {
ulong newmoney = (targetMoney + (ulong)moneyToAdd); long newmoney = (long)targetMoney + moneyToAdd;
Log.outDebug(LogFilter.ChatSystem, Global.ObjectMgr.GetCypherString(CypherStrings.CurrentMoney), targetMoney, moneyToAdd, newmoney); Log.outDebug(LogFilter.ChatSystem, Global.ObjectMgr.GetCypherString(CypherStrings.CurrentMoney), targetMoney, moneyToAdd, newmoney);
if (newmoney <= 0) if (newmoney <= 0)
@@ -291,13 +291,13 @@ namespace Game.Chat
else else
{ {
ulong moneyToAddMsg = (ulong)(moneyToAdd * -1); ulong moneyToAddMsg = (ulong)(moneyToAdd * -1);
if (newmoney > PlayerConst.MaxMoneyAmount) if (newmoney > (long)PlayerConst.MaxMoneyAmount)
newmoney = PlayerConst.MaxMoneyAmount; newmoney = (long)PlayerConst.MaxMoneyAmount;
handler.SendSysMessage(CypherStrings.YouTakeMoney, Math.Abs(moneyToAdd), handler.GetNameLink(target)); handler.SendSysMessage(CypherStrings.YouTakeMoney, moneyToAddMsg, handler.GetNameLink(target));
if (handler.needReportToTarget(target)) if (handler.needReportToTarget(target))
target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), Math.Abs(moneyToAdd)); target.SendSysMessage(CypherStrings.YoursMoneyTaken, handler.GetNameLink(), moneyToAddMsg);
target.SetMoney(newmoney); target.SetMoney((ulong)newmoney);
} }
} }
else else
@@ -83,8 +83,6 @@ namespace Game.Chat
if (string.IsNullOrEmpty(paramStr)) if (string.IsNullOrEmpty(paramStr))
return false; return false;
int limit = paramStr.Length;
switch (paramStr.ToLower()) switch (paramStr.ToLower())
{ {
case "player": case "player":
+1 -1
View File
@@ -314,7 +314,7 @@ namespace Game.Chat.Commands
return false; return false;
stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Z); stmt = DB.World.GetPreparedStatement(WorldStatements.UPD_WAYPOINT_SCRIPT_Z);
stmt.AddValue(0, args); stmt.AddValue(0, arg3);
stmt.AddValue(1, id); stmt.AddValue(1, id);
DB.World.Execute(stmt); DB.World.Execute(stmt);
+2 -2
View File
@@ -265,7 +265,7 @@ namespace Game.Collision
z_dist = 0f; z_dist = 0f;
if (triangles.Empty() || !iBound.contains(pos)) if (triangles.Empty() || !iBound.contains(pos))
return false; return false;
GModelRayCallback callback = new GModelRayCallback(triangles, vertices);
Vector3 rPos = pos - 0.1f * down; Vector3 rPos = pos - 0.1f * down;
float dist = float.PositiveInfinity; float dist = float.PositiveInfinity;
Ray ray = new Ray(rPos, down); Ray ray = new Ray(rPos, down);
@@ -379,7 +379,7 @@ namespace Game.Collision
if (reader.ReadStringFromChars(4) != "WMOD") if (reader.ReadStringFromChars(4) != "WMOD")
return false; return false;
uint chunkSize = reader.ReadUInt32(); reader.ReadUInt32(); //chunkSize notused
RootWMOID = reader.ReadUInt32(); RootWMOID = reader.ReadUInt32();
// read group models // read group models
@@ -42,8 +42,6 @@ namespace Game.DataStorage
return storage; return storage;
} }
var columnDefs = new StringArray(headers, '\t');
List<T> data = new List<T>(); List<T> data = new List<T>();
data.Add(new T()); // row id 0, unused data.Add(new T()); // row id 0, unused
+1 -1
View File
@@ -187,7 +187,7 @@ namespace Game.DataStorage
continue; continue;
} }
var unknownSize = m2file.ReadUInt32(); //unknown size m2file.ReadUInt32(); //unknown size
// Read header // Read header
M2Header header = m2file.Read<M2Header>(); M2Header header = m2file.Read<M2Header>();
@@ -25,8 +25,6 @@ namespace Game.Entities
{ {
public class FormationMgr public class FormationMgr
{ {
public FormationMgr() { }
public static void AddCreatureToGroup(uint groupId, Creature member) public static void AddCreatureToGroup(uint groupId, Creature member)
{ {
Map map = member.GetMap(); Map map = member.GetMap();
-2
View File
@@ -764,8 +764,6 @@ namespace Game.Misc
public class QuestMenu public class QuestMenu
{ {
public QuestMenu() { }
public void AddMenuItem(uint QuestId, byte Icon) public void AddMenuItem(uint QuestId, byte Icon)
{ {
if (Global.ObjectMgr.GetQuestTemplate(QuestId) == null) if (Global.ObjectMgr.GetQuestTemplate(QuestId) == null)
-6
View File
@@ -105,12 +105,6 @@ namespace Game.Entities
return true; return true;
} }
public override void SaveToDB(SQLTransaction trans)
{
base.SaveToDB(trans);
}
public override bool LoadFromDB(ulong guid, ObjectGuid owner_guid, SQLFields fields, uint entry) public override bool LoadFromDB(ulong guid, ObjectGuid owner_guid, SQLFields fields, uint entry)
{ {
if (!base.LoadFromDB(guid, owner_guid, fields, entry)) if (!base.LoadFromDB(guid, owner_guid, fields, entry))
@@ -180,12 +180,6 @@ namespace Game.Entities
public static bool operator ==(ObjectGuid first, ObjectGuid other) public static bool operator ==(ObjectGuid first, ObjectGuid other)
{ {
if (ReferenceEquals(first, other))
return true;
if ((object)first == null || (object)other == null)
return false;
return first.Equals(other); return first.Equals(other);
} }
+2 -3
View File
@@ -2444,10 +2444,9 @@ namespace Game.Entities
public bool IsInMap(WorldObject obj) public bool IsInMap(WorldObject obj)
{ {
var m = GetMap().GetId();
var b = obj.GetMap().GetId();
if (obj != null) if (obj != null)
return IsInWorld && obj.IsInWorld && m == b; return IsInWorld && obj.IsInWorld && GetMap().GetId() == obj.GetMap().GetId();
return false; return false;
} }
@@ -30,11 +30,6 @@ namespace Game.Entities
{ {
public partial class Player public partial class Player
{ {
public override void SetMap(Map map)
{
base.SetMap(map);
}
public Difficulty GetDifficultyID(MapRecord mapEntry) public Difficulty GetDifficultyID(MapRecord mapEntry)
{ {
if (!mapEntry.IsRaid()) if (!mapEntry.IsRaid())
+6 -3
View File
@@ -1683,9 +1683,12 @@ namespace Game.Entities
} }
bool destroyItem = true; bool destroyItem = true;
foreach (QuestObjective obj in quest.Objectives) if (item.GetStartQuest() == questId)
if (obj.Type == QuestObjectiveType.Item && srcItemId == obj.ObjectID) {
destroyItem = false; foreach (QuestObjective obj in quest.Objectives)
if (obj.Type == QuestObjectiveType.Item && srcItemId == obj.ObjectID)
destroyItem = false;
}
if (destroyItem) if (destroyItem)
DestroyItemCount(srcItemId, count, true, true); DestroyItemCount(srcItemId, count, true, true);
-2
View File
@@ -145,8 +145,6 @@ namespace Game.Entities
{ {
if (!GetThreatManager().isThreatListEmpty()) if (!GetThreatManager().isThreatListEmpty())
{ {
int count = GetThreatManager().getThreatList().Count;
ThreatUpdate packet = new ThreatUpdate(); ThreatUpdate packet = new ThreatUpdate();
packet.UnitGUID = GetGUID(); packet.UnitGUID = GetGUID();
var tlist = GetThreatManager().getThreatList(); var tlist = GetThreatManager().getThreatList();
+18 -16
View File
@@ -370,30 +370,32 @@ namespace Game.Entities
// Set charmed // Set charmed
charmer.SetCharm(this, true); charmer.SetCharm(this, true);
Player player;
if (IsTypeId(TypeId.Unit)) if (IsTypeId(TypeId.Unit))
{ {
ToCreature().GetAI().OnCharmed(true); ToCreature().GetAI().OnCharmed(true);
GetMotionMaster().MoveIdle(); GetMotionMaster().MoveIdle();
} }
else if (player = ToPlayer()) else
{ {
if (player.isAFK()) Player player = ToPlayer();
player.ToggleAFK(); if (player)
Creature creatureCharmer = charmer.ToCreature();
if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature
{ {
// change AI to charmed AI on next Update tick if (player.isAFK())
NeedChangeAI = true; player.ToggleAFK();
if (IsAIEnabled)
{
IsAIEnabled = false;
player.GetAI().OnCharmed(true);
}
}
player.SetClientControl(this, false); if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature
{
// change AI to charmed AI on next Update tick
NeedChangeAI = true;
if (IsAIEnabled)
{
IsAIEnabled = false;
player.GetAI().OnCharmed(true);
}
}
player.SetClientControl(this, false);
}
} }
// charm is set by aura, and aura effect remove handler was called during apply handler execution // charm is set by aura, and aura effect remove handler was called during apply handler execution
+11 -5
View File
@@ -3128,9 +3128,9 @@ namespace Game.Entities
return null; return null;
} }
public List<DispelCharges> GetDispellableAuraList(Unit caster, uint dispelMask) public List<DispelableAura> GetDispellableAuraList(Unit caster, uint dispelMask, bool isReflect = false)
{ {
List<DispelCharges> dispelList = new List<DispelCharges>(); List<DispelableAura> dispelList = new List<DispelableAura>();
var auras = GetOwnedAuras(); var auras = GetOwnedAuras();
foreach (var pair in auras) foreach (var pair in auras)
@@ -3147,8 +3147,14 @@ namespace Game.Entities
if (Convert.ToBoolean(aura.GetSpellInfo().GetDispelMask() & dispelMask)) if (Convert.ToBoolean(aura.GetSpellInfo().GetDispelMask() & dispelMask))
{ {
// do not remove positive auras if friendly target // do not remove positive auras if friendly target
// negative auras if non-friendly target // negative auras if non-friendly
if (aurApp.IsPositive() == IsFriendlyTo(caster)) // unless we're reflecting (dispeller eliminates one of it's benefitial buffs)
if (isReflect != (aurApp.IsPositive() == IsFriendlyTo(caster)))
continue;
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
int chance = aura.CalcDispelChance(this, !IsFriendlyTo(caster));
if (chance == 0)
continue; continue;
// The charges / stack amounts don't count towards the total number of auras that can be dispelled. // The charges / stack amounts don't count towards the total number of auras that can be dispelled.
@@ -3157,7 +3163,7 @@ namespace Game.Entities
bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges); bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges);
byte charges = dispelCharges ? aura.GetCharges() : aura.GetStackAmount(); byte charges = dispelCharges ? aura.GetCharges() : aura.GetStackAmount();
if (charges > 0) if (charges > 0)
dispelList.Add(new DispelCharges(aura, charges)); dispelList.Add(new DispelableAura(aura, chance, charges));
} }
} }
+2 -2
View File
@@ -61,9 +61,9 @@ namespace Game.Entities
InitMovementInfoForBase(); InitMovementInfoForBase();
} }
public virtual void Dispose() public void Dispose()
{ {
/// @Uninstall must be called before this. // @Uninstall must be called before this.
Contract.Assert(_status == Status.UnInstalling); Contract.Assert(_status == Status.UnInstalling);
foreach (var pair in Seats) foreach (var pair in Seats)
Contract.Assert(pair.Value.IsEmpty()); Contract.Assert(pair.Value.IsEmpty());
+4 -1
View File
@@ -589,7 +589,6 @@ namespace Game
public Dictionary<byte, byte> GetClassExpansionRequirements() { return _classExpansionRequirementStorage; } public Dictionary<byte, byte> GetClassExpansionRequirements() { return _classExpansionRequirementStorage; }
public Expansion GetClassExpansionRequirement(Class class_) public Expansion GetClassExpansionRequirement(Class class_)
{ {
var exp = _classExpansionRequirementStorage.LookupByKey(class_);
if (_classExpansionRequirementStorage.ContainsKey((byte)class_)) if (_classExpansionRequirementStorage.ContainsKey((byte)class_))
return (Expansion)_classExpansionRequirementStorage[(byte)class_]; return (Expansion)_classExpansionRequirementStorage[(byte)class_];
return Expansion.Classic; return Expansion.Classic;
@@ -7804,6 +7803,8 @@ namespace Game
AddLocaleString(result.Read<string>(5), locale, data.TitleAlt); AddLocaleString(result.Read<string>(5), locale, data.TitleAlt);
} while (result.NextRow()); } while (result.NextRow());
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} creature locale strings in {1} ms", _creatureLocaleStorage.Count, Time.GetMSTimeDiffToNow(oldMSTime));
} }
public void LoadGameObjectLocales() public void LoadGameObjectLocales()
{ {
@@ -8093,6 +8094,8 @@ namespace Game
AddLocaleString(result.Read<string>(2), locale, data.Name); AddLocaleString(result.Read<string>(2), locale, data.Name);
} }
while (result.NextRow()); while (result.NextRow());
Log.outInfo(LogFilter.ServerLoading, "Loaded {0} points_of_interest locale strings in {1} ms", _pointOfInterestLocaleStorage.Count, Time.GetMSTimeDiffToNow(oldMSTime));
} }
public CreatureLocale GetCreatureLocale(uint entry) public CreatureLocale GetCreatureLocale(uint entry)
+14 -14
View File
@@ -92,21 +92,21 @@ namespace Game.Groups
stmt.AddValue(index++, m_dbStoreId); stmt.AddValue(index++, m_dbStoreId);
stmt.AddValue(index++, m_leaderGuid.GetCounter()); stmt.AddValue(index++, m_leaderGuid.GetCounter());
stmt.AddValue(index++, m_lootMethod); stmt.AddValue(index++, (byte)m_lootMethod);
stmt.AddValue(index++, m_looterGuid.GetCounter()); stmt.AddValue(index++, m_looterGuid.GetCounter());
stmt.AddValue(index++, m_lootThreshold); stmt.AddValue(index++, (byte)m_lootThreshold);
stmt.AddValue(index++, m_targetIcons[0]); stmt.AddValue(index++, m_targetIcons[0].GetRawValue());
stmt.AddValue(index++, m_targetIcons[1]); stmt.AddValue(index++, m_targetIcons[1].GetRawValue());
stmt.AddValue(index++, m_targetIcons[2]); stmt.AddValue(index++, m_targetIcons[2].GetRawValue());
stmt.AddValue(index++, m_targetIcons[3]); stmt.AddValue(index++, m_targetIcons[3].GetRawValue());
stmt.AddValue(index++, m_targetIcons[4]); stmt.AddValue(index++, m_targetIcons[4].GetRawValue());
stmt.AddValue(index++, m_targetIcons[5]); stmt.AddValue(index++, m_targetIcons[5].GetRawValue());
stmt.AddValue(index++, m_targetIcons[6]); stmt.AddValue(index++, m_targetIcons[6].GetRawValue());
stmt.AddValue(index++, m_targetIcons[7]); stmt.AddValue(index++, m_targetIcons[7].GetRawValue());
stmt.AddValue(index++, m_groupFlags); stmt.AddValue(index++, (byte)m_groupFlags);
stmt.AddValue(index++, m_dungeonDifficulty); stmt.AddValue(index++, (byte)m_dungeonDifficulty);
stmt.AddValue(index++, m_raidDifficulty); stmt.AddValue(index++, (byte)m_raidDifficulty);
stmt.AddValue(index++, m_legacyRaidDifficulty); stmt.AddValue(index++, (byte)m_legacyRaidDifficulty);
stmt.AddValue(index++, m_masterLooterGuid.GetCounter()); stmt.AddValue(index++, m_masterLooterGuid.GetCounter());
DB.Characters.Execute(stmt); DB.Characters.Execute(stmt);
+11 -5
View File
@@ -22,6 +22,7 @@ using Game.Entities;
using Game.Network.Packets; using Game.Network.Packets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
namespace Game.Guilds namespace Game.Guilds
{ {
@@ -104,10 +105,11 @@ namespace Game.Guilds
if (!_membershipRequestsByGuild.ContainsKey(guildId)) if (!_membershipRequestsByGuild.ContainsKey(guildId))
_membershipRequestsByGuild[guildId] = new Dictionary<ObjectGuid, MembershipRequest>(); _membershipRequestsByGuild[guildId] = new Dictionary<ObjectGuid, MembershipRequest>();
_membershipRequestsByGuild[guildId][playerId] = request;
if (!_membershipRequestsByPlayer.ContainsKey(playerId)) if (!_membershipRequestsByPlayer.ContainsKey(playerId))
_membershipRequestsByPlayer[playerId] = new Dictionary<ObjectGuid, MembershipRequest>(); _membershipRequestsByPlayer[playerId] = new Dictionary<ObjectGuid, MembershipRequest>();
_membershipRequestsByGuild[guildId][playerId] = request;
_membershipRequestsByPlayer[playerId][guildId] = request; _membershipRequestsByPlayer[playerId][guildId] = request;
++count; ++count;
@@ -118,13 +120,18 @@ namespace Game.Guilds
public void AddMembershipRequest(ObjectGuid guildGuid, MembershipRequest request) public void AddMembershipRequest(ObjectGuid guildGuid, MembershipRequest request)
{ {
if (!_membershipRequestsByGuild.ContainsKey(guildGuid))
_membershipRequestsByGuild[guildGuid] = new Dictionary<ObjectGuid, MembershipRequest>();
_membershipRequestsByGuild[guildGuid][request.GetPlayerGUID()] = request; _membershipRequestsByGuild[guildGuid][request.GetPlayerGUID()] = request;
if (!_membershipRequestsByPlayer.ContainsKey(request.GetPlayerGUID()))
_membershipRequestsByPlayer[request.GetPlayerGUID()] = new Dictionary<ObjectGuid, MembershipRequest>();
_membershipRequestsByPlayer[request.GetPlayerGUID()][guildGuid] = request; _membershipRequestsByPlayer[request.GetPlayerGUID()][guildGuid] = request;
SQLTransaction trans = new SQLTransaction(); SQLTransaction trans = new SQLTransaction();
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_APPLICANT); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_APPLICANT);
stmt.AddValue(0, request.GetGuildGuid()); stmt.AddValue(0, request.GetGuildGuid().GetCounter());
stmt.AddValue(1, request.GetPlayerGUID()); stmt.AddValue(1, request.GetPlayerGUID().GetCounter());
stmt.AddValue(2, request.GetAvailability()); stmt.AddValue(2, request.GetAvailability());
stmt.AddValue(3, request.GetClassRoles()); stmt.AddValue(3, request.GetClassRoles());
stmt.AddValue(4, request.GetInterests()); stmt.AddValue(4, request.GetInterests());
@@ -179,7 +186,6 @@ namespace Game.Guilds
public void RemoveMembershipRequest(ObjectGuid playerId, ObjectGuid guildId) public void RemoveMembershipRequest(ObjectGuid playerId, ObjectGuid guildId)
{ {
if (_membershipRequestsByGuild.ContainsKey(guildId)) if (_membershipRequestsByGuild.ContainsKey(guildId))
{ {
var guildDic = _membershipRequestsByGuild[guildId]; var guildDic = _membershipRequestsByGuild[guildId];
@@ -278,7 +284,7 @@ namespace Game.Guilds
SQLTransaction trans = new SQLTransaction(); SQLTransaction trans = new SQLTransaction();
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_GUILD_SETTINGS); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.REP_GUILD_FINDER_GUILD_SETTINGS);
stmt.AddValue(0, settings.GetGUID()); stmt.AddValue(0, settings.GetGUID().GetCounter());
stmt.AddValue(1, settings.GetAvailability()); stmt.AddValue(1, settings.GetAvailability());
stmt.AddValue(2, settings.GetClassRoles()); stmt.AddValue(2, settings.GetClassRoles());
stmt.AddValue(3, settings.GetInterests()); stmt.AddValue(3, settings.GetInterests());
@@ -90,7 +90,6 @@ namespace Game
/// This is call when player leave battlefield zone. /// This is call when player leave battlefield zone.
/// </summary> /// </summary>
/// <param name="queueId">The queue id of Bf</param> /// <param name="queueId">The queue id of Bf</param>
/// <param name="queueId">The queue id of Bf</param>
/// <param name="battleState">Battlefield status</param> /// <param name="battleState">Battlefield status</param>
/// <param name="relocated">Whether player is added to Bf on the spot or teleported from queue</param> /// <param name="relocated">Whether player is added to Bf on the spot or teleported from queue</param>
/// <param name="reason">Reason why player left battlefield</param> /// <param name="reason">Reason why player left battlefield</param>
-1
View File
@@ -509,7 +509,6 @@ namespace Game
if (save == null) if (save == null)
return; return;
ObjectGuid guid = GetPlayer().GetGUID();
long currTime = Time.UnixTime; long currTime = Time.UnixTime;
CalendarRaidLockoutUpdated packet = new CalendarRaidLockoutUpdated(); CalendarRaidLockoutUpdated packet = new CalendarRaidLockoutUpdated();
+1 -1
View File
@@ -745,7 +745,7 @@ namespace Game
if (_warden == null || packet.Data.GetSize() == 0) if (_warden == null || packet.Data.GetSize() == 0)
return; return;
var unpacked = new ByteBuffer(_warden.DecryptData(packet.Data.GetData())); _warden.DecryptData(packet.Data.GetData());
WardenOpcodes opcode = (WardenOpcodes)packet.Data.ReadUInt8(); WardenOpcodes opcode = (WardenOpcodes)packet.Data.ReadUInt8();
switch (opcode) switch (opcode)
+7 -4
View File
@@ -287,7 +287,6 @@ namespace Game
// only add to bg group and object, if the player was invited (else he entered through command) // only add to bg group and object, if the player was invited (else he entered through command)
if (GetPlayer().InBattleground()) if (GetPlayer().InBattleground())
{ {
Battleground bg;
// cleanup setting if outdated // cleanup setting if outdated
if (!mapEntry.IsBattlegroundOrArena()) if (!mapEntry.IsBattlegroundOrArena())
{ {
@@ -297,10 +296,14 @@ namespace Game
GetPlayer().SetBGTeam(0); GetPlayer().SetBGTeam(0);
} }
// join to bg case // join to bg case
else if (bg = GetPlayer().GetBattleground()) else
{ {
if (GetPlayer().IsInvitedForBattlegroundInstance(GetPlayer().GetBattlegroundId())) Battleground bg = GetPlayer().GetBattleground();
bg.AddPlayer(GetPlayer()); if (bg)
{
if (GetPlayer().IsInvitedForBattlegroundInstance(GetPlayer().GetBattlegroundId()))
bg.AddPlayer(GetPlayer());
}
} }
} }
+1 -2
View File
@@ -255,7 +255,7 @@ namespace Game
} }
ObjectGuid ownerGuid = ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0)); ObjectGuid ownerGuid = ObjectGuid.Create(HighGuid.Player, result.Read<ulong>(0));
ulong signs = result.Read<ulong>(1); //ulong signs = result.Read<ulong>(1);
if (ownerGuid == GetPlayer().GetGUID()) if (ownerGuid == GetPlayer().GetGUID())
return; return;
@@ -267,7 +267,6 @@ namespace Game
return; return;
} }
if (GetPlayer().GetGuildId() != 0) if (GetPlayer().GetGuildId() != 0)
{ {
Guild.SendCommandResult(this, GuildCommandType.InvitePlayer, GuildCommandError.AlreadyInGuild_S, GetPlayer().GetName()); Guild.SendCommandResult(this, GuildCommandType.InvitePlayer, GuildCommandError.AlreadyInGuild_S, GetPlayer().GetName());
+19 -12
View File
@@ -97,15 +97,18 @@ namespace Game
vehicle_base.m_movementInfo = packet.Status; vehicle_base.m_movementInfo = packet.Status;
Unit vehUnit;
if (packet.DstVehicle.IsEmpty()) if (packet.DstVehicle.IsEmpty())
GetPlayer().ChangeSeat(-1, packet.DstSeatIndex != 255); GetPlayer().ChangeSeat(-1, packet.DstSeatIndex != 255);
else if (vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.DstVehicle)) else
{ {
Vehicle vehicle = vehUnit.GetVehicleKit(); Unit vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.DstVehicle);
if (vehicle) if (vehUnit)
if (vehicle.HasEmptySeat((sbyte)packet.DstSeatIndex)) {
vehUnit.HandleSpellClick(GetPlayer(), (sbyte)packet.DstSeatIndex); Vehicle vehicle = vehUnit.GetVehicleKit();
if (vehicle)
if (vehicle.HasEmptySeat((sbyte) packet.DstSeatIndex))
vehUnit.HandleSpellClick(GetPlayer(), (sbyte) packet.DstSeatIndex);
}
} }
} }
@@ -123,15 +126,19 @@ namespace Game
GetPlayer().GetGUID().ToString(), seat.Flags); GetPlayer().GetGUID().ToString(), seat.Flags);
return; return;
} }
Unit vehUnit;
if (vehicle_base.GetGUID() == packet.Vehicle) if (vehicle_base.GetGUID() == packet.Vehicle)
GetPlayer().ChangeSeat((sbyte)packet.SeatIndex); GetPlayer().ChangeSeat((sbyte)packet.SeatIndex);
else if (vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Vehicle)) else
{ {
Vehicle vehicle = vehUnit.GetVehicleKit(); Unit vehUnit = Global.ObjAccessor.GetUnit(GetPlayer(), packet.Vehicle);
if (vehicle) if (vehUnit)
if (vehicle.HasEmptySeat((sbyte)packet.SeatIndex)) {
vehUnit.HandleSpellClick(GetPlayer(), (sbyte)packet.SeatIndex); Vehicle vehicle = vehUnit.GetVehicleKit();
if (vehicle)
if (vehicle.HasEmptySeat((sbyte) packet.SeatIndex))
vehUnit.HandleSpellClick(GetPlayer(), (sbyte) packet.SeatIndex);
}
} }
} }
+7 -2
View File
@@ -156,18 +156,23 @@ namespace Game.Maps
{ {
return (p1.x_coord == p2.x_coord && p1.y_coord == p2.y_coord); return (p1.x_coord == p2.x_coord && p1.y_coord == p2.y_coord);
} }
public static bool operator !=(CellCoord p1, CellCoord p2) public static bool operator !=(CellCoord p1, CellCoord p2)
{ {
return !(p1 == p2); return !(p1 == p2);
} }
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return base.Equals(obj); if (obj is CellCoord)
return (CellCoord)obj == this;
return false;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return base.GetHashCode(); return x_coord.GetHashCode() ^ y_coord.GetHashCode();
} }
public uint x_coord { get; set; } public uint x_coord { get; set; }
+9 -9
View File
@@ -160,15 +160,15 @@ namespace Game.Maps
float[][] boundGridCoords = float[][] boundGridCoords =
{ {
new float[] { 0.0f, 0.0f }, new [] { 0.0f, 0.0f },
new float[] { 0.0f, -266.66666f }, new [] { 0.0f, -266.66666f },
new float[] { 0.0f, -533.33331f }, new [] { 0.0f, -533.33331f },
new float[] { -266.66666f, 0.0f }, new [] { -266.66666f, 0.0f },
new float[] { -266.66666f, -266.66666f }, new [] { -266.66666f, -266.66666f },
new float[] { -266.66666f, -533.33331f }, new [] { -266.66666f, -533.33331f },
new float[] { -533.33331f, 0.0f }, new [] { -533.33331f, 0.0f },
new float[] { -533.33331f, -266.66666f }, new [] { -533.33331f, -266.66666f },
new float[] { -533.33331f, -533.33331f } new [] { -533.33331f, -533.33331f }
}; };
_minHeightPlanes = new Plane[8]; _minHeightPlanes = new Plane[8];
+2 -3
View File
@@ -398,15 +398,14 @@ namespace Game.Maps
void ReadSaveDataBossStates(StringArguments data) void ReadSaveDataBossStates(StringArguments data)
{ {
uint bossId = 0; foreach (var pair in bosses)
foreach (var i in bosses)
{ {
EncounterState buff = (EncounterState)data.NextUInt32(); EncounterState buff = (EncounterState)data.NextUInt32();
if (buff == EncounterState.InProgress || buff == EncounterState.Fail || buff == EncounterState.Special) if (buff == EncounterState.InProgress || buff == EncounterState.Fail || buff == EncounterState.Special)
buff = EncounterState.NotStarted; buff = EncounterState.NotStarted;
if (buff < EncounterState.ToBeDecided) if (buff < EncounterState.ToBeDecided)
SetBossState(bossId++, buff); SetBossState(pair.Key, buff);
} }
} }
@@ -84,7 +84,7 @@ namespace Game.Movement
return true; return true;
} }
public void _setRandomLocation(Creature creature) void _setRandomLocation(Creature creature)
{ {
if (creature.IsMovementPreventedByCasting()) if (creature.IsMovementPreventedByCasting())
{ {
@@ -372,8 +372,6 @@ namespace Game.Movement
public class FlightPathMovementGenerator : MovementGeneratorMedium<Player> public class FlightPathMovementGenerator : MovementGeneratorMedium<Player>
{ {
public FlightPathMovementGenerator() { }
public void LoadPath(Player player, uint startNode = 0) public void LoadPath(Player player, uint startNode = 0)
{ {
i_path.Clear(); i_path.Clear();
+3 -3
View File
@@ -758,10 +758,10 @@ namespace Game.Movement
return (movement == staticIdleMovement); return (movement == staticIdleMovement);
} }
static uint splineId = 0; static uint splineId;
public Unit _owner { get; private set; } Unit _owner { get; }
protected IMovementGenerator[] _slot = new IMovementGenerator[(int)MovementSlot.Max]; IMovementGenerator[] _slot = new IMovementGenerator[(int)MovementSlot.Max];
MMCleanFlag _cleanFlag; MMCleanFlag _cleanFlag;
bool[] _initialize = new bool[(int)MovementSlot.Max]; bool[] _initialize = new bool[(int)MovementSlot.Max];
int _top; int _top;
@@ -302,9 +302,9 @@ namespace Game.Network.Packets
JoinAsGroup = _worldPacket.HasBit(); JoinAsGroup = _worldPacket.HasBit();
} }
public bool JoinAsGroup = false; public bool JoinAsGroup;
public byte Roles = 0; public byte Roles;
public ulong QueueID = 0; public ulong QueueID;
public int[] BlacklistMap = new int[2]; public int[] BlacklistMap = new int[2];
} }
+13 -13
View File
@@ -627,7 +627,7 @@ namespace Game.Network.Packets
} }
public ObjectGuid Guid; // Guid of the player that is logging in public ObjectGuid Guid; // Guid of the player that is logging in
float FarClip = 0.0f; // Visibility distance (for terrain) float FarClip; // Visibility distance (for terrain)
} }
public class LoginVerifyWorld : ServerPacket public class LoginVerifyWorld : ServerPacket
@@ -1036,13 +1036,13 @@ namespace Game.Network.Packets
public Race RaceId = Race.None; public Race RaceId = Race.None;
public Class ClassId = Class.None; public Class ClassId = Class.None;
public Gender Sex = Gender.None; public Gender Sex = Gender.None;
public byte Skin = 0; public byte Skin;
public byte Face = 0; public byte Face;
public byte HairStyle = 0; public byte HairStyle;
public byte HairColor = 0; public byte HairColor;
public byte FacialHairStyle = 0; public byte FacialHairStyle;
public Array<byte> CustomDisplay = new Array<byte>(PlayerConst.CustomDisplaySize); public Array<byte> CustomDisplay = new Array<byte>(PlayerConst.CustomDisplaySize);
public byte OutfitId = 0; public byte OutfitId;
public Optional<uint> TemplateSet = new Optional<uint>(); public Optional<uint> TemplateSet = new Optional<uint>();
public string Name; public string Name;
@@ -1058,14 +1058,14 @@ namespace Game.Network.Packets
public class CharCustomizeInfo public class CharCustomizeInfo
{ {
public byte HairStyleID = 0; public byte HairStyleID;
public byte FaceID = 0; public byte FaceID;
public ObjectGuid CharGUID; public ObjectGuid CharGUID;
public Gender SexID = Gender.None; public Gender SexID = Gender.None;
public string CharName; public string CharName;
public byte HairColorID = 0; public byte HairColorID;
public byte FacialHairStyleID = 0; public byte FacialHairStyleID;
public byte SkinID = 0; public byte SkinID;
public Array<byte> CustomDisplay = new Array<byte>(PlayerConst.CustomDisplaySize); public Array<byte> CustomDisplay = new Array<byte>(PlayerConst.CustomDisplaySize);
} }
@@ -1077,7 +1077,7 @@ namespace Game.Network.Packets
public byte SkinID; public byte SkinID;
public byte FacialHairStyleID; public byte FacialHairStyleID;
public ObjectGuid Guid; public ObjectGuid Guid;
public bool FactionChange = false; public bool FactionChange;
public string Name; public string Name;
public byte FaceID; public byte FaceID;
public byte HairStyleID; public byte HairStyleID;
+1 -1
View File
@@ -276,7 +276,7 @@ namespace Game.Network.Packets
public string Prefix = ""; public string Prefix = "";
public string Channel = ""; public string Channel = "";
public string ChatText = ""; public string ChatText = "";
public uint AchievementID = 0; public uint AchievementID;
public ChatFlags _ChatFlags = 0; public ChatFlags _ChatFlags = 0;
public float DisplayTime = 0.0f; public float DisplayTime = 0.0f;
public bool HideChatLog = false; public bool HideChatLog = false;
@@ -106,8 +106,8 @@ namespace Game.Network.Packets
} }
public ObjectGuid PlayerGuid; public ObjectGuid PlayerGuid;
public uint Time = 0; // UnixTime public uint Time; // UnixTime
public uint Size = 0; // decompressed size public uint Size; // decompressed size
public AccountDataTypes DataType = 0; public AccountDataTypes DataType = 0;
public ByteBuffer CompressedData; public ByteBuffer CompressedData;
} }
+1 -1
View File
@@ -92,7 +92,7 @@ namespace Game.Network.Packets
public ObjectGuid Attacker; public ObjectGuid Attacker;
public ObjectGuid Victim; public ObjectGuid Victim;
public bool NowDead = false; public bool NowDead;
} }
public class ThreatUpdate : ServerPacket public class ThreatUpdate : ServerPacket
@@ -138,7 +138,7 @@ namespace Game.Network.Packets
Bracket.ForEach(p => p.Write(_worldPacket)); Bracket.ForEach(p => p.Write(_worldPacket));
} }
public List<PVPBracketData> Bracket; public List<PVPBracketData> Bracket = new List<PVPBracketData>();
public ObjectGuid ClientGUID; public ObjectGuid ClientGUID;
} }
@@ -91,7 +91,7 @@ namespace Game.Network.Packets
for (uint i = 0; i < removeMovementForcesCount; ++i) for (uint i = 0; i < removeMovementForcesCount; ++i)
{ {
ObjectGuid guid = data.ReadPackedGuid(); data.ReadPackedGuid();
} }
// ResetBitReader // ResetBitReader
@@ -676,8 +676,8 @@ namespace Game.Network.Packets
} }
public ObjectGuid MoverGUID; public ObjectGuid MoverGUID;
int AckIndex = 0; int AckIndex;
int MoveTime = 0; int MoveTime;
} }
public class MovementAckMessage : ClientPacket public class MovementAckMessage : ClientPacket
@@ -34,7 +34,7 @@ namespace Game.Network.Packets
} }
public ObjectGuid ItemGUID; public ObjectGuid ItemGUID;
public uint PetitionID = 0; public uint PetitionID;
} }
public class QueryPetitionResponse : ServerPacket public class QueryPetitionResponse : ServerPacket
@@ -156,7 +156,7 @@ namespace Game.Network.Packets
} }
public ObjectGuid PetitionGUID; public ObjectGuid PetitionGUID;
public byte Choice = 0; public byte Choice;
} }
public class PetitionSignResults : ServerPacket public class PetitionSignResults : ServerPacket
+2 -2
View File
@@ -104,8 +104,8 @@ namespace Game.Network.Packets
ModCooldown = cooldown; ModCooldown = cooldown;
} }
public uint Category = 0; // SpellCategory Id public uint Category; // SpellCategory Id
public int ModCooldown = 0; // Reduced Cooldown in ms public int ModCooldown; // Reduced Cooldown in ms
} }
} }
+2 -2
View File
@@ -116,8 +116,8 @@ namespace Game.Network.Packets
public ObjectGuid Vendor; public ObjectGuid Vendor;
public uint Node; public uint Node;
public uint GroundMountID = 0; public uint GroundMountID;
public uint FlyingMountID = 0; public uint FlyingMountID;
} }
class NewTaxiPath : ServerPacket class NewTaxiPath : ServerPacket
+6 -2
View File
@@ -249,11 +249,15 @@ namespace Game
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
return base.Equals(obj); if (obj is PhaseRef)
return (PhaseRef)obj == this;
return false;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return base.GetHashCode(); return Id.GetHashCode() ^ Flags.GetHashCode() ^ References.GetHashCode() ^ AreaConditions.GetHashCode();
} }
} }
-1
View File
@@ -337,7 +337,6 @@ namespace Game
foreach (AuraEffect aurEff in unit.GetAuraEffectsByType(AuraType.Phase)) foreach (AuraEffect aurEff in unit.GetAuraEffectsByType(AuraType.Phase))
{ {
uint phaseId = (uint)aurEff.GetMiscValueB(); uint phaseId = (uint)aurEff.GetMiscValueB();
var eraseResult = newSuppressions.RemovePhase(phaseId);
// if condition was met previously there is nothing to erase // if condition was met previously there is nothing to erase
if (newSuppressions.RemovePhase(phaseId)) if (newSuppressions.RemovePhase(phaseId))
phaseShift.AddPhase(phaseId, GetPhaseFlags(phaseId), null);//todo needs checked phaseShift.AddPhase(phaseId, GetPhaseFlags(phaseId), null);//todo needs checked
+1 -1
View File
@@ -40,7 +40,7 @@ namespace Game
Values[WorldCfg.EnableSinfoLogin] = GetDefaultValue("Server.LoginInfo", 0); Values[WorldCfg.EnableSinfoLogin] = GetDefaultValue("Server.LoginInfo", 0);
// Read all rates from the config file // Read all rates from the config file
Action<WorldCfg, string> setRegenRate = (WorldCfg rate, string configKey) => Action<WorldCfg, string> setRegenRate = (rate, configKey) =>
{ {
Values[rate] = GetDefaultValue(configKey, 1.0f); Values[rate] = GetDefaultValue(configKey, 1.0f);
if ((float)Values[rate] < 0.0f) if ((float)Values[rate] < 0.0f)
-4
View File
@@ -984,8 +984,6 @@ namespace Game
class AccountInfoQueryHolderPerRealm : SQLQueryHolder<AccountInfoQueryLoad> class AccountInfoQueryHolderPerRealm : SQLQueryHolder<AccountInfoQueryLoad>
{ {
public AccountInfoQueryHolderPerRealm() { }
public void Initialize(uint accountId, uint battlenetAccountId) public void Initialize(uint accountId, uint battlenetAccountId)
{ {
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ACCOUNT_DATA); PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_ACCOUNT_DATA);
@@ -1000,8 +998,6 @@ namespace Game
class AccountInfoQueryHolder : SQLQueryHolder<AccountInfoQueryLoad> class AccountInfoQueryHolder : SQLQueryHolder<AccountInfoQueryLoad>
{ {
public AccountInfoQueryHolder() { }
public void Initialize(uint accountId, uint battlenetAccountId) public void Initialize(uint accountId, uint battlenetAccountId)
{ {
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOYS); PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_TOYS);
+1 -3
View File
@@ -5999,7 +5999,7 @@ namespace Game.Spells
if (apply) if (apply)
{ {
AreaTrigger areaTrigger = AreaTrigger.CreateAreaTrigger((uint)GetMiscValue(), GetCaster(), target, GetSpellInfo(), target, GetBase().GetDuration(), GetBase().GetSpellXSpellVisualId(), ObjectGuid.Empty, this); AreaTrigger.CreateAreaTrigger((uint)GetMiscValue(), GetCaster(), target, GetSpellInfo(), target, GetBase().GetDuration(), GetBase().GetSpellXSpellVisualId(), ObjectGuid.Empty, this);
} }
else else
{ {
@@ -6029,8 +6029,6 @@ namespace Game.Spells
class AbsorbAuraOrderPred : Comparer<AuraEffect> class AbsorbAuraOrderPred : Comparer<AuraEffect>
{ {
public AbsorbAuraOrderPred() { }
public override int Compare(AuraEffect aurEffA, AuraEffect aurEffB) public override int Compare(AuraEffect aurEffA, AuraEffect aurEffB)
{ {
SpellInfo spellProtoA = aurEffA.GetSpellInfo(); SpellInfo spellProtoA = aurEffA.GetSpellInfo();
+2 -1
View File
@@ -1854,6 +1854,7 @@ namespace Game.Spells
// Need init unitTarget by default unit (can changed in code on reflect) // Need init unitTarget by default unit (can changed in code on reflect)
// Or on missInfo != SPELL_MISS_NONE unitTarget undefined (but need in trigger subsystem) // Or on missInfo != SPELL_MISS_NONE unitTarget undefined (but need in trigger subsystem)
unitTarget = unit; unitTarget = unit;
targetMissInfo = missInfo;
// Reset damage/healing counter // Reset damage/healing counter
m_damage = target.damage; m_damage = target.damage;
@@ -2416,7 +2417,6 @@ namespace Game.Spells
{ {
if (Convert.ToBoolean(channelAuraMask & ihit.effectMask)) if (Convert.ToBoolean(channelAuraMask & ihit.effectMask))
{ {
var b = unit.GetGUID();
AuraApplication aurApp = unit.GetAuraApplication(m_spellInfo.Id, m_originalCasterGUID); AuraApplication aurApp = unit.GetAuraApplication(m_spellInfo.Id, m_originalCasterGUID);
if (aurApp != null) if (aurApp != null)
{ {
@@ -7282,6 +7282,7 @@ namespace Game.Spells
public GameObject gameObjTarget; public GameObject gameObjTarget;
public WorldLocation destTarget; public WorldLocation destTarget;
public int damage; public int damage;
SpellMissInfo targetMissInfo;
float variance; float variance;
SpellEffectHandleMode effectHandleMode; SpellEffectHandleMode effectHandleMode;
public SpellEffectInfo effectInfo; public SpellEffectInfo effectInfo;
+72 -46
View File
@@ -1904,12 +1904,15 @@ namespace Game.Spells
uint dispel_type = (uint)effectInfo.MiscValue; uint dispel_type = (uint)effectInfo.MiscValue;
uint dispelMask = SpellInfo.GetDispelMask((DispelType)dispel_type); uint dispelMask = SpellInfo.GetDispelMask((DispelType)dispel_type);
List<DispelCharges> dispel_list = unitTarget.GetDispellableAuraList(m_caster, dispelMask); List<DispelableAura> dispelList = unitTarget.GetDispellableAuraList(m_caster, dispelMask, targetMissInfo == SpellMissInfo.Reflect);
if (dispel_list.Empty()) if (dispelList.Empty())
return; return;
int remaining = dispelList.Count();
// Ok if exist some buffs for dispel try dispel it // Ok if exist some buffs for dispel try dispel it
List<DispelCharges> success_list = new List<DispelCharges>(); uint failCount = 0;
List<DispelableAura> successList = new List<DispelableAura>();
DispelFailed dispelFailed = new DispelFailed(); DispelFailed dispelFailed = new DispelFailed();
dispelFailed.CasterGUID = m_caster.GetGUID(); dispelFailed.CasterGUID = m_caster.GetGUID();
@@ -1917,49 +1920,44 @@ namespace Game.Spells
dispelFailed.SpellID = m_spellInfo.Id; dispelFailed.SpellID = m_spellInfo.Id;
// dispel N = damage buffs (or while exist buffs for dispel) // dispel N = damage buffs (or while exist buffs for dispel)
for (int count = 0; count < damage && !dispel_list.Empty();) for (int count = 0; count < damage && remaining > 0;)
{ {
// Random select buff for dispel // Random select buff for dispel
var pair = dispel_list[RandomHelper.IRand(0, dispel_list.Count - 1)]; var dispelableAura = dispelList[RandomHelper.IRand(0, dispelList.Count - 1)];
int chance = pair.aura.CalcDispelChance(unitTarget, !unitTarget.IsFriendlyTo(m_caster)); if (dispelableAura.RollDispel())
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
if (chance == 0)
{ {
dispel_list.Remove(pair); var successItr = successList.Find(dispelAura =>
continue; {
if (dispelAura.GetAura().GetId() == dispelableAura.GetAura().GetId())
return true;
return false;
});
if (successItr == null)
successList.Add(new DispelableAura(dispelableAura.GetAura(), 0, 1));
else
successItr.IncrementCharges();
if (!dispelableAura.DecrementCharge())
{
--remaining;
dispelList[remaining] = dispelableAura;
}
} }
else else
{ {
if (RandomHelper.randChance(chance)) ++failCount;
{ dispelFailed.FailedSpells.Add(dispelableAura.GetAura().GetId());
bool alreadyListed = false;
foreach (var successPair in success_list)
{
var successValue = successPair.value;
if (successPair.aura.GetId() == pair.aura.GetId())
{
++successPair.value;
alreadyListed = true;
}
}
if (!alreadyListed)
success_list.Add(new DispelCharges(pair.aura, 1));
--pair.value;
if (pair.value <= 0)
dispel_list.Remove(pair);
}
else
dispelFailed.FailedSpells.Add(pair.aura.GetId());
++count;
} }
++count;
} }
if (!dispelFailed.FailedSpells.Empty()) if (!dispelFailed.FailedSpells.Empty())
m_caster.SendMessageToSet(dispelFailed, true); m_caster.SendMessageToSet(dispelFailed, true);
if (success_list.Empty()) if (successList.Empty())
return; return;
SpellDispellLog spellDispellLog = new SpellDispellLog(); SpellDispellLog spellDispellLog = new SpellDispellLog();
@@ -1970,15 +1968,15 @@ namespace Game.Spells
spellDispellLog.CasterGUID = m_caster.GetGUID(); spellDispellLog.CasterGUID = m_caster.GetGUID();
spellDispellLog.DispelledBySpellID = m_spellInfo.Id; spellDispellLog.DispelledBySpellID = m_spellInfo.Id;
foreach (var dispellCharge in success_list) foreach (var dispelableAura in successList)
{ {
var dispellData = new SpellDispellData(); var dispellData = new SpellDispellData();
dispellData.SpellID = dispellCharge.aura.GetId(); dispellData.SpellID = dispelableAura.GetAura().GetId();
dispellData.Harmful = false; // TODO: use me dispellData.Harmful = false; // TODO: use me
//dispellData.Rolled = none; // TODO: use me //dispellData.Rolled = none; // TODO: use me
//dispellData.Needed = none; // TODO: use me //dispellData.Needed = none; // TODO: use me
unitTarget.RemoveAurasDueToSpellByDispel(dispellCharge.aura.GetId(), m_spellInfo.Id, dispellCharge.aura.GetCasterGUID(), m_caster, dispellCharge.value); unitTarget.RemoveAurasDueToSpellByDispel(dispelableAura.GetAura().GetId(), m_spellInfo.Id, dispelableAura.GetAura().GetCasterGUID(), m_caster, dispelableAura.GetDispelCharges());
spellDispellLog.DispellData.Add(dispellData); spellDispellLog.DispellData.Add(dispellData);
} }
@@ -5056,7 +5054,7 @@ namespace Game.Spells
float radius = 5.0f; float radius = 5.0f;
int duration = m_spellInfo.CalcDuration(m_originalCaster); int duration = m_spellInfo.CalcDuration(m_originalCaster);
TempSummonType summonType = (duration == 0) ? TempSummonType.DeadDespawn : TempSummonType.TimedDespawn; //TempSummonType summonType = (duration == 0) ? TempSummonType.DeadDespawn : TempSummonType.TimedDespawn;
Map map = caster.GetMap(); Map map = caster.GetMap();
for (uint count = 0; count < numGuardians; ++count) for (uint count = 0; count < numGuardians; ++count)
@@ -5389,9 +5387,6 @@ namespace Game.Spells
if (!m_targets.HasDst()) if (!m_targets.HasDst())
return; return;
// trigger entry/miscvalue relation is currently unknown, for now use MiscValue as trigger entry
uint triggerEntry = (uint)effectInfo.MiscValue;
int duration = GetSpellInfo().CalcDuration(GetCaster()); int duration = GetSpellInfo().CalcDuration(GetCaster());
AreaTrigger.CreateAreaTrigger((uint)effectInfo.MiscValue, GetCaster(), null, GetSpellInfo(), destTarget.GetPosition(), duration, m_SpellVisual, m_castId); AreaTrigger.CreateAreaTrigger((uint)effectInfo.MiscValue, GetCaster(), null, GetSpellInfo(), destTarget.GetPosition(), duration, m_SpellVisual, m_castId);
} }
@@ -5752,15 +5747,46 @@ namespace Game.Spells
} }
} }
public class DispelCharges public class DispelableAura
{ {
public DispelCharges(Aura _aura, byte _value) public DispelableAura(Aura aura, int dispelChance, byte dispelCharges)
{ {
aura = _aura; _aura = aura;
value = _value; _chance = dispelChance;
_charges = dispelCharges;
} }
public Aura aura; public bool RollDispel()
public byte value; {
return RandomHelper.randChance(_chance);
}
public Aura GetAura()
{
return _aura;
}
public byte GetDispelCharges()
{
return _charges;
}
public void IncrementCharges()
{
++_charges;
}
public bool DecrementCharge()
{
if (_charges == 0)
return false;
--_charges;
return _charges > 0;
}
Aura _aura;
int _chance;
byte _charges;
} }
} }
+3 -3
View File
@@ -117,7 +117,7 @@ namespace Game.SupportSystem
string _note; string _note;
public BugTicket() : base() public BugTicket()
{ {
_note = ""; _note = "";
} }
@@ -217,7 +217,7 @@ namespace Game.SupportSystem
SupportTicketSubmitComplaint.SupportTicketChatLog _chatLog; SupportTicketSubmitComplaint.SupportTicketChatLog _chatLog;
string _note; string _note;
public ComplaintTicket() : base() public ComplaintTicket()
{ {
_note = ""; _note = "";
} }
@@ -359,7 +359,7 @@ namespace Game.SupportSystem
float _facing; float _facing;
string _note; string _note;
public SuggestionTicket() : base() public SuggestionTicket()
{ {
_note = ""; _note = "";
} }
+1 -2
View File
@@ -119,10 +119,9 @@ namespace Game
} }
} }
public byte[] DecryptData(byte[] buffer) public void DecryptData(byte[] buffer)
{ {
_inputCrypto.ProcessBuffer(buffer, buffer.Length); _inputCrypto.ProcessBuffer(buffer, buffer.Length);
return buffer;
} }
public ByteBuffer EncryptData(byte[] buffer) public ByteBuffer EncryptData(byte[] buffer)
-5
View File
@@ -167,11 +167,6 @@ namespace Scripts.Kalimdor.ZoneAshenvale
break; break;
} }
} }
public override void UpdateAI(uint diff)
{
base.UpdateAI(diff);
}
} }
[Script] [Script]
@@ -823,7 +823,7 @@ namespace Scripts.Northrend.AzjolNerub.AzjolNerub.Nadronox
[Script("spell_hadronox_periodic_summon_necromancer", SpellIds.SummonNecromancerTop, SpellIds.SummonNecromancerBottom)] [Script("spell_hadronox_periodic_summon_necromancer", SpellIds.SummonNecromancerTop, SpellIds.SummonNecromancerBottom)]
class spell_hadronox_periodic_summon_template : AuraScript class spell_hadronox_periodic_summon_template : AuraScript
{ {
public spell_hadronox_periodic_summon_template(uint topSpellId, uint bottomSpellId) : base() public spell_hadronox_periodic_summon_template(uint topSpellId, uint bottomSpellId)
{ {
_topSpellId = topSpellId; _topSpellId = topSpellId;
_bottomSpellId = bottomSpellId; _bottomSpellId = bottomSpellId;
+1 -1
View File
@@ -368,7 +368,7 @@ namespace Scripts.Spells.Holiday
[Script("spell_gen_candied_sweet_potato", SpellIds.WellFedHasteTrigger)] [Script("spell_gen_candied_sweet_potato", SpellIds.WellFedHasteTrigger)]
class spell_pilgrims_bounty_buff_food : AuraScript class spell_pilgrims_bounty_buff_food : AuraScript
{ {
public spell_pilgrims_bounty_buff_food(uint triggeredSpellId) : base() public spell_pilgrims_bounty_buff_food(uint triggeredSpellId)
{ {
_triggeredSpellId = triggeredSpellId; _triggeredSpellId = triggeredSpellId;
_handled = false; _handled = false;
+1 -1
View File
@@ -522,7 +522,7 @@ namespace Scripts.Spells.Mage
if (!unit) if (!unit)
return true; return true;
return unit.HasAura(SpellIds.RingOfFrostDummy) || unit.HasAura(SpellIds.RingOfFrostFreeze) || unit.GetExactDist(GetExplTargetDest()) > outRadius || unit.GetExactDist(GetExplTargetDest()) < inRadius; return unit.HasAura(SpellIds.RingOfFrostDummy) || unit.HasAura(SpellIds.RingOfFrostFreeze) || unit.GetExactDist(dest) > outRadius || unit.GetExactDist(dest) < inRadius;
}); });
} }
+1 -1
View File
@@ -182,7 +182,7 @@ namespace Scripts.Spells.Shaman
AfterCast.Add(new CastHandler(TriggerCleaveBuff)); AfterCast.Add(new CastHandler(TriggerCleaveBuff));
} }
int _targetsHit = 0; int _targetsHit;
} }
[Script] // 204288 - Earth Shield [Script] // 204288 - Earth Shield
+1 -1
View File
@@ -831,7 +831,7 @@ namespace Scripts.Spells.Warlock
List<uint> _dotList = new List<uint>(); List<uint> _dotList = new List<uint>();
Unit _swapCaster = null; Unit _swapCaster;
} }
[Script] //! Soul Swap Copy Spells - 92795 - Simply copies spell IDs. [Script] //! Soul Swap Copy Spells - 92795 - Simply copies spell IDs.
+1 -1
View File
@@ -697,7 +697,7 @@ namespace Scripts.Spells.Warrior
AfterCast.Add(new CastHandler(HandleAfterCast)); AfterCast.Add(new CastHandler(HandleAfterCast));
} }
uint _targetCount = 0; uint _targetCount;
} }
[Script] // 107570 - Storm Bolt [Script] // 107570 - Storm Bolt
+1 -1
View File
@@ -1081,7 +1081,7 @@ namespace Scripts.World
}); });
} }
uint rnd = 0; uint rnd;
uint musicTime = 1000; uint musicTime = 1000;
} }