Refactoring of BNetServer

This commit is contained in:
hondacrx
2020-07-12 00:06:43 -04:00
parent 4164384b72
commit 581d077acd
318 changed files with 2046 additions and 4694 deletions
+2 -2
View File
@@ -317,7 +317,7 @@ namespace Game.Chat.Commands
[Command("account", RBACPermissions.CommandBanlistAccount, true)]
static bool HandleBanListAccountCommand(StringArguments args, CommandHandler handler)
{
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_EXPIRED_IP_BANS);
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans);
DB.Login.Execute(stmt);
string filterStr = args.NextString();
@@ -433,7 +433,7 @@ namespace Game.Chat.Commands
[Command("ip", RBACPermissions.CommandBanlistIp, true)]
static bool HandleBanListIPCommand(StringArguments args, CommandHandler handler)
{
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DEL_EXPIRED_IP_BANS);
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.DelExpiredIpBans);
DB.Login.Execute(stmt);
string filterStr = args.NextString();
@@ -40,7 +40,7 @@ namespace Game.Chat
if (!handler.ExtractPlayerTarget(args, out target))
return false;
LocaleConstant loc = handler.GetSessionDbcLocale();
Locale loc = handler.GetSessionDbcLocale();
string targetName = target.GetName();
string knownStr = handler.GetCypherString(CypherStrings.Known);
@@ -405,7 +405,7 @@ namespace Game.Chat
if (!handler.ExtractPlayerTarget(args, out target))
return false;
LocaleConstant loc = handler.GetSessionDbcLocale();
Locale loc = handler.GetSessionDbcLocale();
var targetFSL = target.GetReputationMgr().GetStateList();
foreach (var pair in targetFSL)
+1 -1
View File
@@ -23,7 +23,7 @@ using Game.Combat;
using Game.DataStorage;
using Game.Entities;
using Game.Maps;
using Game.Network.Packets;
using Game.Networking.Packets;
using System;
using System.Collections.Generic;
using System.Text;
+1 -1
View File
@@ -170,7 +170,7 @@ namespace Game.Chat
// Get the accounts with GM Level >0
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_GM_ACCOUNTS);
stmt.AddValue(0, AccountTypes.Moderator);
stmt.AddValue(1, Global.WorldMgr.GetRealm().Id.Realm);
stmt.AddValue(1, Global.WorldMgr.GetRealm().Id.Index);
SQLResult result = DB.Login.Query(stmt);
if (!result.IsEmpty())
+3 -3
View File
@@ -164,7 +164,7 @@ namespace Game.Chat.Commands
skillInfo.CanLink == 0) // only prof with recipes have set
continue;
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
name = skillInfo.DisplayName[locale];
if (string.IsNullOrEmpty(name))
continue;
@@ -172,7 +172,7 @@ namespace Game.Chat.Commands
if (!name.Like(namePart))
{
locale = 0;
for (; locale < LocaleConstant.Total; ++locale)
for (; locale < Locale.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
@@ -186,7 +186,7 @@ namespace Game.Chat.Commands
}
}
if (locale < LocaleConstant.Total)
if (locale < Locale.Total)
{
skillId = skillInfo.Id;
break;
+23 -23
View File
@@ -45,7 +45,7 @@ namespace Game.Chat
// Search in AreaTable.dbc
foreach (var areaEntry in CliDB.AreaTableStorage.Values)
{
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
string name = areaEntry.AreaName[locale];
if (string.IsNullOrEmpty(name))
continue;
@@ -53,7 +53,7 @@ namespace Game.Chat
if (!name.Like(namePart))
{
locale = 0;
for (; locale < LocaleConstant.Total; ++locale)
for (; locale < Locale.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
@@ -67,7 +67,7 @@ namespace Game.Chat
}
}
if (locale < LocaleConstant.Total)
if (locale < Locale.Total)
{
if (maxlookup != 0 && count++ == maxlookup)
{
@@ -234,7 +234,7 @@ namespace Game.Chat
{
FactionState factionState = target ? target.GetReputationMgr().GetState(factionEntry) : null;
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
string name = factionEntry.Name[locale];
if (string.IsNullOrEmpty(name))
continue;
@@ -242,7 +242,7 @@ namespace Game.Chat
if (!name.Like(namePart))
{
locale = 0;
for (; locale < LocaleConstant.Total; ++locale)
for (; locale < Locale.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
@@ -256,7 +256,7 @@ namespace Game.Chat
}
}
if (locale < LocaleConstant.Total)
if (locale < Locale.Total)
{
if (maxlookup != 0 && count++ == maxlookup)
{
@@ -365,7 +365,7 @@ namespace Game.Chat
// Search in ItemSet.dbc
foreach (var set in CliDB.ItemSetStorage.Values)
{
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
string name = set.Name[locale];
if (name.IsEmpty())
continue;
@@ -373,7 +373,7 @@ namespace Game.Chat
if (!name.Like(namePart))
{
locale = 0;
for (; locale < LocaleConstant.Total; ++locale)
for (; locale < Locale.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
@@ -387,7 +387,7 @@ namespace Game.Chat
}
}
if (locale < LocaleConstant.Total)
if (locale < Locale.Total)
{
if (maxlookup != 0 && count++ == maxlookup)
{
@@ -629,7 +629,7 @@ namespace Game.Chat
// Search in SkillLine.dbc
foreach (var skillInfo in CliDB.SkillLineStorage.Values)
{
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
string name = skillInfo.DisplayName[locale];
if (string.IsNullOrEmpty(name))
continue;
@@ -637,7 +637,7 @@ namespace Game.Chat
if (!name.Like(namePart))
{
locale = 0;
for (; locale < LocaleConstant.Total; ++locale)
for (; locale < Locale.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
@@ -651,7 +651,7 @@ namespace Game.Chat
}
}
if (locale < LocaleConstant.Total)
if (locale < Locale.Total)
{
if (maxlookup != 0 && count++ == maxlookup)
{
@@ -700,7 +700,7 @@ namespace Game.Chat
bool found = false;
uint count = 0;
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
// Search in TaxiNodes.dbc
foreach (var nodeEntry in CliDB.TaxiNodesStorage.Values)
@@ -802,7 +802,7 @@ namespace Game.Chat
if (target && target.GetGender() != gender)
continue;
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
string name = gender == Gender.Male ? titleInfo.Name[locale]: titleInfo.Name1[locale];
if (string.IsNullOrEmpty(name))
continue;
@@ -810,7 +810,7 @@ namespace Game.Chat
if (!name.Like(namePart))
{
locale = 0;
for (; locale < LocaleConstant.Total; ++locale)
for (; locale < Locale.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
@@ -824,7 +824,7 @@ namespace Game.Chat
}
}
if (locale < LocaleConstant.Total)
if (locale < Locale.Total)
{
if (maxlookup != 0 && counter == maxlookup)
{
@@ -869,7 +869,7 @@ namespace Game.Chat
// search in Map.dbc
foreach (var mapInfo in CliDB.MapStorage.Values)
{
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
string name = mapInfo.MapName[locale];
if (string.IsNullOrEmpty(name))
continue;
@@ -877,7 +877,7 @@ namespace Game.Chat
if (!name.Like(namePart) && handler.GetSession())
{
locale = 0;
for (; locale < LocaleConstant.Total; ++locale)
for (; locale < Locale.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
@@ -891,7 +891,7 @@ namespace Game.Chat
}
}
if (locale < LocaleConstant.Total)
if (locale < Locale.Total)
{
if (maxlookup != 0 && counter == maxlookup)
{
@@ -1071,7 +1071,7 @@ namespace Game.Chat
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(spellName.Id, Difficulty.None);
if (spellInfo != null)
{
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
string name = spellInfo.SpellName[locale];
if (name.IsEmpty())
continue;
@@ -1079,7 +1079,7 @@ namespace Game.Chat
if (!name.Like(namePart))
{
locale = 0;
for (; locale < LocaleConstant.Total; ++locale)
for (; locale < Locale.Total; ++locale)
{
if (locale == handler.GetSessionDbcLocale())
continue;
@@ -1093,7 +1093,7 @@ namespace Game.Chat
}
}
if (locale < LocaleConstant.Total)
if (locale < Locale.Total)
{
if (maxlookup != 0 && count++ == maxlookup)
{
@@ -1167,7 +1167,7 @@ namespace Game.Chat
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(id, Difficulty.None);
if (spellInfo != null)
{
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
string name = spellInfo.SpellName[locale];
if (string.IsNullOrEmpty(name))
{
+1 -1
View File
@@ -20,7 +20,7 @@ using Framework.Database;
using Framework.IO;
using Game.DataStorage;
using Game.Entities;
using Game.Network.Packets;
using Game.Networking.Packets;
using System;
namespace Game.Chat
+4 -4
View File
@@ -24,7 +24,7 @@ using Game.Entities;
using Game.Groups;
using Game.Maps;
using Game.Movement;
using Game.Network.Packets;
using Game.Networking.Packets;
using Game.Spells;
using System;
using System.Collections.Generic;
@@ -263,7 +263,7 @@ namespace Game.Chat
{
var record = CliDB.ItemSparseStorage.Values.FirstOrDefault(itemSparse =>
{
for (LocaleConstant i = 0; i < LocaleConstant.Total; ++i)
for (Locale i = 0; i < Locale.Total; ++i)
if (itemName == itemSparse.Display[i])
return true;
return false;
@@ -1359,7 +1359,7 @@ namespace Game.Chat
Race raceid;
Class classid;
Gender gender;
LocaleConstant locale = handler.GetSessionDbcLocale();
Locale locale = handler.GetSessionDbcLocale();
uint totalPlayerTime;
uint level;
string alive = handler.GetCypherString(CypherStrings.Error);
@@ -1437,7 +1437,7 @@ namespace Game.Chat
// Query the prepared statement for login data
stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_PINFO);
stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Realm);
stmt.AddValue(0, Global.WorldMgr.GetRealm().Id.Index);
stmt.AddValue(1, accId);
SQLResult result0 = DB.Login.Query(stmt);
+1 -1
View File
@@ -19,7 +19,7 @@ using Framework.Constants;
using Framework.IO;
using Game.DataStorage;
using Game.Entities;
using Game.Network.Packets;
using Game.Networking.Packets;
using System;
using System.Collections.Generic;
+1 -1
View File
@@ -296,7 +296,7 @@ namespace Game.Chat.Commands
if (rdata == null)
{
data.rbac = new RBACData(accountId, accountName, (int)Global.WorldMgr.GetRealm().Id.Realm, (byte)Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Realm));
data.rbac = new RBACData(accountId, accountName, (int)Global.WorldMgr.GetRealm().Id.Index, (byte)Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Index));
data.rbac.LoadFromDB();
data.needDelete = true;
}
+3 -3
View File
@@ -260,7 +260,7 @@ namespace Game.Chat.Commands
ObjectGuid targetGuid = Global.CharacterCacheStorage.GetCharacterGuidByName(target);
uint accountId = Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(targetGuid);
// Target must exist and have administrative rights
if (!Global.AccountMgr.HasPermission(accountId, RBACPermissions.CommandsBeAssignedTicket, Global.WorldMgr.GetRealm().Id.Realm))
if (!Global.AccountMgr.HasPermission(accountId, RBACPermissions.CommandsBeAssignedTicket, Global.WorldMgr.GetRealm().Id.Index))
{
handler.SendSysMessage(CypherStrings.CommandTicketassignerrorA);
return true;
@@ -283,7 +283,7 @@ namespace Game.Chat.Commands
}
// Assign ticket
ticket.SetAssignedTo(targetGuid, Global.AccountMgr.IsAdminAccount(Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Realm)));
ticket.SetAssignedTo(targetGuid, Global.AccountMgr.IsAdminAccount(Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Index)));
ticket.SaveToDB();
string msg = ticket.FormatViewMessageString(handler, null, target, null, null);
@@ -448,7 +448,7 @@ namespace Game.Chat.Commands
{
ObjectGuid guid = ticket.GetAssignedToGUID();
uint accountId = Global.CharacterCacheStorage.GetCharacterAccountIdByGuid(guid);
security = Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Realm);
security = Global.AccountMgr.GetSecurity(accountId, (int)Global.WorldMgr.GetRealm().Id.Index);
}
// Check security