More Cleanups
This commit is contained in:
@@ -1,9 +1,6 @@
|
|||||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using BNetServer;
|
using BNetServer;
|
||||||
|
|
||||||
public static class Global
|
public static class Global
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
using System;
|
using Framework.Configuration;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using Framework.Networking;
|
|
||||||
using System.Net.Sockets;
|
|
||||||
using Framework.Web;
|
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Framework.Database;
|
using Framework.Database;
|
||||||
using Framework.Configuration;
|
using Framework.Networking;
|
||||||
using Framework.Serialization;
|
using Framework.Serialization;
|
||||||
|
using Framework.Web;
|
||||||
|
using System;
|
||||||
|
using System.Net.Sockets;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace BNetServer.Networking
|
namespace BNetServer.Networking
|
||||||
{
|
{
|
||||||
@@ -53,7 +52,7 @@ namespace BNetServer.Networking
|
|||||||
public void HandleLoginRequest(HttpHeader request)
|
public void HandleLoginRequest(HttpHeader request)
|
||||||
{
|
{
|
||||||
LogonData loginForm = Json.CreateObject<LogonData>(request.Content);
|
LogonData loginForm = Json.CreateObject<LogonData>(request.Content);
|
||||||
LogonResult loginResult = new LogonResult();
|
LogonResult loginResult = new();
|
||||||
if (loginForm == null)
|
if (loginForm == null)
|
||||||
{
|
{
|
||||||
loginResult.AuthenticationState = "LOGIN";
|
loginResult.AuthenticationState = "LOGIN";
|
||||||
@@ -96,7 +95,7 @@ namespace BNetServer.Networking
|
|||||||
{
|
{
|
||||||
if (loginTicket.IsEmpty() || loginTicketExpiry < Time.UnixTime)
|
if (loginTicket.IsEmpty() || loginTicketExpiry < Time.UnixTime)
|
||||||
{
|
{
|
||||||
byte[] ticket = new byte[0].GenerateRandomKey(20);
|
byte[] ticket = Array.Empty<byte>().GenerateRandomKey(20);
|
||||||
loginTicket = "TC-" + ticket.ToHexString();
|
loginTicket = "TC-" + ticket.ToHexString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +116,7 @@ namespace BNetServer.Networking
|
|||||||
|
|
||||||
if (maxWrongPassword != 0)
|
if (maxWrongPassword != 0)
|
||||||
{
|
{
|
||||||
SQLTransaction trans = new SQLTransaction();
|
SQLTransaction trans = new();
|
||||||
stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetFailedLogins);
|
stmt = DB.Login.GetPreparedStatement(LoginStatements.UpdBnetFailedLogins);
|
||||||
stmt.AddValue(0, accountId);
|
stmt.AddValue(0, accountId);
|
||||||
trans.Append(stmt);
|
trans.Append(stmt);
|
||||||
|
|||||||
@@ -6,10 +6,9 @@ using Bgs.Protocol.Authentication.V1;
|
|||||||
using Bgs.Protocol.Challenge.V1;
|
using Bgs.Protocol.Challenge.V1;
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Framework.Database;
|
using Framework.Database;
|
||||||
|
using Framework.Realm;
|
||||||
using Google.Protobuf;
|
using Google.Protobuf;
|
||||||
using System;
|
using System;
|
||||||
using Framework.Realm;
|
|
||||||
using System.Net;
|
|
||||||
|
|
||||||
namespace BNetServer.Networking
|
namespace BNetServer.Networking
|
||||||
{
|
{
|
||||||
@@ -42,7 +41,7 @@ namespace BNetServer.Networking
|
|||||||
|
|
||||||
var endpoint = Global.LoginServiceMgr.GetAddressForClient(GetRemoteIpEndPoint().Address);
|
var endpoint = Global.LoginServiceMgr.GetAddressForClient(GetRemoteIpEndPoint().Address);
|
||||||
|
|
||||||
ChallengeExternalRequest externalChallenge = new ChallengeExternalRequest();
|
ChallengeExternalRequest externalChallenge = new();
|
||||||
externalChallenge.PayloadType = "web_auth_url";
|
externalChallenge.PayloadType = "web_auth_url";
|
||||||
externalChallenge.Payload = ByteString.CopyFromUtf8($"https://{endpoint.Address}:{endpoint.Port}/bnetserver/login/");
|
externalChallenge.Payload = ByteString.CopyFromUtf8($"https://{endpoint.Address}:{endpoint.Port}/bnetserver/login/");
|
||||||
|
|
||||||
@@ -92,7 +91,7 @@ namespace BNetServer.Networking
|
|||||||
{
|
{
|
||||||
var realmId = new RealmId(lastPlayerCharactersResult.Read<byte>(1), lastPlayerCharactersResult.Read<byte>(2), lastPlayerCharactersResult.Read<uint>(3));
|
var realmId = new RealmId(lastPlayerCharactersResult.Read<byte>(1), lastPlayerCharactersResult.Read<byte>(2), lastPlayerCharactersResult.Read<uint>(3));
|
||||||
|
|
||||||
LastPlayedCharacterInfo lastPlayedCharacter = new LastPlayedCharacterInfo();
|
LastPlayedCharacterInfo lastPlayedCharacter = new();
|
||||||
lastPlayedCharacter.RealmId = realmId;
|
lastPlayedCharacter.RealmId = realmId;
|
||||||
lastPlayedCharacter.CharacterName = lastPlayerCharactersResult.Read<string>(4);
|
lastPlayedCharacter.CharacterName = lastPlayerCharactersResult.Read<string>(4);
|
||||||
lastPlayedCharacter.CharacterGUID = lastPlayerCharactersResult.Read<ulong>(5);
|
lastPlayedCharacter.CharacterGUID = lastPlayerCharactersResult.Read<ulong>(5);
|
||||||
@@ -142,14 +141,14 @@ namespace BNetServer.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LogonResult logonResult = new LogonResult();
|
LogonResult logonResult = new();
|
||||||
logonResult.ErrorCode = 0;
|
logonResult.ErrorCode = 0;
|
||||||
logonResult.AccountId = new EntityId();
|
logonResult.AccountId = new EntityId();
|
||||||
logonResult.AccountId.Low = accountInfo.Id;
|
logonResult.AccountId.Low = accountInfo.Id;
|
||||||
logonResult.AccountId.High = 0x100000000000000;
|
logonResult.AccountId.High = 0x100000000000000;
|
||||||
foreach (var pair in accountInfo.GameAccounts)
|
foreach (var pair in accountInfo.GameAccounts)
|
||||||
{
|
{
|
||||||
EntityId gameAccountId = new EntityId();
|
EntityId gameAccountId = new();
|
||||||
gameAccountId.Low = pair.Value.Id;
|
gameAccountId.Low = pair.Value.Id;
|
||||||
gameAccountId.High = 0x200000200576F57;
|
gameAccountId.High = 0x200000200576F57;
|
||||||
logonResult.GameAccountId.Add(gameAccountId);
|
logonResult.GameAccountId.Add(gameAccountId);
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
// Copyright (c) CypherCore <http://github.com/CypherCore> All rights reserved.
|
||||||
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
// Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE file in the project root for full license information.
|
||||||
|
|
||||||
|
using Bgs.Protocol;
|
||||||
using Bgs.Protocol.Connection.V1;
|
using Bgs.Protocol.Connection.V1;
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
using Google.Protobuf;
|
|
||||||
using Bgs.Protocol;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace BNetServer.Networking
|
namespace BNetServer.Networking
|
||||||
{
|
{
|
||||||
@@ -19,7 +17,7 @@ namespace BNetServer.Networking
|
|||||||
response.ClientId.MergeFrom(request.ClientId);
|
response.ClientId.MergeFrom(request.ClientId);
|
||||||
|
|
||||||
response.ServerId = new ProcessId();
|
response.ServerId = new ProcessId();
|
||||||
response.ServerId.Label = (uint)Process.GetCurrentProcess().Id;
|
response.ServerId.Label = (uint)Environment.ProcessId;
|
||||||
response.ServerId.Epoch = (uint)Time.UnixTime;
|
response.ServerId.Epoch = (uint)Time.UnixTime;
|
||||||
response.ServerTime = (ulong)Time.UnixTimeMilliseconds;
|
response.ServerTime = (ulong)Time.UnixTimeMilliseconds;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace BNetServer.Networking
|
|||||||
return BattlenetRpcErrorCode.Denied;
|
return BattlenetRpcErrorCode.Denied;
|
||||||
|
|
||||||
Bgs.Protocol.Attribute command = null;
|
Bgs.Protocol.Attribute command = null;
|
||||||
Dictionary<string, Variant> Params = new Dictionary<string, Variant>();
|
Dictionary<string, Variant> Params = new();
|
||||||
|
|
||||||
for (int i = 0; i < request.Attribute.Count; ++i)
|
for (int i = 0; i < request.Attribute.Count; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -125,12 +125,12 @@ namespace BNetServer.Networking
|
|||||||
|
|
||||||
public async void SendResponse(uint token, IMessage response)
|
public async void SendResponse(uint token, IMessage response)
|
||||||
{
|
{
|
||||||
Header header = new Header();
|
Header header = new();
|
||||||
header.Token = token;
|
header.Token = token;
|
||||||
header.ServiceId = 0xFE;
|
header.ServiceId = 0xFE;
|
||||||
header.Size = (uint)response.CalculateSize();
|
header.Size = (uint)response.CalculateSize();
|
||||||
|
|
||||||
ByteBuffer buffer = new ByteBuffer();
|
ByteBuffer buffer = new();
|
||||||
buffer.WriteBytes(GetHeaderSize(header), 2);
|
buffer.WriteBytes(GetHeaderSize(header), 2);
|
||||||
buffer.WriteBytes(header.ToByteArray());
|
buffer.WriteBytes(header.ToByteArray());
|
||||||
buffer.WriteBytes(response.ToByteArray());
|
buffer.WriteBytes(response.ToByteArray());
|
||||||
@@ -140,12 +140,12 @@ namespace BNetServer.Networking
|
|||||||
|
|
||||||
public async void SendResponse(uint token, BattlenetRpcErrorCode status)
|
public async void SendResponse(uint token, BattlenetRpcErrorCode status)
|
||||||
{
|
{
|
||||||
Header header = new Header();
|
Header header = new();
|
||||||
header.Token = token;
|
header.Token = token;
|
||||||
header.Status = (uint)status;
|
header.Status = (uint)status;
|
||||||
header.ServiceId = 0xFE;
|
header.ServiceId = 0xFE;
|
||||||
|
|
||||||
ByteBuffer buffer = new ByteBuffer();
|
ByteBuffer buffer = new();
|
||||||
buffer.WriteBytes(GetHeaderSize(header), 2);
|
buffer.WriteBytes(GetHeaderSize(header), 2);
|
||||||
buffer.WriteBytes(header.ToByteArray());
|
buffer.WriteBytes(header.ToByteArray());
|
||||||
|
|
||||||
@@ -154,14 +154,14 @@ namespace BNetServer.Networking
|
|||||||
|
|
||||||
public async void SendRequest(uint serviceHash, uint methodId, IMessage request)
|
public async void SendRequest(uint serviceHash, uint methodId, IMessage request)
|
||||||
{
|
{
|
||||||
Header header = new Header();
|
Header header = new();
|
||||||
header.ServiceId = 0;
|
header.ServiceId = 0;
|
||||||
header.ServiceHash = serviceHash;
|
header.ServiceHash = serviceHash;
|
||||||
header.MethodId = methodId;
|
header.MethodId = methodId;
|
||||||
header.Size = (uint)request.CalculateSize();
|
header.Size = (uint)request.CalculateSize();
|
||||||
header.Token = requestToken++;
|
header.Token = requestToken++;
|
||||||
|
|
||||||
ByteBuffer buffer = new ByteBuffer();
|
ByteBuffer buffer = new();
|
||||||
buffer.WriteBytes(GetHeaderSize(header), 2);
|
buffer.WriteBytes(GetHeaderSize(header), 2);
|
||||||
buffer.WriteBytes(header.ToByteArray());
|
buffer.WriteBytes(header.ToByteArray());
|
||||||
buffer.WriteBytes(request.ToByteArray());
|
buffer.WriteBytes(request.ToByteArray());
|
||||||
@@ -260,7 +260,7 @@ namespace BNetServer.Networking
|
|||||||
|
|
||||||
int hashPos = Name.IndexOf('#');
|
int hashPos = Name.IndexOf('#');
|
||||||
if (hashPos != -1)
|
if (hashPos != -1)
|
||||||
DisplayName = "WoW" + Name.Substring(hashPos + 1);
|
DisplayName = "WoW" + Name[(hashPos + 1)..];
|
||||||
else
|
else
|
||||||
DisplayName = Name;
|
DisplayName = Name;
|
||||||
|
|
||||||
|
|||||||
@@ -3,19 +3,12 @@
|
|||||||
|
|
||||||
using BNetServer.Networking;
|
using BNetServer.Networking;
|
||||||
using Framework.Configuration;
|
using Framework.Configuration;
|
||||||
|
using Framework.Cryptography;
|
||||||
using Framework.Database;
|
using Framework.Database;
|
||||||
using Framework.Networking;
|
using Framework.Networking;
|
||||||
using Framework.Web.API;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Framework.Cryptography;
|
|
||||||
|
|
||||||
namespace BNetServer
|
namespace BNetServer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
* 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
|
||||||
{
|
{
|
||||||
public enum AuctionResult
|
public enum AuctionResult
|
||||||
@@ -59,6 +61,7 @@ namespace Framework.Constants
|
|||||||
Items = 50
|
Items = 50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum AuctionHouseFilterMask
|
public enum AuctionHouseFilterMask
|
||||||
{
|
{
|
||||||
None = 0x0,
|
None = 0x0,
|
||||||
|
|||||||
@@ -764,6 +764,7 @@ namespace Framework.Constants
|
|||||||
LoadedFromDB = 0x02
|
LoadedFromDB = 0x02
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum ItemSearchLocation
|
public enum ItemSearchLocation
|
||||||
{
|
{
|
||||||
Equipment = 0x01,
|
Equipment = 0x01,
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ namespace Framework.Constants
|
|||||||
DamageCancels = 0x400
|
DamageCancels = 0x400
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum SpellAuraInterruptFlags : uint
|
public enum SpellAuraInterruptFlags : uint
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
@@ -154,6 +155,7 @@ namespace Framework.Constants
|
|||||||
NotVictim = (HostileActionReceived | Damage | NonPeriodicDamage)
|
NotVictim = (HostileActionReceived | Damage | NonPeriodicDamage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Flags]
|
||||||
public enum SpellAuraInterruptFlags2
|
public enum SpellAuraInterruptFlags2
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|||||||
@@ -153,12 +153,12 @@ namespace Game.Arenas
|
|||||||
// arena rating calculation
|
// arena rating calculation
|
||||||
if (IsRated())
|
if (IsRated())
|
||||||
{
|
{
|
||||||
uint loserTeamRating = 0;
|
uint loserTeamRating;
|
||||||
uint loserMatchmakerRating = 0;
|
uint loserMatchmakerRating;
|
||||||
int loserChange = 0;
|
int loserChange = 0;
|
||||||
int loserMatchmakerChange = 0;
|
int loserMatchmakerChange = 0;
|
||||||
uint winnerTeamRating = 0;
|
uint winnerTeamRating;
|
||||||
uint winnerMatchmakerRating = 0;
|
uint winnerMatchmakerRating;
|
||||||
int winnerChange = 0;
|
int winnerChange = 0;
|
||||||
int winnerMatchmakerChange = 0;
|
int winnerMatchmakerChange = 0;
|
||||||
bool guildAwarded = false;
|
bool guildAwarded = false;
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ namespace Game.Arenas
|
|||||||
newMember.WeekGames = 0;
|
newMember.WeekGames = 0;
|
||||||
newMember.SeasonWins = 0;
|
newMember.SeasonWins = 0;
|
||||||
newMember.WeekWins = 0;
|
newMember.WeekWins = 0;
|
||||||
newMember.PersonalRating = 0;
|
newMember.PersonalRating = (ushort)personalRating;
|
||||||
newMember.MatchMakerRating = (ushort)matchMakerRating;
|
newMember.MatchMakerRating = (ushort)matchMakerRating;
|
||||||
|
|
||||||
Members.Add(newMember);
|
Members.Add(newMember);
|
||||||
|
|||||||
@@ -2031,7 +2031,7 @@ namespace Game
|
|||||||
public Span<T> GetResultRange()
|
public Span<T> GetResultRange()
|
||||||
{
|
{
|
||||||
Span<T> h = _items.ToArray();
|
Span<T> h = _items.ToArray();
|
||||||
return h.Slice((int)_offset);
|
return h[(int)_offset..];
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasMoreResults()
|
public bool HasMoreResults()
|
||||||
|
|||||||
@@ -715,8 +715,8 @@ namespace Game.BattleFields
|
|||||||
{
|
{
|
||||||
public WintergraspTowerCannonData()
|
public WintergraspTowerCannonData()
|
||||||
{
|
{
|
||||||
TowerCannonBottom = new Position[0];
|
TowerCannonBottom = System.Array.Empty<Position>();
|
||||||
TurretTop = new Position[0];
|
TurretTop = System.Array.Empty<Position>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint towerEntry;
|
public uint towerEntry;
|
||||||
|
|||||||
@@ -2088,12 +2088,10 @@ namespace Game.BattleGrounds
|
|||||||
// Arena team ids by team
|
// Arena team ids by team
|
||||||
uint[] m_ArenaTeamIds = new uint[SharedConst.BGTeamsCount];
|
uint[] m_ArenaTeamIds = new uint[SharedConst.BGTeamsCount];
|
||||||
|
|
||||||
int[] m_ArenaTeamRatingChanges = new int[SharedConst.BGTeamsCount];
|
|
||||||
uint[] m_ArenaTeamMMR = new uint[SharedConst.BGTeamsCount];
|
uint[] m_ArenaTeamMMR = new uint[SharedConst.BGTeamsCount];
|
||||||
|
|
||||||
// Start location
|
// Start location
|
||||||
BattlegroundMap m_Map;
|
BattlegroundMap m_Map;
|
||||||
Position[] StartPosition = new Position[SharedConst.BGTeamsCount];
|
|
||||||
|
|
||||||
BattlegroundTemplate _battlegroundTemplate;
|
BattlegroundTemplate _battlegroundTemplate;
|
||||||
PvpDifficultyRecord _pvpDifficultyEntry;
|
PvpDifficultyRecord _pvpDifficultyEntry;
|
||||||
|
|||||||
@@ -194,7 +194,7 @@ namespace Game.BattleGrounds
|
|||||||
m_SumOfWaitTimes[team_index][(int)bracket_id] += timeInQueue;
|
m_SumOfWaitTimes[team_index][(int)bracket_id] += timeInQueue;
|
||||||
//set index of last player added to next one
|
//set index of last player added to next one
|
||||||
lastPlayerAddedPointer++;
|
lastPlayerAddedPointer++;
|
||||||
lastPlayerAddedPointer %= SharedConst.CountOfPlayersToAverageWaitTime;
|
m_WaitTimeLastPlayer[team_index][(int)bracket_id] = lastPlayerAddedPointer % SharedConst.CountOfPlayersToAverageWaitTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetAverageQueueWaitTime(GroupQueueInfo ginfo, BattlegroundBracketId bracket_id)
|
public uint GetAverageQueueWaitTime(GroupQueueInfo ginfo, BattlegroundBracketId bracket_id)
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ namespace Game
|
|||||||
packet.ResponseTime = invite.ResponseTime;
|
packet.ResponseTime = invite.ResponseTime;
|
||||||
packet.Status = invite.Status;
|
packet.Status = invite.Status;
|
||||||
packet.Type = (byte)(calendarEvent != null ? calendarEvent.IsGuildEvent() ? 1 : 0 : 0); // Correct ?
|
packet.Type = (byte)(calendarEvent != null ? calendarEvent.IsGuildEvent() ? 1 : 0 : 0); // Correct ?
|
||||||
packet.ClearPending = calendarEvent != null ? !calendarEvent.IsGuildEvent() : true; // Correct ?
|
packet.ClearPending = calendarEvent == null || !calendarEvent.IsGuildEvent(); // Correct ?
|
||||||
|
|
||||||
if (calendarEvent == null) // Pre-invite
|
if (calendarEvent == null) // Pre-invite
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ using Framework.Database;
|
|||||||
using Game.DataStorage;
|
using Game.DataStorage;
|
||||||
using Game.Entities;
|
using Game.Entities;
|
||||||
using Game.Maps;
|
using Game.Maps;
|
||||||
using Game.Networking;
|
|
||||||
using Game.Networking.Packets;
|
using Game.Networking.Packets;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -83,7 +82,7 @@ namespace Game.Chat
|
|||||||
for (var i = 0; i < tokens.Length; ++i)
|
for (var i = 0; i < tokens.Length; ++i)
|
||||||
{
|
{
|
||||||
ObjectGuid bannedGuid = new();
|
ObjectGuid bannedGuid = new();
|
||||||
if (ulong.TryParse(tokens[i].Substring(0, 16), out ulong highguid) && ulong.TryParse(tokens[i].Substring(16), out ulong lowguid))
|
if (ulong.TryParse(tokens[i].Substring(0, 16), out ulong highguid) && ulong.TryParse(tokens[i][16..], out ulong lowguid))
|
||||||
bannedGuid.SetRawValue(highguid, lowguid);
|
bannedGuid.SetRawValue(highguid, lowguid);
|
||||||
|
|
||||||
if (!bannedGuid.IsEmpty())
|
if (!bannedGuid.IsEmpty())
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace Game.Chat
|
|||||||
|
|
||||||
// Security level required
|
// Security level required
|
||||||
WorldSession session = handler.GetSession();
|
WorldSession session = handler.GetSession();
|
||||||
bool hasRBAC = (session.HasPermission(RBACPermissions.EmailConfirmForPassChange) ? true : false);
|
bool hasRBAC = (session.HasPermission(RBACPermissions.EmailConfirmForPassChange));
|
||||||
uint pwConfig = 0; // 0 - PW_NONE, 1 - PW_EMAIL, 2 - PW_RBAC
|
uint pwConfig = 0; // 0 - PW_NONE, 1 - PW_EMAIL, 2 - PW_RBAC
|
||||||
|
|
||||||
handler.SendSysMessage(CypherStrings.AccountSecType, (pwConfig == 0 ? "Lowest level: No Email input required." :
|
handler.SendSysMessage(CypherStrings.AccountSecType, (pwConfig == 0 ? "Lowest level: No Email input required." :
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace Game.Chat.Commands
|
|||||||
string accountName = accountId.ToString() + '#' + index;
|
string accountName = accountId.ToString() + '#' + index;
|
||||||
|
|
||||||
// Generate random hex string for password, these accounts must not be logged on with GRUNT
|
// Generate random hex string for password, these accounts must not be logged on with GRUNT
|
||||||
byte[] randPassword = new byte[0].GenerateRandomKey(8);
|
byte[] randPassword = Array.Empty<byte>().GenerateRandomKey(8);
|
||||||
switch (Global.AccountMgr.CreateAccount(accountName, randPassword.ToHexString(), bnetAccountName, accountId, index))
|
switch (Global.AccountMgr.CreateAccount(accountName, randPassword.ToHexString(), bnetAccountName, accountId, index))
|
||||||
{
|
{
|
||||||
case AccountOpResult.Ok:
|
case AccountOpResult.Ok:
|
||||||
@@ -179,7 +179,7 @@ namespace Game.Chat.Commands
|
|||||||
{
|
{
|
||||||
int index = name.IndexOf('#');
|
int index = name.IndexOf('#');
|
||||||
if (index > 0)
|
if (index > 0)
|
||||||
return "WoW" + name.Substring(++index);
|
return "WoW" + name[++index..];
|
||||||
else
|
else
|
||||||
return name;
|
return name;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ namespace Game.Chat
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint oldAccountId = characterInfo.AccountId;
|
uint oldAccountId = characterInfo.AccountId;
|
||||||
uint newAccountId = oldAccountId;
|
uint newAccountId;
|
||||||
|
|
||||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ID_BY_NAME);
|
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_ACCOUNT_ID_BY_NAME);
|
||||||
stmt.AddValue(0, accountName);
|
stmt.AddValue(0, accountName);
|
||||||
|
|||||||
@@ -369,17 +369,15 @@ namespace Game.Chat.Commands
|
|||||||
if (args.Empty())
|
if (args.Empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Player target;
|
|
||||||
ObjectGuid targetGuid;
|
ObjectGuid targetGuid;
|
||||||
string targetName;
|
string targetName;
|
||||||
|
|
||||||
ObjectGuid parseGUID = ObjectGuid.Create(HighGuid.Player, args.NextUInt64());
|
ObjectGuid parseGUID = ObjectGuid.Create(HighGuid.Player, args.NextUInt64());
|
||||||
if (Global.CharacterCacheStorage.GetCharacterNameByGuid(parseGUID, out targetName))
|
if (Global.CharacterCacheStorage.GetCharacterNameByGuid(parseGUID, out targetName))
|
||||||
{
|
{
|
||||||
target = Global.ObjAccessor.FindPlayer(parseGUID);
|
|
||||||
targetGuid = parseGUID;
|
targetGuid = parseGUID;
|
||||||
}
|
}
|
||||||
else if (!handler.ExtractPlayerTarget(args, out target, out targetGuid, out targetName))
|
else if (!handler.ExtractPlayerTarget(args, out _, out targetGuid, out targetName))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT);
|
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.SEL_MAIL_LIST_COUNT);
|
||||||
|
|||||||
@@ -1580,7 +1580,7 @@ namespace Game.Chat
|
|||||||
Locale locale = handler.GetSessionDbcLocale();
|
Locale locale = handler.GetSessionDbcLocale();
|
||||||
uint totalPlayerTime;
|
uint totalPlayerTime;
|
||||||
uint level;
|
uint level;
|
||||||
string alive = handler.GetCypherString(CypherStrings.Error);
|
string alive;
|
||||||
ulong money;
|
ulong money;
|
||||||
uint xp = 0;
|
uint xp = 0;
|
||||||
uint xptotal = 0;
|
uint xptotal = 0;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Game.Collision
|
|||||||
void InitEmpty()
|
void InitEmpty()
|
||||||
{
|
{
|
||||||
tree= new uint[3];
|
tree= new uint[3];
|
||||||
objects = new uint[0];
|
objects = Array.Empty<uint>();
|
||||||
// create space for the first node
|
// create space for the first node
|
||||||
tree[0] = (3u << 30); // dummy leaf
|
tree[0] = (3u << 30); // dummy leaf
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Game.Collision
|
|||||||
public void Remove(T obj)
|
public void Remove(T obj)
|
||||||
{
|
{
|
||||||
++unbalanced_times;
|
++unbalanced_times;
|
||||||
uint Idx = 0;
|
uint Idx;
|
||||||
if (m_obj2Idx.TryGetValue(obj, out Idx))
|
if (m_obj2Idx.TryGetValue(obj, out Idx))
|
||||||
m_objects[(int)Idx] = null;
|
m_objects[(int)Idx] = null;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Game.Collision
|
|||||||
impl.Update(diff);
|
impl.Update(diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool GetIntersectionTime(Ray ray, Vector3 endPos, PhaseShift phaseShift, float maxDist)
|
public bool GetIntersectionTime(Ray ray, Vector3 endPos, PhaseShift phaseShift, ref float maxDist)
|
||||||
{
|
{
|
||||||
float distance = maxDist;
|
float distance = maxDist;
|
||||||
DynamicTreeIntersectionCallback callback = new(phaseShift);
|
DynamicTreeIntersectionCallback callback = new(phaseShift);
|
||||||
@@ -63,7 +63,7 @@ namespace Game.Collision
|
|||||||
|
|
||||||
public bool GetObjectHitPos(Vector3 startPos, Vector3 endPos, ref Vector3 resultHitPos, float modifyDist, PhaseShift phaseShift)
|
public bool GetObjectHitPos(Vector3 startPos, Vector3 endPos, ref Vector3 resultHitPos, float modifyDist, PhaseShift phaseShift)
|
||||||
{
|
{
|
||||||
bool result = false;
|
bool result;
|
||||||
float maxDist = (endPos - startPos).magnitude();
|
float maxDist = (endPos - startPos).magnitude();
|
||||||
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
// valid map coords should *never ever* produce float overflow, but this would produce NaNs too
|
||||||
Cypher.Assert(maxDist < float.MaxValue);
|
Cypher.Assert(maxDist < float.MaxValue);
|
||||||
@@ -76,7 +76,7 @@ namespace Game.Collision
|
|||||||
Vector3 dir = (endPos - startPos) / maxDist; // direction with length of 1
|
Vector3 dir = (endPos - startPos) / maxDist; // direction with length of 1
|
||||||
Ray ray = new(startPos, dir);
|
Ray ray = new(startPos, dir);
|
||||||
float dist = maxDist;
|
float dist = maxDist;
|
||||||
if (GetIntersectionTime(ray, endPos, phaseShift, dist))
|
if (GetIntersectionTime(ray, endPos, phaseShift, ref dist))
|
||||||
{
|
{
|
||||||
resultHitPos = startPos + dir * dist;
|
resultHitPos = startPos + dir * dist;
|
||||||
if (modifyDist < 0)
|
if (modifyDist < 0)
|
||||||
|
|||||||
@@ -121,60 +121,58 @@ namespace Game.Collision
|
|||||||
if (fileResult.File != null)
|
if (fileResult.File != null)
|
||||||
{
|
{
|
||||||
result = LoadResult.Success;
|
result = LoadResult.Success;
|
||||||
using (BinaryReader reader = new(fileResult.File))
|
using BinaryReader reader = new(fileResult.File);
|
||||||
|
if (reader.ReadStringFromChars(8) != MapConst.VMapMagic)
|
||||||
|
result = LoadResult.VersionMismatch;
|
||||||
|
|
||||||
|
if (result == LoadResult.Success)
|
||||||
{
|
{
|
||||||
if (reader.ReadStringFromChars(8) != MapConst.VMapMagic)
|
uint numSpawns = reader.ReadUInt32();
|
||||||
result = LoadResult.VersionMismatch;
|
for (uint i = 0; i < numSpawns && result == LoadResult.Success; ++i)
|
||||||
|
|
||||||
if (result == LoadResult.Success)
|
|
||||||
{
|
{
|
||||||
uint numSpawns = reader.ReadUInt32();
|
// read model spawns
|
||||||
for (uint i = 0; i < numSpawns && result == LoadResult.Success; ++i)
|
if (ModelSpawn.ReadFromFile(reader, out ModelSpawn spawn))
|
||||||
{
|
{
|
||||||
// read model spawns
|
// acquire model instance
|
||||||
if (ModelSpawn.ReadFromFile(reader, out ModelSpawn spawn))
|
WorldModel model = vm.AcquireModelInstance(spawn.name, spawn.flags);
|
||||||
{
|
if (model == null)
|
||||||
// acquire model instance
|
Log.outError(LogFilter.Server, "StaticMapTree.LoadMapTile() : could not acquire WorldModel [{0}, {1}]", tileX, tileY);
|
||||||
WorldModel model = vm.AcquireModelInstance(spawn.name, spawn.flags);
|
|
||||||
if (model == null)
|
|
||||||
Log.outError(LogFilter.Server, "StaticMapTree.LoadMapTile() : could not acquire WorldModel [{0}, {1}]", tileX, tileY);
|
|
||||||
|
|
||||||
// update tree
|
// update tree
|
||||||
if (iSpawnIndices.ContainsKey(spawn.Id))
|
if (iSpawnIndices.ContainsKey(spawn.Id))
|
||||||
|
{
|
||||||
|
uint referencedVal = iSpawnIndices[spawn.Id];
|
||||||
|
if (!iLoadedSpawns.ContainsKey(referencedVal))
|
||||||
{
|
{
|
||||||
uint referencedVal = iSpawnIndices[spawn.Id];
|
if (referencedVal >= iNTreeValues)
|
||||||
if (!iLoadedSpawns.ContainsKey(referencedVal))
|
|
||||||
{
|
{
|
||||||
if (referencedVal >= iNTreeValues)
|
Log.outError(LogFilter.Maps, "StaticMapTree.LoadMapTile() : invalid tree element ({0}/{1}) referenced in tile {2}", referencedVal, iNTreeValues, fileResult.Name);
|
||||||
{
|
continue;
|
||||||
Log.outError(LogFilter.Maps, "StaticMapTree.LoadMapTile() : invalid tree element ({0}/{1}) referenced in tile {2}", referencedVal, iNTreeValues, fileResult.Name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
iTreeValues[referencedVal] = new ModelInstance(spawn, model);
|
|
||||||
iLoadedSpawns[referencedVal] = 1;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
++iLoadedSpawns[referencedVal];
|
iTreeValues[referencedVal] = new ModelInstance(spawn, model);
|
||||||
}
|
iLoadedSpawns[referencedVal] = 1;
|
||||||
else if (iMapID == fileResult.UsedMapId)
|
|
||||||
{
|
|
||||||
// unknown parent spawn might appear in because it overlaps multiple tiles
|
|
||||||
// in case the original tile is swapped but its neighbour is now (adding this spawn)
|
|
||||||
// we want to not mark it as loading error and just skip that model
|
|
||||||
Log.outError(LogFilter.Maps, $"StaticMapTree.LoadMapTile() : invalid tree element (spawn {spawn.Id}) referenced in tile fileResult.Name{fileResult.Name} by map {iMapID}");
|
|
||||||
result = LoadResult.ReadFromFileFailed;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
++iLoadedSpawns[referencedVal];
|
||||||
}
|
}
|
||||||
else
|
else if (iMapID == fileResult.UsedMapId)
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Maps, $"StaticMapTree.LoadMapTile() : cannot read model from file (spawn index {i}) referenced in tile {fileResult.Name} by map {iMapID}");
|
// unknown parent spawn might appear in because it overlaps multiple tiles
|
||||||
|
// in case the original tile is swapped but its neighbour is now (adding this spawn)
|
||||||
|
// we want to not mark it as loading error and just skip that model
|
||||||
|
Log.outError(LogFilter.Maps, $"StaticMapTree.LoadMapTile() : invalid tree element (spawn {spawn.Id}) referenced in tile fileResult.Name{fileResult.Name} by map {iMapID}");
|
||||||
result = LoadResult.ReadFromFileFailed;
|
result = LoadResult.ReadFromFileFailed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Log.outError(LogFilter.Maps, $"StaticMapTree.LoadMapTile() : cannot read model from file (spawn index {i}) referenced in tile {fileResult.Name} by map {iMapID}");
|
||||||
|
result = LoadResult.ReadFromFileFailed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
iLoadedTiles[PackTileID(tileX, tileY)] = true;
|
|
||||||
}
|
}
|
||||||
|
iLoadedTiles[PackTileID(tileX, tileY)] = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -197,38 +195,36 @@ namespace Game.Collision
|
|||||||
TileFileOpenResult fileResult = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
|
TileFileOpenResult fileResult = OpenMapTileFile(VMapManager.VMapPath, iMapID, tileX, tileY, vm);
|
||||||
if (fileResult.File != null)
|
if (fileResult.File != null)
|
||||||
{
|
{
|
||||||
using (BinaryReader reader = new(fileResult.File))
|
using BinaryReader reader = new(fileResult.File);
|
||||||
|
bool result = true;
|
||||||
|
if (reader.ReadStringFromChars(8) != MapConst.VMapMagic)
|
||||||
|
result = false;
|
||||||
|
|
||||||
|
uint numSpawns = reader.ReadUInt32();
|
||||||
|
for (uint i = 0; i < numSpawns && result; ++i)
|
||||||
{
|
{
|
||||||
bool result = true;
|
// read model spawns
|
||||||
if (reader.ReadStringFromChars(8) != MapConst.VMapMagic)
|
ModelSpawn spawn;
|
||||||
result = false;
|
result = ModelSpawn.ReadFromFile(reader, out spawn);
|
||||||
|
if (result)
|
||||||
uint numSpawns = reader.ReadUInt32();
|
|
||||||
for (uint i = 0; i < numSpawns && result; ++i)
|
|
||||||
{
|
{
|
||||||
// read model spawns
|
// release model instance
|
||||||
ModelSpawn spawn;
|
vm.ReleaseModelInstance(spawn.name);
|
||||||
result = ModelSpawn.ReadFromFile(reader, out spawn);
|
|
||||||
if (result)
|
|
||||||
{
|
|
||||||
// release model instance
|
|
||||||
vm.ReleaseModelInstance(spawn.name);
|
|
||||||
|
|
||||||
// update tree
|
// update tree
|
||||||
if (iSpawnIndices.ContainsKey(spawn.Id))
|
if (iSpawnIndices.ContainsKey(spawn.Id))
|
||||||
|
{
|
||||||
|
uint referencedNode = iSpawnIndices[spawn.Id];
|
||||||
|
if (!iLoadedSpawns.ContainsKey(referencedNode))
|
||||||
|
Log.outError(LogFilter.Server, "StaticMapTree.UnloadMapTile() : trying to unload non-referenced model '{0}' (ID:{1})", spawn.name, spawn.Id);
|
||||||
|
else if (--iLoadedSpawns[referencedNode] == 0)
|
||||||
{
|
{
|
||||||
uint referencedNode = iSpawnIndices[spawn.Id];
|
iTreeValues[referencedNode].SetUnloaded();
|
||||||
if (!iLoadedSpawns.ContainsKey(referencedNode))
|
iLoadedSpawns.Remove(referencedNode);
|
||||||
Log.outError(LogFilter.Server, "StaticMapTree.UnloadMapTile() : trying to unload non-referenced model '{0}' (ID:{1})", spawn.name, spawn.Id);
|
|
||||||
else if (--iLoadedSpawns[referencedNode] == 0)
|
|
||||||
{
|
|
||||||
iTreeValues[referencedNode].SetUnloaded();
|
|
||||||
iLoadedSpawns.Remove(referencedNode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (iMapID == fileResult.UsedMapId) // logic documented in StaticMapTree::LoadMapTile
|
|
||||||
result = false;
|
|
||||||
}
|
}
|
||||||
|
else if (iMapID == fileResult.UsedMapId) // logic documented in StaticMapTree::LoadMapTile
|
||||||
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -189,30 +189,28 @@ namespace Game.Collision
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read)))
|
using BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read));
|
||||||
|
string magic = reader.ReadStringFromChars(8);
|
||||||
|
if (magic != MapConst.VMapMagic)
|
||||||
{
|
{
|
||||||
string magic = reader.ReadStringFromChars(8);
|
Log.outError(LogFilter.Misc, $"File '{filename}' has wrong header, expected {MapConst.VMapMagic}.");
|
||||||
if (magic != MapConst.VMapMagic)
|
return;
|
||||||
{
|
}
|
||||||
Log.outError(LogFilter.Misc, $"File '{filename}' has wrong header, expected {MapConst.VMapMagic}.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
long length = reader.BaseStream.Length;
|
long length = reader.BaseStream.Length;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (reader.BaseStream.Position >= length)
|
if (reader.BaseStream.Position >= length)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
uint displayId = reader.ReadUInt32();
|
uint displayId = reader.ReadUInt32();
|
||||||
bool isWmo = reader.ReadBoolean();
|
bool isWmo = reader.ReadBoolean();
|
||||||
int name_length = reader.ReadInt32();
|
int name_length = reader.ReadInt32();
|
||||||
string name = reader.ReadString(name_length);
|
string name = reader.ReadString(name_length);
|
||||||
Vector3 v1 = reader.Read<Vector3>();
|
Vector3 v1 = reader.Read<Vector3>();
|
||||||
Vector3 v2 = reader.Read<Vector3>();
|
Vector3 v2 = reader.Read<Vector3>();
|
||||||
|
|
||||||
StaticModelList.models.Add(displayId, new GameobjectModelData(name, v1, v2, isWmo));
|
StaticModelList.models.Add(displayId, new GameobjectModelData(name, v1, v2, isWmo));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (EndOfStreamException ex)
|
catch (EndOfStreamException ex)
|
||||||
|
|||||||
@@ -371,40 +371,38 @@ namespace Game.Collision
|
|||||||
{
|
{
|
||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
{
|
{
|
||||||
filename = filename + ".vmo";
|
filename += ".vmo";
|
||||||
if (!File.Exists(filename))
|
if (!File.Exists(filename))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
using (BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read)))
|
using BinaryReader reader = new(new FileStream(filename, FileMode.Open, FileAccess.Read));
|
||||||
|
if (reader.ReadStringFromChars(8) != MapConst.VMapMagic)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (reader.ReadStringFromChars(4) != "WMOD")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
reader.ReadUInt32(); //chunkSize notused
|
||||||
|
RootWMOID = reader.ReadUInt32();
|
||||||
|
|
||||||
|
// read group models
|
||||||
|
if (reader.ReadStringFromChars(4) != "GMOD")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint count = reader.ReadUInt32();
|
||||||
|
for (var i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
if (reader.ReadStringFromChars(8) != MapConst.VMapMagic)
|
GroupModel group = new();
|
||||||
return false;
|
group.ReadFromFile(reader);
|
||||||
|
groupModels.Add(group);
|
||||||
if (reader.ReadStringFromChars(4) != "WMOD")
|
|
||||||
return false;
|
|
||||||
|
|
||||||
reader.ReadUInt32(); //chunkSize notused
|
|
||||||
RootWMOID = reader.ReadUInt32();
|
|
||||||
|
|
||||||
// read group models
|
|
||||||
if (reader.ReadStringFromChars(4) != "GMOD")
|
|
||||||
return false;
|
|
||||||
|
|
||||||
uint count = reader.ReadUInt32();
|
|
||||||
for (var i = 0; i < count; ++i)
|
|
||||||
{
|
|
||||||
GroupModel group = new();
|
|
||||||
group.ReadFromFile(reader);
|
|
||||||
groupModels.Add(group);
|
|
||||||
}
|
|
||||||
|
|
||||||
// read group BIH
|
|
||||||
if (reader.ReadStringFromChars(4) != "GBIH")
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return groupTree.ReadFromFile(reader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// read group BIH
|
||||||
|
if (reader.ReadStringFromChars(4) != "GBIH")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return groupTree.ReadFromFile(reader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ namespace Game.Combat
|
|||||||
|
|
||||||
void PutThreatListRef(ObjectGuid guid, ThreatReference refe)
|
void PutThreatListRef(ObjectGuid guid, ThreatReference refe)
|
||||||
{
|
{
|
||||||
Cypher.Assert(!_myThreatListEntries.ContainsKey(guid), $"Duplicate threat reference being inserted on {_owner.GetGUID()} for {guid.ToString()}!");
|
Cypher.Assert(!_myThreatListEntries.ContainsKey(guid), $"Duplicate threat reference being inserted on {_owner.GetGUID()} for {guid}!");
|
||||||
_myThreatListEntries[guid] = refe;
|
_myThreatListEntries[guid] = refe;
|
||||||
_sortedThreatList.Add(refe);
|
_sortedThreatList.Add(refe);
|
||||||
_sortedThreatList.Sort();
|
_sortedThreatList.Sort();
|
||||||
@@ -771,7 +771,6 @@ namespace Game.Combat
|
|||||||
if (onlineState == _online)
|
if (onlineState == _online)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool increase = (onlineState > _online);
|
|
||||||
_online = onlineState;
|
_online = onlineState;
|
||||||
ListNotifyChanged();
|
ListNotifyChanged();
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace Game.Conditions
|
|||||||
{
|
{
|
||||||
// don't allow 0 items (it's checked during table load)
|
// don't allow 0 items (it's checked during table load)
|
||||||
Cypher.Assert(ConditionValue2 != 0);
|
Cypher.Assert(ConditionValue2 != 0);
|
||||||
bool checkBank = ConditionValue3 != 0 ? true : false;
|
bool checkBank = ConditionValue3 != 0;
|
||||||
condMeets = player.HasItemCount(ConditionValue1, ConditionValue2, checkBank);
|
condMeets = player.HasItemCount(ConditionValue1, ConditionValue2, checkBank);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -176,7 +176,7 @@ namespace Game.Conditions
|
|||||||
condMeets = (uint)Player.GetDrunkenstateByValue(player.GetDrunkValue()) >= ConditionValue1;
|
condMeets = (uint)Player.GetDrunkenstateByValue(player.GetDrunkValue()) >= ConditionValue1;
|
||||||
break;
|
break;
|
||||||
case ConditionTypes.NearCreature:
|
case ConditionTypes.NearCreature:
|
||||||
condMeets = obj.FindNearestCreature(ConditionValue1, ConditionValue2, ConditionValue3 == 0 ? true : false) != null;
|
condMeets = obj.FindNearestCreature(ConditionValue1, ConditionValue2, ConditionValue3 == 0) != null;
|
||||||
break;
|
break;
|
||||||
case ConditionTypes.NearGameobject:
|
case ConditionTypes.NearGameobject:
|
||||||
condMeets = obj.FindNearestGameObject(ConditionValue1, ConditionValue2) != null;
|
condMeets = obj.FindNearestGameObject(ConditionValue1, ConditionValue2) != null;
|
||||||
@@ -550,7 +550,7 @@ namespace Game.Conditions
|
|||||||
ss.Append(" (Unknown)");
|
ss.Append(" (Unknown)");
|
||||||
}
|
}
|
||||||
|
|
||||||
ss.Append("]");
|
ss.Append(']');
|
||||||
return ss.ToString();
|
return ss.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1529,7 +1529,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
case ConditionTypes.StandState:
|
case ConditionTypes.StandState:
|
||||||
{
|
{
|
||||||
bool valid = false;
|
bool valid;
|
||||||
switch (cond.ConditionValue1)
|
switch (cond.ConditionValue1)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
@@ -1677,8 +1677,7 @@ namespace Game
|
|||||||
|
|
||||||
public static uint GetPlayerConditionLfgValue(Player player, PlayerConditionLfgStatus status)
|
public static uint GetPlayerConditionLfgValue(Player player, PlayerConditionLfgStatus status)
|
||||||
{
|
{
|
||||||
Group group = player.GetGroup();
|
if (player.GetGroup() == null)
|
||||||
if (group = null)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch (status)
|
switch (status)
|
||||||
|
|||||||
@@ -170,27 +170,25 @@ namespace Game.DataStorage
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using (BinaryReader m2file = new(new FileStream(filename, FileMode.Open, FileAccess.Read)))
|
using BinaryReader m2file = new(new FileStream(filename, FileMode.Open, FileAccess.Read));
|
||||||
|
// Check file has correct magic (MD21)
|
||||||
|
if (m2file.ReadUInt32() != 0x3132444D) //"MD21"
|
||||||
{
|
{
|
||||||
// Check file has correct magic (MD21)
|
Log.outError(LogFilter.ServerLoading, "Camera file {0} is damaged. File identifier not found.", filename);
|
||||||
if (m2file.ReadUInt32() != 0x3132444D) //"MD21"
|
continue;
|
||||||
{
|
|
||||||
Log.outError(LogFilter.ServerLoading, "Camera file {0} is damaged. File identifier not found.", filename);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
m2file.ReadUInt32(); //unknown size
|
|
||||||
|
|
||||||
// Read header
|
|
||||||
M2Header header = m2file.Read<M2Header>();
|
|
||||||
|
|
||||||
// Get camera(s) - Main header, then dump them.
|
|
||||||
m2file.BaseStream.Position = 8 + header.ofsCameras;
|
|
||||||
M2Camera cam = m2file.Read<M2Camera>();
|
|
||||||
|
|
||||||
m2file.BaseStream.Position = 8;
|
|
||||||
ReadCamera(cam, new BinaryReader(new MemoryStream(m2file.ReadBytes((int)m2file.BaseStream.Length - 8))), cameraEntry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m2file.ReadUInt32(); //unknown size
|
||||||
|
|
||||||
|
// Read header
|
||||||
|
M2Header header = m2file.Read<M2Header>();
|
||||||
|
|
||||||
|
// Get camera(s) - Main header, then dump them.
|
||||||
|
m2file.BaseStream.Position = 8 + header.ofsCameras;
|
||||||
|
M2Camera cam = m2file.Read<M2Camera>();
|
||||||
|
|
||||||
|
m2file.BaseStream.Position = 8;
|
||||||
|
ReadCamera(cam, new BinaryReader(new MemoryStream(m2file.ReadBytes((int)m2file.BaseStream.Length - 8))), cameraEntry);
|
||||||
}
|
}
|
||||||
catch (EndOfStreamException)
|
catch (EndOfStreamException)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -987,7 +987,7 @@ namespace Game.DungeonFinding
|
|||||||
ObjectGuid pguid = it.Key;
|
ObjectGuid pguid = it.Key;
|
||||||
ObjectGuid gguid = it.Value.group;
|
ObjectGuid gguid = it.Value.group;
|
||||||
uint dungeonId = GetSelectedDungeons(pguid).First();
|
uint dungeonId = GetSelectedDungeons(pguid).First();
|
||||||
int waitTime = -1;
|
int waitTime;
|
||||||
if (sendUpdate)
|
if (sendUpdate)
|
||||||
SendLfgUpdateProposal(pguid, proposal);
|
SendLfgUpdateProposal(pguid, proposal);
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ namespace Game.Entities
|
|||||||
if (GetMiscTemplate().ExtraScale.Raw.Data[5] != 0)
|
if (GetMiscTemplate().ExtraScale.Raw.Data[5] != 0)
|
||||||
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.ParameterCurve), GetMiscTemplate().ExtraScale.Raw.Data[5]);
|
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.ParameterCurve), GetMiscTemplate().ExtraScale.Raw.Data[5]);
|
||||||
if (GetMiscTemplate().ExtraScale.Structured.OverrideActive != 0)
|
if (GetMiscTemplate().ExtraScale.Structured.OverrideActive != 0)
|
||||||
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.OverrideActive), GetMiscTemplate().ExtraScale.Structured.OverrideActive != 0 ? true : false);
|
SetUpdateFieldValue(extraScaleCurve.ModifyValue(extraScaleCurve.OverrideActive), GetMiscTemplate().ExtraScale.Structured.OverrideActive != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -921,7 +921,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public Unit SelectVictim()
|
public Unit SelectVictim()
|
||||||
{
|
{
|
||||||
Unit target = null;
|
Unit target;
|
||||||
|
|
||||||
ThreatManager mgr = GetThreatManager();
|
ThreatManager mgr = GetThreatManager();
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ namespace Game.Misc
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Store texts for localization.
|
// Store texts for localization.
|
||||||
string strOptionText = "", strBoxText = "";
|
string strOptionText, strBoxText;
|
||||||
BroadcastTextRecord optionBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(item.OptionBroadcastTextId);
|
BroadcastTextRecord optionBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(item.OptionBroadcastTextId);
|
||||||
BroadcastTextRecord boxBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(item.BoxBroadcastTextId);
|
BroadcastTextRecord boxBroadcastText = CliDB.BroadcastTextStorage.LookupByKey(item.BoxBroadcastTextId);
|
||||||
|
|
||||||
|
|||||||
@@ -635,7 +635,7 @@ namespace Game.Entities
|
|||||||
else
|
else
|
||||||
radius = goInfo.Trap.radius / 2.0f;
|
radius = goInfo.Trap.radius / 2.0f;
|
||||||
|
|
||||||
Unit target = null;
|
Unit target;
|
||||||
// @todo this hack with search required until GO casting not implemented
|
// @todo this hack with search required until GO casting not implemented
|
||||||
Unit owner = GetOwner();
|
Unit owner = GetOwner();
|
||||||
if (owner)
|
if (owner)
|
||||||
@@ -1169,7 +1169,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
long thisRespawnTime = forceDelay != 0 ? GameTime.GetGameTime() + forceDelay : m_respawnTime;
|
long thisRespawnTime = forceDelay != 0 ? GameTime.GetGameTime() + forceDelay : m_respawnTime;
|
||||||
GetMap().SaveRespawnTime(SpawnObjectType.GameObject, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), GridDefines.ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData.dbData ? savetodb : false);
|
GetMap().SaveRespawnTime(SpawnObjectType.GameObject, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), GridDefines.ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData.dbData && savetodb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
posX = (float)(posX + (offset.posX * Math.Cos(Orientation) + offset.posY * Math.Sin(Orientation + MathFunctions.PI)));
|
posX = (float)(posX + (offset.posX * Math.Cos(Orientation) + offset.posY * Math.Sin(Orientation + MathFunctions.PI)));
|
||||||
posY = (float)(posY + (offset.posY * Math.Cos(Orientation) + offset.posX * Math.Sin(Orientation)));
|
posY = (float)(posY + (offset.posY * Math.Cos(Orientation) + offset.posX * Math.Sin(Orientation)));
|
||||||
posZ = posZ + offset.posZ;
|
posZ += offset.posZ;
|
||||||
SetOrientation(Orientation + offset.Orientation);
|
SetOrientation(Orientation + offset.Orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ namespace Game.Entities
|
|||||||
if (o < 0)
|
if (o < 0)
|
||||||
{
|
{
|
||||||
float mod = o * -1;
|
float mod = o * -1;
|
||||||
mod = mod % (2.0f * MathFunctions.PI);
|
mod %= (2.0f * MathFunctions.PI);
|
||||||
mod = -mod + 2.0f * MathFunctions.PI;
|
mod = -mod + 2.0f * MathFunctions.PI;
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,8 @@ namespace Game.Entities
|
|||||||
public class UpdateFieldHolder
|
public class UpdateFieldHolder
|
||||||
{
|
{
|
||||||
UpdateMask _changesMask = new((int)TypeId.Max);
|
UpdateMask _changesMask = new((int)TypeId.Max);
|
||||||
WorldObject _owner;
|
|
||||||
|
|
||||||
public UpdateFieldHolder(WorldObject owner) { _owner = owner; }
|
public UpdateFieldHolder(WorldObject owner) { }
|
||||||
|
|
||||||
public BaseUpdateData<T> ModifyValue<T>(BaseUpdateData<T> updateData)
|
public BaseUpdateData<T> ModifyValue<T>(BaseUpdateData<T> updateData)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.outError(LogFilter.Player, $"Player._LoadInventory: Player '{GetName()}' ({GetGUID().ToString()}) has child item ({item.GetGUID()}, entry: {item.GetEntry()}) which can't be loaded into inventory because parent item was not found (Bag {bagGuid}, slot: {slot}). Item will be sent by mail.");
|
Log.outError(LogFilter.Player, $"Player._LoadInventory: Player '{GetName()}' ({GetGUID()}) has child item ({item.GetGUID()}, entry: {item.GetEntry()}) which can't be loaded into inventory because parent item was not found (Bag {bagGuid}, slot: {slot}). Item will be sent by mail.");
|
||||||
item.DeleteFromInventoryDB(trans);
|
item.DeleteFromInventoryDB(trans);
|
||||||
problematicItems.Enqueue(item);
|
problematicItems.Enqueue(item);
|
||||||
continue;
|
continue;
|
||||||
@@ -1891,7 +1891,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
void _SaveActions(SQLTransaction trans)
|
void _SaveActions(SQLTransaction trans)
|
||||||
{
|
{
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt;
|
||||||
|
|
||||||
foreach (var pair in m_actionButtons.ToList())
|
foreach (var pair in m_actionButtons.ToList())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -495,8 +495,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
InventoryResult CanStoreItem(byte bag, byte slot, List<ItemPosCount> dest, uint entry, uint count, Item pItem, bool swap)
|
InventoryResult CanStoreItem(byte bag, byte slot, List<ItemPosCount> dest, uint entry, uint count, Item pItem, bool swap)
|
||||||
{
|
{
|
||||||
uint throwaway;
|
return CanStoreItem(bag, slot, dest, entry, count, pItem, swap, out _);
|
||||||
return CanStoreItem(bag, slot, dest, entry, count, pItem, swap, out throwaway);
|
|
||||||
}
|
}
|
||||||
InventoryResult CanStoreItem(byte bag, byte slot, List<ItemPosCount> dest, uint entry, uint count, Item pItem, bool swap, out uint no_space_count)
|
InventoryResult CanStoreItem(byte bag, byte slot, List<ItemPosCount> dest, uint entry, uint count, Item pItem, bool swap, out uint no_space_count)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1413,13 +1413,13 @@ namespace Game.Entities
|
|||||||
switch (Condition.Operator[i])
|
switch (Condition.Operator[i])
|
||||||
{
|
{
|
||||||
case 2: // requires less <color> than (<value> || <comparecolor>) gems
|
case 2: // requires less <color> than (<value> || <comparecolor>) gems
|
||||||
activate &= (_cur_gem < _cmp_gem) ? true : false;
|
activate &= (_cur_gem < _cmp_gem);
|
||||||
break;
|
break;
|
||||||
case 3: // requires more <color> than (<value> || <comparecolor>) gems
|
case 3: // requires more <color> than (<value> || <comparecolor>) gems
|
||||||
activate &= (_cur_gem > _cmp_gem) ? true : false;
|
activate &= (_cur_gem > _cmp_gem);
|
||||||
break;
|
break;
|
||||||
case 5: // requires at least <color> than (<value> || <comparecolor>) gems
|
case 5: // requires at least <color> than (<value> || <comparecolor>) gems
|
||||||
activate &= (_cur_gem >= _cmp_gem) ? true : false;
|
activate &= (_cur_gem >= _cmp_gem);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2039,7 +2039,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
PlayerSpell spell = m_spells.LookupByKey(spellId);
|
PlayerSpell spell = m_spells.LookupByKey(spellId);
|
||||||
|
|
||||||
bool disabled = (spell != null) ? spell.Disabled : false;
|
bool disabled = (spell != null) && spell.Disabled;
|
||||||
bool active = !disabled || spell.Active;
|
bool active = !disabled || spell.Active;
|
||||||
|
|
||||||
bool learning = AddSpell(spellId, active, true, dependent, false, false, fromSkill);
|
bool learning = AddSpell(spellId, active, true, dependent, false, false, fromSkill);
|
||||||
@@ -2989,7 +2989,7 @@ namespace Game.Entities
|
|||||||
public void SetRuneCooldown(byte index, uint cooldown)
|
public void SetRuneCooldown(byte index, uint cooldown)
|
||||||
{
|
{
|
||||||
m_runes.Cooldown[index] = cooldown;
|
m_runes.Cooldown[index] = cooldown;
|
||||||
m_runes.SetRuneState(index, (cooldown == 0) ? true : false);
|
m_runes.SetRuneState(index, (cooldown == 0));
|
||||||
int activeRunes = m_runes.Cooldown.Count(p => p == 0);
|
int activeRunes = m_runes.Cooldown.Count(p => p == 0);
|
||||||
if (activeRunes != GetPower(PowerType.Runes))
|
if (activeRunes != GetPower(PowerType.Runes))
|
||||||
SetPower(PowerType.Runes, activeRunes);
|
SetPower(PowerType.Runes, activeRunes);
|
||||||
|
|||||||
@@ -155,9 +155,8 @@ namespace Game.Entities
|
|||||||
|
|
||||||
for (int i = 1; i < m_TaxiDestinations.Count; ++i)
|
for (int i = 1; i < m_TaxiDestinations.Count; ++i)
|
||||||
{
|
{
|
||||||
uint cost;
|
|
||||||
uint path;
|
uint path;
|
||||||
Global.ObjectMgr.GetTaxiPath(m_TaxiDestinations[i - 1], m_TaxiDestinations[i], out path, out cost);
|
Global.ObjectMgr.GetTaxiPath(m_TaxiDestinations[i - 1], m_TaxiDestinations[i], out path, out _);
|
||||||
if (path == 0)
|
if (path == 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -189,9 +188,8 @@ namespace Game.Entities
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
uint path;
|
uint path;
|
||||||
uint cost;
|
|
||||||
|
|
||||||
Global.ObjectMgr.GetTaxiPath(m_TaxiDestinations[0], m_TaxiDestinations[1], out path, out cost);
|
Global.ObjectMgr.GetTaxiPath(m_TaxiDestinations[0], m_TaxiDestinations[1], out path, out _);
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,8 +137,7 @@ namespace Game.Entities
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Find if we have a direct path
|
// Find if we have a direct path
|
||||||
uint pathId, goldCost;
|
Global.ObjectMgr.GetTaxiPath(from.Id, to.Id, out uint pathId, out _);
|
||||||
Global.ObjectMgr.GetTaxiPath(from.Id, to.Id, out pathId, out goldCost);
|
|
||||||
if (pathId != 0)
|
if (pathId != 0)
|
||||||
{
|
{
|
||||||
shortestPath.Add(from.Id);
|
shortestPath.Add(from.Id);
|
||||||
|
|||||||
@@ -833,7 +833,7 @@ namespace Game.Entities
|
|||||||
if (ranged)
|
if (ranged)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float val = 0.0f;
|
float val;
|
||||||
float bonusAP = 0.0f;
|
float bonusAP = 0.0f;
|
||||||
UnitMods unitMod = UnitMods.AttackPower;
|
UnitMods unitMod = UnitMods.AttackPower;
|
||||||
|
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ namespace Game.Entities
|
|||||||
if (_pendingStop && GetGoState() != GameObjectState.Ready)
|
if (_pendingStop && GetGoState() != GameObjectState.Ready)
|
||||||
{
|
{
|
||||||
SetGoState(GameObjectState.Ready);
|
SetGoState(GameObjectState.Ready);
|
||||||
m_goValue.Transport.PathProgress = (m_goValue.Transport.PathProgress / GetTransportPeriod());
|
m_goValue.Transport.PathProgress /= GetTransportPeriod();
|
||||||
m_goValue.Transport.PathProgress *= GetTransportPeriod();
|
m_goValue.Transport.PathProgress *= GetTransportPeriod();
|
||||||
m_goValue.Transport.PathProgress += _currentFrame.ArriveTime;
|
m_goValue.Transport.PathProgress += _currentFrame.ArriveTime;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
_charmspells[x].SetActionAndType(spellId, ActiveStates.Disabled);
|
_charmspells[x].SetActionAndType(spellId, ActiveStates.Disabled);
|
||||||
|
|
||||||
ActiveStates newstate = ActiveStates.Passive;
|
ActiveStates newstate;
|
||||||
|
|
||||||
if (!spellInfo.IsAutocastable())
|
if (!spellInfo.IsAutocastable())
|
||||||
newstate = ActiveStates.Passive;
|
newstate = ActiveStates.Passive;
|
||||||
|
|||||||
@@ -1337,7 +1337,7 @@ namespace Game.Entities
|
|||||||
// 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8.
|
// 1. > 2. > 3. > 4. > 5. > 6. > 7. > 8.
|
||||||
// MISS > DODGE > PARRY > GLANCING > BLOCK > CRIT > CRUSHING > HIT
|
// MISS > DODGE > PARRY > GLANCING > BLOCK > CRIT > CRUSHING > HIT
|
||||||
|
|
||||||
int sum = 0, tmp = 0;
|
int sum = 0;
|
||||||
int roll = RandomHelper.IRand(0, 9999);
|
int roll = RandomHelper.IRand(0, 9999);
|
||||||
|
|
||||||
uint attackerLevel = GetLevelForTarget(victim);
|
uint attackerLevel = GetLevelForTarget(victim);
|
||||||
@@ -1357,7 +1357,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 1. MISS
|
// 1. MISS
|
||||||
tmp = miss_chance;
|
int tmp = miss_chance;
|
||||||
if (tmp > 0 && roll < (sum += tmp))
|
if (tmp > 0 && roll < (sum += tmp))
|
||||||
return MeleeHitOutcome.Miss;
|
return MeleeHitOutcome.Miss;
|
||||||
|
|
||||||
@@ -1477,9 +1477,9 @@ namespace Game.Entities
|
|||||||
|
|
||||||
if (minDamage > maxDamage)
|
if (minDamage > maxDamage)
|
||||||
{
|
{
|
||||||
minDamage = minDamage + maxDamage;
|
minDamage += maxDamage;
|
||||||
maxDamage = minDamage - maxDamage;
|
maxDamage = minDamage - maxDamage;
|
||||||
minDamage = minDamage - maxDamage;
|
minDamage -= maxDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxDamage == 0.0f)
|
if (maxDamage == 0.0f)
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
//Spells
|
//Spells
|
||||||
protected Dictionary<CurrentSpellTypes, Spell> m_currentSpells = new((int)CurrentSpellTypes.Max);
|
protected Dictionary<CurrentSpellTypes, Spell> m_currentSpells = new((int)CurrentSpellTypes.Max);
|
||||||
Dictionary<SpellValueMod, int> CustomSpellValueMod = new();
|
|
||||||
MultiMap<uint, uint>[] m_spellImmune = new MultiMap<uint, uint>[(int)SpellImmunity.Max];
|
MultiMap<uint, uint>[] m_spellImmune = new MultiMap<uint, uint>[(int)SpellImmunity.Max];
|
||||||
SpellAuraInterruptFlags m_interruptMask;
|
SpellAuraInterruptFlags m_interruptMask;
|
||||||
SpellAuraInterruptFlags2 m_interruptMask2;
|
SpellAuraInterruptFlags2 m_interruptMask2;
|
||||||
@@ -93,7 +92,6 @@ namespace Game.Entities
|
|||||||
SpellHistory _spellHistory;
|
SpellHistory _spellHistory;
|
||||||
|
|
||||||
//Auras
|
//Auras
|
||||||
List<AuraEffect> AuraEffectList = new();
|
|
||||||
MultiMap<AuraType, AuraEffect> m_modAuras = new();
|
MultiMap<AuraType, AuraEffect> m_modAuras = new();
|
||||||
List<Aura> m_removedAuras = new();
|
List<Aura> m_removedAuras = new();
|
||||||
List<AuraApplication> m_interruptableAuras = new(); // auras which have interrupt mask applied on unit
|
List<AuraApplication> m_interruptableAuras = new(); // auras which have interrupt mask applied on unit
|
||||||
|
|||||||
@@ -687,8 +687,8 @@ namespace Game.Entities
|
|||||||
uint areaId = GetAreaId();
|
uint areaId = GetAreaId();
|
||||||
uint ridingSkill = 5000;
|
uint ridingSkill = 5000;
|
||||||
AreaMountFlags mountFlags = 0;
|
AreaMountFlags mountFlags = 0;
|
||||||
bool isSubmerged = false;
|
bool isSubmerged;
|
||||||
bool isInWater = false;
|
bool isInWater;
|
||||||
|
|
||||||
if (IsTypeId(TypeId.Player))
|
if (IsTypeId(TypeId.Player))
|
||||||
ridingSkill = ToPlayer().GetSkillValue(SkillType.Riding);
|
ridingSkill = ToPlayer().GetSkillValue(SkillType.Riding);
|
||||||
@@ -705,8 +705,7 @@ namespace Game.Entities
|
|||||||
mountFlags = (AreaMountFlags)areaTable.MountFlags;
|
mountFlags = (AreaMountFlags)areaTable.MountFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
LiquidData liquid;
|
ZLiquidStatus liquidStatus = GetMap().GetLiquidStatus(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), LiquidHeaderTypeFlags.AllLiquids, out _);
|
||||||
ZLiquidStatus liquidStatus = GetMap().GetLiquidStatus(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), LiquidHeaderTypeFlags.AllLiquids, out liquid);
|
|
||||||
isSubmerged = liquidStatus.HasAnyFlag(ZLiquidStatus.UnderWater) || HasUnitMovementFlag(MovementFlag.Swimming);
|
isSubmerged = liquidStatus.HasAnyFlag(ZLiquidStatus.UnderWater) || HasUnitMovementFlag(MovementFlag.Swimming);
|
||||||
isInWater = liquidStatus.HasAnyFlag(ZLiquidStatus.InWater | ZLiquidStatus.UnderWater);
|
isInWater = liquidStatus.HasAnyFlag(ZLiquidStatus.InWater | ZLiquidStatus.UnderWater);
|
||||||
|
|
||||||
|
|||||||
@@ -1371,7 +1371,7 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public bool IsVisible()
|
public bool IsVisible()
|
||||||
{
|
{
|
||||||
return (m_serverSideVisibility.GetValue(ServerSideVisibilityType.GM) > (uint)AccountTypes.Player) ? false : true;
|
return m_serverSideVisibility.GetValue(ServerSideVisibilityType.GM) <= (uint)AccountTypes.Player;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetVisible(bool val)
|
public void SetVisible(bool val)
|
||||||
|
|||||||
@@ -527,7 +527,6 @@ namespace Game.Entities
|
|||||||
|
|
||||||
Unit _me;
|
Unit _me;
|
||||||
VehicleRecord _vehicleInfo; //< DBC data for vehicle
|
VehicleRecord _vehicleInfo; //< DBC data for vehicle
|
||||||
List<ulong> vehiclePlayers = new();
|
|
||||||
|
|
||||||
uint _creatureEntry; //< Can be different than the entry of _me in case of players
|
uint _creatureEntry; //< Can be different than the entry of _me in case of players
|
||||||
Status _status; //< Internal variable for sanity checks
|
Status _status; //< Internal variable for sanity checks
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ namespace Game.Garrisons
|
|||||||
|
|
||||||
foreach (var guid in BuildingInfo.Spawns)
|
foreach (var guid in BuildingInfo.Spawns)
|
||||||
{
|
{
|
||||||
WorldObject obj = null;
|
WorldObject obj;
|
||||||
switch (guid.GetHigh())
|
switch (guid.GetHigh())
|
||||||
{
|
{
|
||||||
case HighGuid.Creature:
|
case HighGuid.Creature:
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace Game
|
|||||||
{
|
{
|
||||||
int pos = name.IndexOf('-');
|
int pos = name.IndexOf('-');
|
||||||
if (pos != -1)
|
if (pos != -1)
|
||||||
return new ExtendedPlayerName(name.Substring(0, pos), name.Substring(pos + 1));
|
return new ExtendedPlayerName(name.Substring(0, pos), name[(pos + 1)..]);
|
||||||
else
|
else
|
||||||
return new ExtendedPlayerName(name, "");
|
return new ExtendedPlayerName(name, "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ namespace Game.Groups
|
|||||||
|
|
||||||
public void ConvertToRaid()
|
public void ConvertToRaid()
|
||||||
{
|
{
|
||||||
m_groupFlags = (m_groupFlags | GroupFlags.Raid);
|
m_groupFlags |= GroupFlags.Raid;
|
||||||
|
|
||||||
_initRaidSubGroupsCounter();
|
_initRaidSubGroupsCounter();
|
||||||
|
|
||||||
@@ -1144,7 +1144,7 @@ namespace Game.Groups
|
|||||||
{
|
{
|
||||||
byte maxresul = 0;
|
byte maxresul = 0;
|
||||||
ObjectGuid maxguid = ObjectGuid.Empty;
|
ObjectGuid maxguid = ObjectGuid.Empty;
|
||||||
Player player = null;
|
Player player;
|
||||||
|
|
||||||
foreach (var pair in roll.playerVote)
|
foreach (var pair in roll.playerVote)
|
||||||
{
|
{
|
||||||
@@ -1205,7 +1205,7 @@ namespace Game.Groups
|
|||||||
{
|
{
|
||||||
byte maxresul = 0;
|
byte maxresul = 0;
|
||||||
ObjectGuid maxguid = ObjectGuid.Empty;
|
ObjectGuid maxguid = ObjectGuid.Empty;
|
||||||
Player player = null;
|
Player player;
|
||||||
RollType rollVote = RollType.NotValid;
|
RollType rollVote = RollType.NotValid;
|
||||||
|
|
||||||
foreach (var pair in roll.playerVote)
|
foreach (var pair in roll.playerVote)
|
||||||
@@ -2102,7 +2102,7 @@ namespace Game.Groups
|
|||||||
public void ResetMaxEnchantingLevel()
|
public void ResetMaxEnchantingLevel()
|
||||||
{
|
{
|
||||||
m_maxEnchantingLevel = 0;
|
m_maxEnchantingLevel = 0;
|
||||||
Player member = null;
|
Player member;
|
||||||
foreach (var memberSlot in m_memberSlots)
|
foreach (var memberSlot in m_memberSlots)
|
||||||
{
|
{
|
||||||
member = Global.ObjAccessor.FindPlayer(memberSlot.guid);
|
member = Global.ObjAccessor.FindPlayer(memberSlot.guid);
|
||||||
|
|||||||
@@ -783,7 +783,7 @@ namespace Game
|
|||||||
bool _sendFactionIncreased; //! Play visual effect on next SMSG_SET_FACTION_STANDING sent
|
bool _sendFactionIncreased; //! Play visual effect on next SMSG_SET_FACTION_STANDING sent
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
static int[] ReputationRankThresholds =
|
public static int[] ReputationRankThresholds =
|
||||||
{
|
{
|
||||||
-42000,
|
-42000,
|
||||||
// Hated
|
// Hated
|
||||||
@@ -803,7 +803,7 @@ namespace Game
|
|||||||
// Exalted
|
// Exalted
|
||||||
};
|
};
|
||||||
|
|
||||||
static CypherStrings[] ReputationRankStrIndex =
|
public static CypherStrings[] ReputationRankStrIndex =
|
||||||
{
|
{
|
||||||
CypherStrings.RepHated, CypherStrings.RepHostile, CypherStrings.RepUnfriendly, CypherStrings.RepNeutral,
|
CypherStrings.RepHated, CypherStrings.RepHostile, CypherStrings.RepUnfriendly, CypherStrings.RepNeutral,
|
||||||
CypherStrings.RepFriendly, CypherStrings.RepHonored, CypherStrings.RepRevered, CypherStrings.RepExalted
|
CypherStrings.RepFriendly, CypherStrings.RepHonored, CypherStrings.RepRevered, CypherStrings.RepExalted
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace WorldServer
|
|||||||
//- Launch CliRunnable thread
|
//- Launch CliRunnable thread
|
||||||
if (ConfigMgr.GetDefaultValue("Console.Enable", true))
|
if (ConfigMgr.GetDefaultValue("Console.Enable", true))
|
||||||
{
|
{
|
||||||
Thread commandThread = new Thread(CommandManager.InitConsole);
|
Thread commandThread = new(CommandManager.InitConsole);
|
||||||
commandThread.Start();
|
commandThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +143,7 @@ namespace WorldServer
|
|||||||
static bool StartDB()
|
static bool StartDB()
|
||||||
{
|
{
|
||||||
// Load databases
|
// Load databases
|
||||||
DatabaseLoader loader = new DatabaseLoader(DatabaseTypeFlags.All);
|
DatabaseLoader loader = new(DatabaseTypeFlags.All);
|
||||||
loader.AddDatabase(DB.Login, "Login");
|
loader.AddDatabase(DB.Login, "Login");
|
||||||
loader.AddDatabase(DB.Characters, "Character");
|
loader.AddDatabase(DB.Characters, "Character");
|
||||||
loader.AddDatabase(DB.World, "World");
|
loader.AddDatabase(DB.World, "World");
|
||||||
|
|||||||
Reference in New Issue
Block a user