Small changes/static refactoring

This commit is contained in:
Lucca Faria Ferri 2023-01-28 07:32:07 -08:00
parent 790b9f6d50
commit ef393fb6c0
22 changed files with 259 additions and 256 deletions

View File

@ -948,7 +948,7 @@ public class GameAccount : PersistentRPCObject
.SetName("D3.NotificationMessage.Payload") .SetName("D3.NotificationMessage.Payload")
.SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(update.Build().ToByteString()))); .SetValue(bgs.protocol.Variant.CreateBuilder().SetMessageValue(update.Build().ToByteString())));
LoggedInClient.MakeRPC((lid) => LoggedInClient.MakeRpc((lid) =>
bgs.protocol.notification.v1.NotificationListener.CreateStub(LoggedInClient).OnNotificationReceived( bgs.protocol.notification.v1.NotificationListener.CreateStub(LoggedInClient).OnNotificationReceived(
new HandlerController() new HandlerController()
{ {

View File

@ -16,19 +16,19 @@ namespace DiIiS_NA.LoginServer.Battle
{ {
public class BattleBackend public class BattleBackend
{ {
private static readonly Logger Logger = LogManager.CreateLogger("BattleNetEmu"); private static readonly Logger Logger = LogManager.CreateLogger("BattleBackend");
public WatsonTcpServer GameServerSocket; public readonly WatsonTcpServer GameServerSocket;
public struct ServerDescriptor public struct ServerDescriptor
{ {
public string GameIP; public string GameIp;
public int GamePort; public int GamePort;
}; };
public Dictionary<string, ServerDescriptor> GameServers = new Dictionary<string, ServerDescriptor>(); public readonly Dictionary<string, ServerDescriptor> GameServers = new();
public Dictionary<string, ServerDescriptor> PvPGameServers = new Dictionary<string, ServerDescriptor>(); private readonly Dictionary<string, ServerDescriptor> _pvPGameServers = new();
public BattleBackend(string battleHost, int port) public BattleBackend(string battleHost, int port)
{ {
@ -38,33 +38,36 @@ namespace DiIiS_NA.LoginServer.Battle
private bool ReceiverClientConnected(string ipPort) private bool ReceiverClientConnected(string ipPort)
{ {
Logger.Info($"Blizzless server loaded {ipPort} - connecting..."); Logger.Info($"Blizzless client connected {ipPort}...");
return true; return true;
} }
private bool ReceiverClientDisconnected(string ipPort) private bool ReceiverClientDisconnected(string ipPort)
{ {
Logger.Warn("Blizzless server at {0} was disconnected!", ipPort); Logger.Warn("Blizzless client disconnected $[white]${0}$[/]$!", ipPort);
if (GameServers.ContainsKey(ipPort)) GameServers.Remove(ipPort); if (GameServers.ContainsKey(ipPort)) GameServers.Remove(ipPort);
if (PvPGameServers.ContainsKey(ipPort)) PvPGameServers.Remove(ipPort); if (_pvPGameServers.ContainsKey(ipPort)) _pvPGameServers.Remove(ipPort);
if (GameServers.Count == 0) if (GameServers.Count == 0)
Logger.Warn("GameServers list is empty! Unable to use PvE game activities atm."); Logger.Warn("GameServers list is empty! Unable to use PvE game activities atm.");
if (PvPGameServers.Count == 0) if (_pvPGameServers.Count == 0)
Logger.Warn("PvPGameServers list is empty! Unable to use PvP game activities atm."); Logger.Warn("PvPGameServers list is empty! Unable to use PvP game activities atm.");
return true; return true;
} }
public void CreateGame(string ipPort, int GameId, int level, int act, int difficulty, int questId, int questStepId, bool isHardcore, int gamemode, bool iSseasoned, int perftest_id = 0) public void CreateGame(string ipPort, int gameId, int level, int act, int difficulty, int questId, int questStepId, bool isHardcore, int gameMode, bool isSeasoned, int perftestId = 0)
{ {
GameServerSocket.Send(ipPort, Encoding.UTF8.GetBytes(string.Format("diiiscg|{0}/{1}/{2}/{3}/{4}/{5}/{6}/{7}/{8}", GameId, level, act, difficulty, questId, questStepId, isHardcore, gamemode, iSseasoned, perftest_id))); Send(ipPort, $"diiiscg|{gameId}/{level}/{act}/{difficulty}/{questId}/{questStepId}/{isHardcore}/{gameMode}/{isSeasoned}");
} }
private void Send(string ipPort, string data)
=> GameServerSocket.Send(ipPort, Encoding.UTF8.GetBytes(data));
private bool ReceiverMessageReceived(string ipPort, byte[] data) private bool ReceiverMessageReceived(string ipPort, byte[] data)
{ {
string msg = ""; string msg = "";
if (data != null && data.Length > 0) msg = Encoding.UTF8.GetString(data); if (data != null && data.Length > 0) msg = Encoding.UTF8.GetString(data);
Logger.Trace("Message received from {0}: {1}", ipPort, msg); Logger.Trace("Message received from $[grey69]${0}$[/]$: $[white]${1}$[/]$", ipPort, msg);
var message = msg.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var message = msg.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
var args = message[1].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); var args = message[1].Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
@ -72,134 +75,134 @@ namespace DiIiS_NA.LoginServer.Battle
{ {
case "rngsr": case "rngsr":
if (GameServers.ContainsKey(ipPort)) GameServers.Remove(ipPort); if (GameServers.ContainsKey(ipPort)) GameServers.Remove(ipPort);
string rgs_ip = args[0]; string rgsIp = args[0];
int rgs_port = int.Parse(args[1].Trim()); int rgsPort = int.Parse(args[1].Trim());
GameServers.Add(ipPort, new ServerDescriptor { GameIP = rgs_ip, GamePort = rgs_port }); GameServers.Add(ipPort, new ServerDescriptor { GameIp = rgsIp, GamePort = rgsPort });
Logger.Info("Game server was registered for Blizzless {0}:{1}.", rgs_ip, rgs_port); Logger.Info("Game server was registered for Blizzless {0}:{1}.", rgsIp, rgsPort);
break; break;
case "rnpvpgsr": case "rnpvpgsr":
if (PvPGameServers.ContainsKey(ipPort)) PvPGameServers.Remove(ipPort); if (_pvPGameServers.ContainsKey(ipPort)) _pvPGameServers.Remove(ipPort);
string rpgs_ip = args[0]; string rpgsIp = args[0];
int rpgs_port = int.Parse(args[1].Trim()); int rpgsPort = int.Parse(args[1].Trim());
PvPGameServers.Add(ipPort, new ServerDescriptor { GameIP = rpgs_ip, GamePort = rpgs_port }); _pvPGameServers.Add(ipPort, new ServerDescriptor { GameIp = rpgsIp, GamePort = rpgsPort });
Logger.Info("PvP GameServer at {0}:{1} successfully signed and ready to work.", rpgs_ip, rpgs_port); Logger.Info("PvP GameServer at {0}:{1} successfully signed and ready to work.", rpgsIp, rpgsPort);
break; break;
case "grachi": case "grachi":
ulong gachi_accId = ulong.Parse(args[0].Trim()); ulong gachiAccId = ulong.Parse(args[0].Trim());
ulong gachi_achId = ulong.Parse(args[1].Trim()); ulong gachiAchId = ulong.Parse(args[1].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var gachi_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == gachi_accId)) foreach (var gachiInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == gachiAccId))
AchievementManager.GrantAchievement(gachi_invokerClient, gachi_achId); AchievementManager.GrantAchievement(gachiInvokerClient, gachiAchId);
}); });
break; break;
case "gcrit": case "gcrit":
ulong gc_accId = ulong.Parse(args[0].Trim()); ulong gcAccId = ulong.Parse(args[0].Trim());
ulong gc_criId = ulong.Parse(args[1].Trim()); ulong gcCriId = ulong.Parse(args[1].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var gc_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == gc_accId)) foreach (var gcInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == gcAccId))
AchievementManager.GrantCriteria(gc_invokerClient, gc_criId); AchievementManager.GrantCriteria(gcInvokerClient, gcCriId);
}); });
break; break;
case "upequt": case "upequt":
ulong uq_accId = ulong.Parse(args[0].Trim()); ulong uqAccId = ulong.Parse(args[0].Trim());
ulong uq_achId = ulong.Parse(args[1].Trim()); ulong uqAchId = ulong.Parse(args[1].Trim());
uint uq_addCounter = uint.Parse(args[2].Trim()); uint uqAddCounter = uint.Parse(args[2].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var uq_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == uq_accId)) foreach (var uqInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == uqAccId))
AchievementManager.UpdateQuantity(uq_invokerClient, uq_achId, uq_addCounter); AchievementManager.UpdateQuantity(uqInvokerClient, uqAchId, uqAddCounter);
}); });
break; break;
case "uoacce": case "uoacce":
ulong uac_accId = ulong.Parse(args[0].Trim()); ulong uacAccId = ulong.Parse(args[0].Trim());
int uac_typeId = int.Parse(args[1].Trim()); int uacTypeId = int.Parse(args[1].Trim());
uint uac_addCounter = uint.Parse(args[2].Trim()); uint uacAddCounter = uint.Parse(args[2].Trim());
int uac_comparand = int.Parse(args[3].Trim()); int uacComparand = int.Parse(args[3].Trim());
ulong uac_achi = ulong.Parse(args[4].Trim()); ulong uacAchi = ulong.Parse(args[4].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
if (uac_achi == 0) if (uacAchi == 0)
foreach (var uac_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == uac_accId)) foreach (var uacInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == uacAccId))
AchievementManager.UpdateAllCounters(uac_invokerClient, uac_typeId, uac_addCounter, uac_comparand); AchievementManager.UpdateAllCounters(uacInvokerClient, uacTypeId, uacAddCounter, uacComparand);
else else
foreach (var uac_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == uac_accId)) foreach (var uacInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == uacAccId))
AchievementManager.UpdateAllCounters(uac_invokerClient, uac_typeId, uac_addCounter, uac_comparand); AchievementManager.UpdateAllCounters(uacInvokerClient, uacTypeId, uacAddCounter, uacComparand);
}); });
break; break;
case "upsnaccr": //UpdateSingleAchievementCounter case "upsnaccr": //UpdateSingleAchievementCounter
ulong usac_accId = ulong.Parse(args[0].Trim()); ulong usacAccId = ulong.Parse(args[0].Trim());
ulong usac_achId = ulong.Parse(args[1].Trim()); ulong usacAchId = ulong.Parse(args[1].Trim());
uint usac_addCounter = uint.Parse(args[2].Trim()); uint usacAddCounter = uint.Parse(args[2].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var usac_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == usac_accId)) foreach (var usacInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == usacAccId))
AchievementManager.UpdateQuantity(usac_invokerClient, usac_achId, usac_addCounter); AchievementManager.UpdateQuantity(usacInvokerClient, usacAchId, usacAddCounter);
}); });
break; break;
case "cqc": //CheckQuestCriteria case "cqc": //CheckQuestCriteria
ulong cqc_accId = ulong.Parse(args[0].Trim()); ulong cqcAccId = ulong.Parse(args[0].Trim());
int cqc_qId = int.Parse(args[1].Trim()); int cqcQId = int.Parse(args[1].Trim());
bool cqc_isCoop = (args[2].Trim() == "True" ? true : false); bool cqcIsCoop = (args[2].Trim() == "True" ? true : false);
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var cqc_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == cqc_accId)) foreach (var cqcInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == cqcAccId))
AchievementManager.CheckQuestCriteria(cqc_invokerClient, cqc_qId, cqc_isCoop); AchievementManager.CheckQuestCriteria(cqcInvokerClient, cqcQId, cqcIsCoop);
}); });
break; break;
case "ckmc": //CheckKillMonsterCriteria case "ckmc": //CheckKillMonsterCriteria
ulong ckmc_accId = ulong.Parse(args[0].Trim()); ulong ckmcAccId = ulong.Parse(args[0].Trim());
int ckmc_actorId = int.Parse(args[1].Trim()); int ckmcActorId = int.Parse(args[1].Trim());
int ckmc_type = int.Parse(args[2].Trim()); int ckmcType = int.Parse(args[2].Trim());
bool ckmc_isHardcore = (args[3].Trim() == "True" ? true : false); bool ckmcIsHardcore = (args[3].Trim() == "True" ? true : false);
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var ckmc_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == ckmc_accId)) foreach (var ckmcInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == ckmcAccId))
AchievementManager.CheckKillMonsterCriteria(ckmc_invokerClient, ckmc_actorId, ckmc_type, ckmc_isHardcore); AchievementManager.CheckKillMonsterCriteria(ckmcInvokerClient, ckmcActorId, ckmcType, ckmcIsHardcore);
}); });
break; break;
case "clc": //CheckLevelCap case "clc": //CheckLevelCap
ulong clc_accId = ulong.Parse(args[0].Trim()); ulong clcAccId = ulong.Parse(args[0].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var clc_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == clc_accId)) foreach (var clcInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == clcAccId))
AchievementManager.CheckLevelCap(clc_invokerClient); AchievementManager.CheckLevelCap(clcInvokerClient);
}); });
break; break;
case "csic": //CheckSalvageItemCriteria case "csic": //CheckSalvageItemCriteria
ulong csic_accId = ulong.Parse(args[0].Trim()); ulong csicAccId = ulong.Parse(args[0].Trim());
int csic_itemId = int.Parse(args[1].Trim()); int csicItemId = int.Parse(args[1].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var csic_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == csic_accId)) foreach (var csicInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == csicAccId))
AchievementManager.CheckSalvageItemCriteria(csic_invokerClient, csic_itemId); AchievementManager.CheckSalvageItemCriteria(csicInvokerClient, csicItemId);
}); });
break; break;
case "clac": //CheckLevelAreaCriteria case "clac": //CheckLevelAreaCriteria
ulong clac_accId = ulong.Parse(args[0].Trim()); ulong clacAccId = ulong.Parse(args[0].Trim());
int clac_laId = int.Parse(args[1].Trim()); int clacLaId = int.Parse(args[1].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var clac_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == clac_accId)) foreach (var clacInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == clacAccId))
AchievementManager.CheckLevelAreaCriteria(clac_invokerClient, clac_laId); AchievementManager.CheckLevelAreaCriteria(clacInvokerClient, clacLaId);
}); });
break; break;
case "ccc": //CheckConversationCriteria case "ccc": //CheckConversationCriteria
ulong ccc_accId = ulong.Parse(args[0].Trim()); ulong cccAccId = ulong.Parse(args[0].Trim());
int ccc_cId = int.Parse(args[1].Trim()); int cccCId = int.Parse(args[1].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
foreach (var ccc_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == ccc_accId)) foreach (var cccInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == cccAccId))
AchievementManager.CheckConversationCriteria(ccc_invokerClient, ccc_cId); AchievementManager.CheckConversationCriteria(cccInvokerClient, cccCId);
}); });
break; break;
case "plu": //ParagonLevelUp case "plu": //ParagonLevelUp
ulong plu_accId = ulong.Parse(args[0].Trim()); ulong pluAccId = ulong.Parse(args[0].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
var plr_client = PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == plu_accId).FirstOrDefault(); var plrClient = PlayerManager.OnlinePlayers.FirstOrDefault(c => c.Account.GameAccount.PersistentID == pluAccId);
if (plr_client != null && plr_client.Account.GameAccount. Clan != null) if (plrClient != null && plrClient.Account.GameAccount. Clan != null)
plr_client.Account.GameAccount.Clan.ParagonRatings[plr_client.Account.GameAccount] = plr_client.Account.GameAccount.DBGameAccount.ParagonLevel; plrClient.Account.GameAccount.Clan.ParagonRatings[plrClient.Account.GameAccount] = plrClient.Account.GameAccount.DBGameAccount.ParagonLevel;
}); });
break; break;
case "uii": //UniqueItemIdentified case "uii": //UniqueItemIdentified
ulong uii_accId = ulong.Parse(args[0].Trim()); ulong uiiAccId = ulong.Parse(args[0].Trim());
ulong uii_itemId = ulong.Parse(args[1].Trim()); ulong uiiItemId = ulong.Parse(args[1].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
var plr_client = PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == uii_accId).FirstOrDefault(); var plrClient = PlayerManager.OnlinePlayers.FirstOrDefault(c => c.Account.GameAccount.PersistentID == uiiAccId);
if (plr_client != null && plr_client.Account.GameAccount.Clan != null) if (plrClient != null && plrClient.Account.GameAccount.Clan != null)
{ {
var dbItem = DBSessions.SessionGet<DBInventory>(uii_itemId); var dbItem = DBSessions.SessionGet<DBInventory>(uiiItemId);
if (dbItem != null) if (dbItem != null)
{ {
var generator = D3.Items.Generator.CreateBuilder() var generator = D3.Items.Generator.CreateBuilder()
@ -219,92 +222,92 @@ namespace DiIiS_NA.LoginServer.Battle
generator.AddBaseAffixes(result); generator.AddBaseAffixes(result);
} }
plr_client.Account.GameAccount.Clan.AddNews(plr_client.Account.GameAccount, 0, generator.Build().ToByteArray()); plrClient.Account.GameAccount.Clan.AddNews(plrClient.Account.GameAccount, 0, generator.Build().ToByteArray());
} }
} }
}); });
break; break;
case "uc": //UpdateClient case "uc": //UpdateClient
ulong uc_accId = ulong.Parse(args[0].Trim()); ulong ucAccId = ulong.Parse(args[0].Trim());
int uc_level = int.Parse(args[1].Trim()); int ucLevel = int.Parse(args[1].Trim());
int uc_screen = int.Parse(args[2].Trim()); int ucScreen = int.Parse(args[2].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
try try
{ {
foreach (var uc_invokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == uc_accId)) foreach (var ucInvokerClient in PlayerManager.OnlinePlayers.Where(c => c.Account.GameAccount.PersistentID == ucAccId))
{ {
if (!uc_invokerClient.Account.IsOnline) continue; if (!ucInvokerClient.Account.IsOnline) continue;
uc_invokerClient.Account.GameAccount.ChangedFields.SetPresenceFieldValue(uc_invokerClient.Account.GameAccount.CurrentToon.HeroLevelField); ucInvokerClient.Account.GameAccount.ChangedFields.SetPresenceFieldValue(ucInvokerClient.Account.GameAccount.CurrentToon.HeroLevelField);
uc_invokerClient.Account.GameAccount.ChangedFields.SetPresenceFieldValue(uc_invokerClient.Account.GameAccount.CurrentToon.HeroParagonLevelField); ucInvokerClient.Account.GameAccount.ChangedFields.SetPresenceFieldValue(ucInvokerClient.Account.GameAccount.CurrentToon.HeroParagonLevelField);
if (uc_screen != -1) uc_invokerClient.Account.GameAccount.ScreenStatus = D3.PartyMessage.ScreenStatus.CreateBuilder().SetScreen(uc_screen).SetStatus(0).Build(); if (ucScreen != -1) ucInvokerClient.Account.GameAccount.ScreenStatus = D3.PartyMessage.ScreenStatus.CreateBuilder().SetScreen(ucScreen).SetStatus(0).Build();
uc_invokerClient.Account.GameAccount.NotifyUpdate(); ucInvokerClient.Account.GameAccount.NotifyUpdate();
} }
} }
catch { } catch { }
}); });
break; break;
case "gpj": //PlayerJoined case "gpj": //PlayerJoined
int gpj_gameId = int.Parse(args[0].Trim()); int gpjGameId = int.Parse(args[0].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
try try
{ {
GameFactoryManager.FindGameByDynamicId((ulong)gpj_gameId).PlayersCount++; GameFactoryManager.FindGameByDynamicId((ulong)gpjGameId).PlayersCount++;
} }
catch { } catch { }
}); });
break; break;
case "gpl": //PlayerLeft case "gpl": //PlayerLeft
int gpl_gameId = int.Parse(args[0].Trim()); int gplGameId = int.Parse(args[0].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
try try
{ {
if (GameFactoryManager.FindGameByDynamicId((ulong)gpl_gameId) != null) if (GameFactoryManager.FindGameByDynamicId((ulong)gplGameId) != null)
GameFactoryManager.FindGameByDynamicId((ulong)gpl_gameId).PlayersCount--; GameFactoryManager.FindGameByDynamicId((ulong)gplGameId).PlayersCount--;
} }
catch { } catch { }
}); });
break; break;
case "gsp": //SetGamePublic case "gsp": //SetGamePublic
int gsp_gameId = int.Parse(args[0].Trim()); int gspGameId = int.Parse(args[0].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
try try
{ {
GameFactoryManager.FindGameByDynamicId((ulong)gsp_gameId).Public = true; GameFactoryManager.FindGameByDynamicId((ulong)gspGameId).Public = true;
} }
catch { } catch { }
}); });
break; break;
case "tsc": //ToonStateChanged case "tsc": //ToonStateChanged
int tsc_toonId = int.Parse(args[0].Trim()); int tscToonId = int.Parse(args[0].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
try try
{ {
Toons.ToonManager.GetToonByLowID((ulong)tsc_toonId).StateChanged(); Toons.ToonManager.GetToonByLowID((ulong)tscToonId).StateChanged();
} }
catch { } catch { }
}); });
break; break;
case "pvpsp": //PvPSaveProgress case "pvpsp": //PvPSaveProgress
ulong pvpsp_gAccId = ulong.Parse(args[0].Trim()); ulong pvpspGAccId = ulong.Parse(args[0].Trim());
int pvpsp_kills = int.Parse(args[1].Trim()); int pvpspKills = int.Parse(args[1].Trim());
int pvpsp_wins = int.Parse(args[2].Trim()); int pvpspWins = int.Parse(args[2].Trim());
int pvpsp_gold = int.Parse(args[3].Trim()); int pvpspGold = int.Parse(args[3].Trim());
System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => { System.Threading.Tasks.Task.Delay(1).ContinueWith((a) => {
var gAcc = GameAccountManager.GetAccountByPersistentID(pvpsp_gAccId); var gAcc = GameAccountManager.GetAccountByPersistentID(pvpspGAccId);
lock (gAcc.DBGameAccount) lock (gAcc.DBGameAccount)
{ {
var dbGAcc = gAcc.DBGameAccount; var dbGAcc = gAcc.DBGameAccount;
dbGAcc.PvPTotalKilled += (ulong)pvpsp_kills; dbGAcc.PvPTotalKilled += (ulong)pvpspKills;
dbGAcc.PvPTotalWins += (ulong)pvpsp_wins; dbGAcc.PvPTotalWins += (ulong)pvpspWins;
dbGAcc.PvPTotalGold += (ulong)pvpsp_gold; dbGAcc.PvPTotalGold += (ulong)pvpspGold;
DBSessions.SessionUpdate(dbGAcc); DBSessions.SessionUpdate(dbGAcc);
} }
}); });
break; break;
default: default:
Logger.Warn("Unknown message type: {0}|{1}", message[0], message[1]); Logger.Warn("Unknown message type: $[white]${0}|{1}$[/]$", message[0], message[1]);
break; break;
} }
return true; return true;

View File

@ -30,33 +30,33 @@ namespace DiIiS_NA.LoginServer.Battle
public ISocketChannel SocketConnection { get; private set; } public ISocketChannel SocketConnection { get; private set; }
public IChannelHandlerContext Connect { get; private set; } public IChannelHandlerContext Connect { get; private set; }
public bool AuthenticationStatus = false; public bool AuthenticationStatus = false;
public ClientLocale ClientLanguage = ClientLocale.enUS; public ClientLocale ClientLanguage = ClientLocale.EN_US;
public IRpcController ListenerController; public IRpcController ListenerController;
private uint _tokenCounter = 0; private uint _tokenCounter = 0;
public static NO_RESPONSE NO_RESPONSE = NO_RESPONSE.CreateBuilder().Build(); public static NO_RESPONSE NoResponse = NO_RESPONSE.CreateBuilder().Build();
private readonly Dictionary<int, RPCCallBack> _pendingResponses = new(); // TODO: Check usage and remove if not needed private readonly Dictionary<int, RPCCallBack> _pendingResponses = new(); // TODO: Check usage and remove if not needed
public bgs.protocol.v2.Attribute AttributeOfServer { get; set; } public bgs.protocol.v2.Attribute AttributeOfServer { get; set; }
public Account Account { get; set; } public Account Account { get; set; }
public const byte ServiceReply = 0xFE; public const byte SERVICE_REPLY = 0xFE;
public SslStream Ssl = null; public SslStream Ssl = null;
private static int REQUEST_SERVICE_ID = 0; private static int _requestServiceId = 0;
private static int RESPONSE_SERVICE_ID = 254; private static int _responseServiceId = 254;
//public object clientLock = new object(); //public object clientLock = new object();
public readonly object _serviceLock = new(); public readonly object ServiceLock = new();
public object messageLock = new(); public object MessageLock = new();
private ulong _listenerId; // last targeted rpc object. private ulong _listenerId; // last targeted rpc object.
public bool MOTDSent { get; private set; } public bool MotdSent { get; private set; }
private ConcurrentDictionary<ulong, ulong> MappedObjects { get; set; } private ConcurrentDictionary<ulong, ulong> MappedObjects { get; set; }
public bool GuildChannelsRevealed = false; public bool GuildChannelsRevealed = false;
public string GameTeamTag = ""; public string GameTeamTag = "";
public ulong CID = 0; public readonly ulong Cid = 0;
#region current channel #region current channel
public Dictionary<ulong, Channel> Channels = new(); public readonly Dictionary<ulong, Channel> Channels = new();
public List<Channel> ChatChannels = new(); public readonly List<Channel> ChatChannels = new();
public Channel PartyChannel; //Used for all non game related messages public Channel PartyChannel; //Used for all non game related messages
public Channel GameChannel; //Used for all game related messages public Channel GameChannel; //Used for all game related messages
@ -103,7 +103,7 @@ namespace DiIiS_NA.LoginServer.Battle
.AddAttribute(bgs.protocol.Attribute.CreateBuilder().SetName("whisper") .AddAttribute(bgs.protocol.Attribute.CreateBuilder().SetName("whisper")
.SetValue(Variant.CreateBuilder().SetStringValue(text).Build()).Build()).Build(); .SetValue(Variant.CreateBuilder().SetStringValue(text).Build()).Build()).Build();
MakeRPC((lid) => bgs.protocol.notification.v1.NotificationListener.CreateStub(this). MakeRpc((lid) => bgs.protocol.notification.v1.NotificationListener.CreateStub(this).
OnNotificationReceived(new HandlerController() OnNotificationReceived(new HandlerController()
{ {
ListenerId = lid ListenerId = lid
@ -120,8 +120,8 @@ namespace DiIiS_NA.LoginServer.Battle
public void LeaveAllChannels() public void LeaveAllChannels()
{ {
List<Channel> _channels = Channels.Values.ToList(); List<Channel> channels = Channels.Values.ToList();
foreach (var channel in _channels) foreach (var channel in channels)
{ {
try try
{ {
@ -134,12 +134,12 @@ namespace DiIiS_NA.LoginServer.Battle
#endregion #endregion
public BattleClient(ISocketChannel socketChannel, DotNetty.Handlers.Tls.TlsHandler TLS) public BattleClient(ISocketChannel socketChannel, DotNetty.Handlers.Tls.TlsHandler tls)
{ {
SocketConnection = socketChannel; SocketConnection = socketChannel;
Services = new Dictionary<uint, uint>(); Services = new Dictionary<uint, uint>();
MappedObjects = new ConcurrentDictionary<ulong, ulong>(); MappedObjects = new ConcurrentDictionary<ulong, ulong>();
MOTDSent = false; MotdSent = false;
if (SocketConnection.Active) if (SocketConnection.Active)
Logger.Trace("Client - {0} - successfully encrypted the connection", socketChannel.RemoteAddress); Logger.Trace("Client - {0} - successfully encrypted the connection", socketChannel.RemoteAddress);
} }
@ -150,7 +150,7 @@ namespace DiIiS_NA.LoginServer.Battle
Header header = msg.GetHeader(); Header header = msg.GetHeader();
byte[] payload = (byte[])msg.GetPayload(); byte[] payload = (byte[])msg.GetPayload();
if (msg.GetHeader().ServiceId == RESPONSE_SERVICE_ID) if (msg.GetHeader().ServiceId == _responseServiceId)
{ {
if (_pendingResponses.Count == 0) return; if (_pendingResponses.Count == 0) return;
RPCCallBack done = _pendingResponses[(int)header.Token]; RPCCallBack done = _pendingResponses[(int)header.Token];
@ -276,7 +276,7 @@ namespace DiIiS_NA.LoginServer.Battle
#endif #endif
service.CallMethod(method, controller, message, service.CallMethod(method, controller, message,
(IMessage m) => { sendResponse(ctx, (int)header.Token, m, controller.Status); }); (IMessage m) => { SendResponse(ctx, (int)header.Token, m, controller.Status); });
} }
} }
catch (NotImplementedException) catch (NotImplementedException)
@ -319,69 +319,69 @@ namespace DiIiS_NA.LoginServer.Battle
/// <summary> /// <summary>
/// Deutsch. /// Deutsch.
/// </summary> /// </summary>
deDE, DE_DE,
/// <summary> /// <summary>
/// English (EU) /// English (EU)
/// </summary> /// </summary>
enGB, EN_GB,
/// <summary> /// <summary>
/// English (Singapore) /// English (Singapore)
/// </summary> /// </summary>
enSG, EN_SG,
/// <summary> /// <summary>
/// English (US) /// English (US)
/// </summary> /// </summary>
enUS, EN_US,
/// <summary> /// <summary>
/// Espanol /// Espanol
/// </summary> /// </summary>
esES, ES_ES,
/// <summary> /// <summary>
/// Espanol (Mexico) /// Espanol (Mexico)
/// </summary> /// </summary>
esMX, ES_MX,
/// <summary> /// <summary>
/// French /// French
/// </summary> /// </summary>
frFR, FR_FR,
/// <summary> /// <summary>
/// Italian /// Italian
/// </summary> /// </summary>
itIT, IT_IT,
/// <summary> /// <summary>
/// Korean /// Korean
/// </summary> /// </summary>
koKR, KO_KR,
/// <summary> /// <summary>
/// Polish /// Polish
/// </summary> /// </summary>
plPL, PL_PL,
/// <summary> /// <summary>
/// Portuguese /// Portuguese
/// </summary> /// </summary>
ptPT, PT_PT,
/// <summary> /// <summary>
/// Portuguese (Brazil) /// Portuguese (Brazil)
/// </summary> /// </summary>
ptBR, PT_BR,
/// <summary> /// <summary>
/// Russian /// Russian
/// </summary> /// </summary>
ruRU, RU_RU,
/// <summary> /// <summary>
/// Turkish /// Turkish
/// </summary> /// </summary>
trTR, TR_TR,
/// <summary> /// <summary>
/// Chinese /// Chinese
/// </summary> /// </summary>
zhCN, ZH_CN,
/// <summary> /// <summary>
/// Chinese (Taiwan) /// Chinese (Taiwan)
/// </summary> /// </summary>
zhTW ZH_TW
} }
public virtual void MakeTargetedRPC(RPCObject targetObject, Action<ulong> rpc) public virtual void MakeTargetedRpc(RPCObject targetObject, Action<ulong> rpc)
{ {
Task.Run(() => Task.Run(() =>
{ {
@ -400,7 +400,7 @@ namespace DiIiS_NA.LoginServer.Battle
//} //}
}); });
} }
public virtual void MakeRPC(Action<ulong> rpc) public virtual void MakeRpc(Action<ulong> rpc)
{ {
Task.Run(() => Task.Run(() =>
{ {
@ -444,12 +444,12 @@ namespace DiIiS_NA.LoginServer.Battle
var serviceId = Services[serviceHash]; var serviceId = Services[serviceHash];
var token = _tokenCounter++; var token = _tokenCounter++;
sendRequest(Connect, serviceHash, GetMethodId(method), token, request, (uint)_listenerId, status); SendRequest(Connect, serviceHash, GetMethodId(method), token, request, (uint)_listenerId, status);
} }
public static void sendRequest(IChannelHandlerContext ctx, uint serviceHash, uint methodId, uint token, IMessage request, uint listenerId, uint status) public static void SendRequest(IChannelHandlerContext ctx, uint serviceHash, uint methodId, uint token, IMessage request, uint listenerId, uint status)
{ {
Header.Builder builder = Header.CreateBuilder(); Header.Builder builder = Header.CreateBuilder();
builder.SetServiceId((uint)REQUEST_SERVICE_ID); builder.SetServiceId((uint)_requestServiceId);
builder.SetServiceHash(serviceHash); builder.SetServiceHash(serviceHash);
builder.SetMethodId(methodId); builder.SetMethodId(methodId);
if (listenerId != 0) if (listenerId != 0)
@ -462,7 +462,7 @@ namespace DiIiS_NA.LoginServer.Battle
} }
/// <param name="localObjectId">The local objectId.</param> /// <param name="localObjectId">The local objectId.</param>
/// <param name="remoteObjectId">The remote objectId over client.</param> /// <param name="remoteObjectId">The remote objectId over client.</param>
public void MapLocalObjectID(ulong localObjectId, ulong remoteObjectId) public void MapLocalObjectId(ulong localObjectId, ulong remoteObjectId)
{ {
try try
{ {
@ -501,10 +501,10 @@ namespace DiIiS_NA.LoginServer.Battle
return (uint)(method.Index) + 1; return (uint)(method.Index) + 1;
} }
} }
public static void sendResponse(IChannelHandlerContext ctx, int token, IMessage response, uint status) public static void SendResponse(IChannelHandlerContext ctx, int token, IMessage response, uint status)
{ {
Header.Builder builder = Header.CreateBuilder(); Header.Builder builder = Header.CreateBuilder();
builder.SetServiceId((uint)RESPONSE_SERVICE_ID); builder.SetServiceId((uint)_responseServiceId);
builder.SetToken((uint)token); builder.SetToken((uint)token);
builder.SetStatus(status); builder.SetStatus(status);
if (response != null) if (response != null)
@ -512,15 +512,15 @@ namespace DiIiS_NA.LoginServer.Battle
ctx.Channel.WriteAndFlushAsync(new BNetPacket(builder.Build(), response)); ctx.Channel.WriteAndFlushAsync(new BNetPacket(builder.Build(), response));
} }
public void SendMOTD() public void SendMotd()
{ {
if (MOTDSent) if (MotdSent)
return; return;
var motd = "Welcome to BlizzLess.Net Alpha-Build Server!"; var motd = "Welcome to BlizzLess.Net Alpha-Build Server!";
SendServerWhisper(motd); SendServerWhisper(motd);
MOTDSent = true; MotdSent = true;
} }
public override void ChannelInactive(IChannelHandlerContext context) public override void ChannelInactive(IChannelHandlerContext context)

View File

@ -26,9 +26,9 @@ namespace DiIiS_NA.LoginServer.Battle
public static BattleClient GetClientByEmail(string email) => OnlinePlayers.FirstOrDefault(cli => cli.Account.Email == email); public static BattleClient GetClientByEmail(string email) => OnlinePlayers.FirstOrDefault(cli => cli.Account.Email == email);
public static BattleClient GetClientByBattleTag(string battleTag) => OnlinePlayers.FirstOrDefault(cli => cli.Account.BattleTag == battleTag); public static BattleClient GetClientByBattleTag(string battleTag) => OnlinePlayers.FirstOrDefault(cli => cli.Account.BattleTag == battleTag);
public static BattleClient GetClientByCID(ulong cid) public static BattleClient GetClientByCid(ulong cid)
{ {
return OnlinePlayers.FirstOrDefault(bc => bc.CID == cid); return OnlinePlayers.FirstOrDefault(bc => bc.Cid == cid);
} }
public static void SendWhisper(string message) public static void SendWhisper(string message)

View File

@ -93,7 +93,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
this.IsGuildChatChannel = false; this.IsGuildChatChannel = false;
if ((client != null) && (remoteObjectId != 0)) if ((client != null) && (remoteObjectId != 0))
client.MapLocalObjectID(this.DynamicId, remoteObjectId); client.MapLocalObjectId(this.DynamicId, remoteObjectId);
if (this.IsChatChannel) if (this.IsChatChannel)
Program.Watchdog.AddTask(10, new Action(() => Program.Watchdog.AddTask(10, new Action(() =>
@ -175,7 +175,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
.AddStateChange(channelMember) .AddStateChange(channelMember)
.Build(); .Build();
client.MakeTargetedRPC(this, (lid) => client.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateMemberState(new HandlerController() { ListenerId = lid } , notification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateMemberState(new HandlerController() { ListenerId = lid } , notification, callback => { }));
} }
@ -201,7 +201,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
//Notify all Channel members //Notify all Channel members
foreach (var n_member in this.Members.Keys) foreach (var n_member in this.Members.Keys)
{ {
n_member.MakeTargetedRPC(this, (lid) => n_member.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(n_member).OnUpdateMemberState(new HandlerController() { ListenerId = lid }, notification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(n_member).OnUpdateMemberState(new HandlerController() { ListenerId = lid }, notification, callback => { }));
} }
} }
@ -213,7 +213,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
public void Join(BattleClient client, ulong remoteObjectId) public void Join(BattleClient client, ulong remoteObjectId)
{ {
client.MapLocalObjectID(this.DynamicId, remoteObjectId); client.MapLocalObjectId(this.DynamicId, remoteObjectId);
this.AddMember(client); this.AddMember(client);
} }
@ -249,7 +249,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
.AddRangeMember(members) .AddRangeMember(members)
.Build(); .Build();
client.MakeTargetedRPC(this, (lid) => client.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnJoin(new HandlerController() { ListenerId = lid }, joinNotification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnJoin(new HandlerController() { ListenerId = lid }, joinNotification, callback => { }));
@ -276,7 +276,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
foreach (var pair in this.Members.Where(pair => pair.Value != addedMember)) // only send this to previous members of the channel. foreach (var pair in this.Members.Where(pair => pair.Value != addedMember)) // only send this to previous members of the channel.
{ {
pair.Key.MakeTargetedRPC(this, (lid) => pair.Key.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(pair.Key).OnMemberAdded(new HandlerController() { ListenerId = lid }, addNotification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(pair.Key).OnMemberAdded(new HandlerController() { ListenerId = lid }, addNotification, callback => { }));
} }
@ -348,10 +348,10 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
foreach (var pair in this.Members) foreach (var pair in this.Members)
{ {
if (pair.Key != client) if (pair.Key != client)
pair.Key.MakeTargetedRPC(this, (lid) => pair.Key.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(pair.Key).OnMemberRemoved(new HandlerController() { ListenerId = lid }, removeMessage, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(pair.Key).OnMemberRemoved(new HandlerController() { ListenerId = lid }, removeMessage, callback => { }));
} }
client.MakeTargetedRPC(this, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnLeave(new HandlerController() { ListenerId = lid }, leaveMessage, callback => client.MakeTargetedRpc(this, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnLeave(new HandlerController() { ListenerId = lid }, leaveMessage, callback =>
{ {
client.UnmapLocalObjectId(this.DynamicId); })); client.UnmapLocalObjectId(this.DynamicId); }));
@ -431,7 +431,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
foreach (var pair in this.Members) // send to all members of channel even to the actual one that sent the message else he'll not see his own message. foreach (var pair in this.Members) // send to all members of channel even to the actual one that sent the message else he'll not see his own message.
{ {
if (pair.Key.Account.IgnoreIds.Contains(client.Account.PersistentID)) continue; if (pair.Key.Account.IgnoreIds.Contains(client.Account.PersistentID)) continue;
pair.Key.MakeTargetedRPC(this, (lid) => pair.Key.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(pair.Key).OnSendMessage(new HandlerController() { ListenerId = lid }, notification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(pair.Key).OnSendMessage(new HandlerController() { ListenerId = lid }, notification, callback => { }));
} }
} }

View File

@ -54,7 +54,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
var notification = bgs.protocol.channel.v1.InvitationAddedNotification.CreateBuilder().SetInvitation(invitation); var notification = bgs.protocol.channel.v1.InvitationAddedNotification.CreateBuilder().SetInvitation(invitation);
invitee.MakeTargetedRPC(this, (lid) => invitee.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(invitee).OnReceivedInvitationAdded(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(invitee).OnReceivedInvitationAdded(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
} }
@ -80,7 +80,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
_onGoingInvitations.Remove(invitation.Id); _onGoingInvitations.Remove(invitation.Id);
GoingInvitations.Remove(request.InvitationId); GoingInvitations.Remove(request.InvitationId);
client.MakeTargetedRPC(this, (lid) => client.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(client).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(client).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
channel.Join(client, request.ObjectId); channel.Join(client, request.ObjectId);
@ -92,7 +92,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
foreach (var member in channel.Members.Keys) foreach (var member in channel.Members.Keys)
{ {
member.MakeTargetedRPC(channel, (lid) => member.MakeTargetedRpc(channel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, stateNotification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, stateNotification, callback => { }));
} }
@ -157,7 +157,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
.SetStateChange(channelStatePermission) .SetStateChange(channelStatePermission)
.Build(); .Build();
JoinClient.MakeTargetedRPC(JoinClient.CurrentChannel, (lid) => JoinClient.MakeTargetedRpc(JoinClient.CurrentChannel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(JoinClient).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notificationPermission, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(JoinClient).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notificationPermission, callback => { }));
} }
gameFound.StartGame(clients, gameFound.DynamicId); gameFound.StartGame(clients, gameFound.DynamicId);
@ -171,7 +171,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
.SetValue(Variant.CreateBuilder().SetUintValue(gameFound.RequestId).Build()); .SetValue(Variant.CreateBuilder().SetUintValue(gameFound.RequestId).Build());
notificationFound.AddAttribute(attrF); notificationFound.AddAttribute(attrF);
JoinClient.MakeRPC((lid) => JoinClient.MakeRpc((lid) =>
bgs.protocol.notification.v1.NotificationListener.CreateStub(JoinClient).OnNotificationReceived(new HandlerController() { ListenerId = lid }, notificationFound.Build(), callback => { })); bgs.protocol.notification.v1.NotificationListener.CreateStub(JoinClient).OnNotificationReceived(new HandlerController() { ListenerId = lid }, notificationFound.Build(), callback => { }));
@ -186,7 +186,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
notification.SetGameHandle(gh); notification.SetGameHandle(gh);
System.Threading.Tasks.Task.Delay(2000).ContinueWith(delegate { System.Threading.Tasks.Task.Delay(2000).ContinueWith(delegate {
JoinClient.MakeRPC((lid) => bgs.protocol.matchmaking.v1.GameRequestListener.CreateStub(JoinClient).OnMatchmakingResult(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); JoinClient.MakeRpc((lid) => bgs.protocol.matchmaking.v1.GameRequestListener.CreateStub(JoinClient).OnMatchmakingResult(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
}); });
#endregion #endregion
@ -236,9 +236,9 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
foreach (var member in channel.Members.Keys) foreach (var member in channel.Members.Keys)
{ {
member.MakeTargetedRPC(channel, (lid) => member.MakeTargetedRpc(channel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, stateNotification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, stateNotification, callback => { }));
member.MakeTargetedRPC(channel, (lid) => member.MakeTargetedRpc(channel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnJoin(new HandlerController() { ListenerId = lid }, joinstateNotification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnJoin(new HandlerController() { ListenerId = lid }, joinstateNotification, callback => { }));
} }
@ -264,7 +264,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
client.MakeTargetedRPC(this, (lid) => bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(client).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); client.MakeTargetedRpc(this, (lid) => bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(client).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
channel.Join(mem, request.ObjectId); // add invitee to channel -- so inviter and other members will also be notified too. channel.Join(mem, request.ObjectId); // add invitee to channel -- so inviter and other members will also be notified too.
@ -281,7 +281,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
foreach (var member in channel.Members.Keys) foreach (var member in channel.Members.Keys)
{ {
member.MakeTargetedRPC(channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, stateNotification, callback => { })); member.MakeTargetedRpc(channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, stateNotification, callback => { }));
//member.MakeTargetedRPC(channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnJoin(new HandlerController() { ListenerId = lid }, build, callback => { })); //member.MakeTargetedRPC(channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnJoin(new HandlerController() { ListenerId = lid }, build, callback => { }));
} }
@ -305,7 +305,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
_onGoingInvitations.Remove(invitation.Id); _onGoingInvitations.Remove(invitation.Id);
GoingInvitations.Remove(request.InvitationId); GoingInvitations.Remove(request.InvitationId);
inviter.LoggedInClient.MakeTargetedRPC(inviter.LoggedInClient.CurrentChannel, (lid) => inviter.LoggedInClient.MakeTargetedRpc(inviter.LoggedInClient.CurrentChannel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(inviter.LoggedInClient).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(inviter.LoggedInClient).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
} }
@ -328,7 +328,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
_onGoingInvitations.Remove(request.InvitationId); _onGoingInvitations.Remove(request.InvitationId);
GoingInvitations.Remove(request.InvitationId); GoingInvitations.Remove(request.InvitationId);
inviter.LoggedInClient.MakeTargetedRPC(inviter.LoggedInClient.CurrentChannel, (lid) => inviter.LoggedInClient.MakeTargetedRpc(inviter.LoggedInClient.CurrentChannel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, updateChannelNotification.Build(), callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, updateChannelNotification.Build(), callback => { }));
//notify invitee about revoke //notify invitee about revoke
@ -339,7 +339,7 @@ namespace DiIiS_NA.LoginServer.ChannelSystem
if (Subscribers.All(subscriber => subscriber.Key.Account.GameAccount.BnetEntityId.Low != invitation.InviteeIdentity.AccountId.Low)) return; if (Subscribers.All(subscriber => subscriber.Key.Account.GameAccount.BnetEntityId.Low != invitation.InviteeIdentity.AccountId.Low)) return;
client.MakeTargetedRPC(this, (lid) => client.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(client).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, invitationRemoved.Build(), callback => { })); bgs.protocol.channel.v1.ChannelInvitationListener.CreateStub(client).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, invitationRemoved.Build(), callback => { }));
} }

View File

@ -67,7 +67,7 @@ namespace DiIiS_NA.LoginServer.FriendsSystem
.SetInvitation(invitation) .SetInvitation(invitation)
.SetAccountId(invitee.BnetEntityId); .SetAccountId(invitee.BnetEntityId);
invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => invitee.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationAdded(new HandlerController() { ListenerId = lid }, notification.Build(), callback => bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationAdded(new HandlerController() { ListenerId = lid }, notification.Build(), callback =>
{ {
})); }));
@ -89,13 +89,13 @@ namespace DiIiS_NA.LoginServer.FriendsSystem
if (inviter.GameAccount.IsOnline) if (inviter.GameAccount.IsOnline)
{ {
inviter.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => inviter.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { }));
} }
if (invitee.GameAccount.IsOnline) if (invitee.GameAccount.IsOnline)
{ {
invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => invitee.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { }));
} }
@ -144,19 +144,19 @@ namespace DiIiS_NA.LoginServer.FriendsSystem
if (inviter.GameAccount.IsOnline) if (inviter.GameAccount.IsOnline)
{ {
inviter.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => inviter.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notificationToInviter, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notificationToInviter, callback => { }));
inviter.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => inviter.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnFriendAdded(new HandlerController() { ListenerId = lid }, friendAddedNotificationToInviter, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnFriendAdded(new HandlerController() { ListenerId = lid }, friendAddedNotificationToInviter, callback => { }));
} }
if (invitee.GameAccount.IsOnline) if (invitee.GameAccount.IsOnline)
{ {
invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => invitee.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnFriendAdded(new HandlerController() { ListenerId = lid }, friendAddedNotificationToInvitee, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnFriendAdded(new HandlerController() { ListenerId = lid }, friendAddedNotificationToInvitee, callback => { }));
invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => invitee.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notificationToInvitee, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notificationToInvitee, callback => { }));
} }
@ -177,13 +177,13 @@ namespace DiIiS_NA.LoginServer.FriendsSystem
if (inviter.GameAccount.IsOnline) if (inviter.GameAccount.IsOnline)
{ {
inviter.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => inviter.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { }));
} }
if (invitee.GameAccount.IsOnline) if (invitee.GameAccount.IsOnline)
{ {
invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => invitee.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { }));
} }
@ -215,13 +215,13 @@ namespace DiIiS_NA.LoginServer.FriendsSystem
.SetAccountId(remover.BnetEntityId) .SetAccountId(remover.BnetEntityId)
.Build(); .Build();
client.MakeTargetedRPC(FriendManager.Instance, (lid) => client.MakeTargetedRpc(FriendManager.Instance, (lid) =>
bgs.protocol.friends.v1.FriendsListener.CreateStub(client).OnFriendRemoved(new HandlerController() { ListenerId = lid }, notifyRemover, callback => { })); bgs.protocol.friends.v1.FriendsListener.CreateStub(client).OnFriendRemoved(new HandlerController() { ListenerId = lid }, notifyRemover, callback => { }));
if (removee.GameAccount.IsOnline) if (removee.GameAccount.IsOnline)
{ {
var notifyRemovee = bgs.protocol.friends.v1.FriendNotification.CreateBuilder().SetTarget(removerAsFriend).SetAccountId(removee.BnetEntityId).Build(); var notifyRemovee = bgs.protocol.friends.v1.FriendNotification.CreateBuilder().SetTarget(removerAsFriend).SetAccountId(removee.BnetEntityId).Build();
removee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => bgs.protocol.friends.v1.FriendsListener.CreateStub(removee.GameAccount.LoggedInClient).OnFriendRemoved(new HandlerController() { ListenerId = lid }, notifyRemovee, callback => { })); removee.GameAccount.LoggedInClient.MakeTargetedRpc(FriendManager.Instance, (lid) => bgs.protocol.friends.v1.FriendsListener.CreateStub(removee.GameAccount.LoggedInClient).OnFriendRemoved(new HandlerController() { ListenerId = lid }, notifyRemovee, callback => { }));
} }
} }

View File

@ -39,7 +39,7 @@ namespace DiIiS_NA.LoginServer.FriendsSystem
notifyBlock.SetPlayer(blockedPlayer); notifyBlock.SetPlayer(blockedPlayer);
notifyBlock.SetGameAccountId(blocked.BnetEntityId); notifyBlock.SetGameAccountId(blocked.BnetEntityId);
client.MakeTargetedRPC(UserManager.Instance, (lid) => client.MakeTargetedRpc(UserManager.Instance, (lid) =>
bgs.protocol.user_manager.v1.UserManagerListener.CreateStub(client).OnBlockedPlayerAdded(new HandlerController() { ListenerId = lid }, notifyBlock.Build(), callback => { })); bgs.protocol.user_manager.v1.UserManagerListener.CreateStub(client).OnBlockedPlayerAdded(new HandlerController() { ListenerId = lid }, notifyBlock.Build(), callback => { }));
} }
@ -61,7 +61,7 @@ namespace DiIiS_NA.LoginServer.FriendsSystem
var notifyUnblock = bgs.protocol.user_manager.v1.BlockedPlayerRemovedNotification.CreateBuilder(); var notifyUnblock = bgs.protocol.user_manager.v1.BlockedPlayerRemovedNotification.CreateBuilder();
notifyUnblock.SetPlayer(blockedPlayer); notifyUnblock.SetPlayer(blockedPlayer);
client.MakeTargetedRPC(UserManager.Instance, (lid) => client.MakeTargetedRpc(UserManager.Instance, (lid) =>
bgs.protocol.user_manager.v1.UserManagerListener.CreateStub(client).OnBlockedPlayerRemoved(new HandlerController() { ListenerId = lid }, notifyUnblock.Build(), callback => { })); bgs.protocol.user_manager.v1.UserManagerListener.CreateStub(client).OnBlockedPlayerRemoved(new HandlerController() { ListenerId = lid }, notifyUnblock.Build(), callback => { }));
} }

View File

@ -95,7 +95,7 @@ namespace DiIiS_NA.LoginServer.GamesSystem
foreach (var client in clients) foreach (var client in clients)
{ {
client.MapLocalObjectID(this.DynamicId, objectId); client.MapLocalObjectId(this.DynamicId, objectId);
this.SendConnectionInfo(client); this.SendConnectionInfo(client);
client.Account.GameAccount.ScreenStatus = D3.PartyMessage.ScreenStatus.CreateBuilder().SetScreen(0).SetStatus(0).Build(); client.Account.GameAccount.ScreenStatus = D3.PartyMessage.ScreenStatus.CreateBuilder().SetScreen(0).SetStatus(0).Build();
client.Account.GameAccount.NotifyUpdate(); client.Account.GameAccount.NotifyUpdate();
@ -109,7 +109,7 @@ namespace DiIiS_NA.LoginServer.GamesSystem
{ {
foreach (var client in clients) foreach (var client in clients)
{ {
client.MapLocalObjectID(this.DynamicId, objectId); client.MapLocalObjectId(this.DynamicId, objectId);
this.SendConnectionInfo(client); this.SendConnectionInfo(client);
client.Account.GameAccount.ScreenStatus = D3.PartyMessage.ScreenStatus.CreateBuilder().SetScreen(1).SetStatus(1).Build(); client.Account.GameAccount.ScreenStatus = D3.PartyMessage.ScreenStatus.CreateBuilder().SetScreen(1).SetStatus(1).Build();
client.Account.GameAccount.NotifyUpdate(); client.Account.GameAccount.NotifyUpdate();
@ -119,7 +119,7 @@ namespace DiIiS_NA.LoginServer.GamesSystem
public bgs.protocol.games.v2.ConnectInfo GetConnectionInfoForClient(BattleClient client) public bgs.protocol.games.v2.ConnectInfo GetConnectionInfoForClient(BattleClient client)
{ {
return bgs.protocol.games.v2.ConnectInfo.CreateBuilder() return bgs.protocol.games.v2.ConnectInfo.CreateBuilder()
.SetAddress(bgs.protocol.Address.CreateBuilder().SetAddress_(this.GServer.Value.GameIP).SetPort((uint)this.GServer.Value.GamePort)) .SetAddress(bgs.protocol.Address.CreateBuilder().SetAddress_(this.GServer.Value.GameIp).SetPort((uint)this.GServer.Value.GamePort))
.SetToken(Google.ProtocolBuffers.ByteString.CopyFrom(new byte[] { 0x31, 0x33, 0x38, 0x38, 0x35, 0x34, 0x33, 0x33, 0x32, 0x30, 0x38, 0x34, 0x30, 0x30, 0x38, 0x38, 0x35, 0x37, 0x39, 0x36 })) .SetToken(Google.ProtocolBuffers.ByteString.CopyFrom(new byte[] { 0x31, 0x33, 0x38, 0x38, 0x35, 0x34, 0x33, 0x33, 0x32, 0x30, 0x38, 0x34, 0x30, 0x30, 0x38, 0x38, 0x35, 0x37, 0x39, 0x36 }))
.AddAttribute(bgs.protocol.Attribute.CreateBuilder().SetName("Token").SetValue(bgs.protocol.Variant.CreateBuilder().SetUintValue(0xee34d06ffe821c43L))) .AddAttribute(bgs.protocol.Attribute.CreateBuilder().SetName("Token").SetValue(bgs.protocol.Variant.CreateBuilder().SetUintValue(0xee34d06ffe821c43L)))
@ -146,7 +146,7 @@ namespace DiIiS_NA.LoginServer.GamesSystem
.SetChannelState(channelStatePrivacyLevel) .SetChannelState(channelStatePrivacyLevel)
.Build(); .Build();
client.MakeTargetedRPC(client.CurrentChannel, (lid) => client.MakeTargetedRpc(client.CurrentChannel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notificationPrivacyLevel, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notificationPrivacyLevel, callback => { }));
@ -166,7 +166,7 @@ namespace DiIiS_NA.LoginServer.GamesSystem
.SetChannelState(channelStatePartyLock) .SetChannelState(channelStatePartyLock)
.Build(); .Build();
client.MakeTargetedRPC(client.CurrentChannel, (lid) => client.MakeTargetedRpc(client.CurrentChannel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notificationPartyLock, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notificationPartyLock, callback => { }));
} }
} }

View File

@ -486,7 +486,7 @@ namespace DiIiS_NA.LoginServer.GuildSystem
.SetTargetAccountId(account.Owner.BnetEntityId) .SetTargetAccountId(account.Owner.BnetEntityId)
.Build(); .Build();
account.LoggedInClient.MakeRPC((lid) => account.LoggedInClient.MakeRpc((lid) =>
bgs.protocol.notification.v1.NotificationListener.CreateStub(account.LoggedInClient).OnNotificationReceived(new HandlerController() { ListenerId = lid bgs.protocol.notification.v1.NotificationListener.CreateStub(account.LoggedInClient).OnNotificationReceived(new HandlerController() { ListenerId = lid
}, notificationBuilder, callback => { })); }, notificationBuilder, callback => { }));
@ -507,7 +507,7 @@ namespace DiIiS_NA.LoginServer.GuildSystem
.SetTargetAccountId(account.Owner.BnetEntityId) .SetTargetAccountId(account.Owner.BnetEntityId)
.Build(); .Build();
account.LoggedInClient.MakeRPC((lid) => account.LoggedInClient.MakeRpc((lid) =>
bgs.protocol.notification.v1.NotificationListener.CreateStub(account.LoggedInClient).OnNotificationReceived(new HandlerController() { ListenerId = lid bgs.protocol.notification.v1.NotificationListener.CreateStub(account.LoggedInClient).OnNotificationReceived(new HandlerController() { ListenerId = lid
}, chatNotificationBuilder, callback => { })); }, chatNotificationBuilder, callback => { }));
} }
@ -540,7 +540,7 @@ namespace DiIiS_NA.LoginServer.GuildSystem
foreach (var member in this.Channel.Members) foreach (var member in this.Channel.Members)
//member.Key.MakeTargetedRPC(this.Channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member.Key).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification, callback => { })); //member.Key.MakeTargetedRPC(this.Channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member.Key).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification, callback => { }));
member.Key.MakeTargetedRPC(this.Channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member.Key).OnJoin(new HandlerController() { ListenerId = lid }, altnotification, callback => { })); member.Key.MakeTargetedRpc(this.Channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member.Key).OnJoin(new HandlerController() { ListenerId = lid }, altnotification, callback => { }));
} }
public void UpdateMemberAttributes(GameAccount member) public void UpdateMemberAttributes(GameAccount member)
@ -565,7 +565,7 @@ namespace DiIiS_NA.LoginServer.GuildSystem
.Build(); .Build();
foreach (var mbr in this.Channel.Members) foreach (var mbr in this.Channel.Members)
mbr.Key.MakeTargetedRPC(this.Channel, (lid) => mbr.Key.MakeTargetedRpc(this.Channel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(mbr.Key).OnUpdateMemberState(new HandlerController() { ListenerId = lid }, notification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(mbr.Key).OnUpdateMemberState(new HandlerController() { ListenerId = lid }, notification, callback => { }));
} }

View File

@ -9,7 +9,7 @@ namespace DiIiS_NA.LoginServer.Objects
{ {
public class EntityIdPresenceFieldList public class EntityIdPresenceFieldList
{ {
public List<bgs.protocol.EntityId> Value = new List<bgs.protocol.EntityId>(); public List<bgs.protocol.EntityId> Value = new();
protected FieldKeyHelper.Program _program; protected FieldKeyHelper.Program _program;
protected FieldKeyHelper.OriginatingClass _originatingClass; protected FieldKeyHelper.OriginatingClass _originatingClass;

View File

@ -33,7 +33,7 @@ namespace DiIiS_NA.LoginServer.Objects
if (this.Subscribers.ContainsKey(client)) return; if (this.Subscribers.ContainsKey(client)) return;
this.Subscribers.TryAdd(client, 0); this.Subscribers.TryAdd(client, 0);
client.MapLocalObjectID(this.DynamicId, remoteObjectId); client.MapLocalObjectId(this.DynamicId, remoteObjectId);
if (client.SocketConnection.Active) if (client.SocketConnection.Active)
{ {
@ -56,7 +56,7 @@ namespace DiIiS_NA.LoginServer.Objects
return new List<bgs.protocol.presence.v1.FieldOperation>(); return new List<bgs.protocol.presence.v1.FieldOperation>();
} }
public Helpers.FieldKeyHelper ChangedFields = new Helpers.FieldKeyHelper(); public readonly Helpers.FieldKeyHelper ChangedFields = new();
protected void NotifySubscriptionAdded(BattleClient client) protected void NotifySubscriptionAdded(BattleClient client)
{ {
@ -96,8 +96,8 @@ namespace DiIiS_NA.LoginServer.Objects
var altnotification = bgs.protocol.channel.v1.JoinNotification.CreateBuilder().SetChannelState(channelState); var altnotification = bgs.protocol.channel.v1.JoinNotification.CreateBuilder().SetChannelState(channelState);
if (gameAccount.LoggedInClient != null) if (gameAccount.LoggedInClient != null)
{ {
gameAccount.LoggedInClient.MakeTargetedRPC(this, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(gameAccount.LoggedInClient).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); gameAccount.LoggedInClient.MakeTargetedRpc(this, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(gameAccount.LoggedInClient).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
gameAccount.LoggedInClient.MakeTargetedRPC(this, (lid) => gameAccount.LoggedInClient.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(gameAccount.LoggedInClient).OnJoin(new HandlerController() { ListenerId = lid }, altnotification.Build(), callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(gameAccount.LoggedInClient).OnJoin(new HandlerController() { ListenerId = lid }, altnotification.Build(), callback => { }));
} }
} }
@ -110,10 +110,10 @@ namespace DiIiS_NA.LoginServer.Objects
var channelState = bgs.protocol.channel.v1.ChannelState.CreateBuilder().SetExtension(bgs.protocol.presence.v1.ChannelState.Presence, state); var channelState = bgs.protocol.channel.v1.ChannelState.CreateBuilder().SetExtension(bgs.protocol.presence.v1.ChannelState.Presence, state);
var builder = bgs.protocol.channel.v1.JoinNotification.CreateBuilder().SetChannelState(channelState); var builder = bgs.protocol.channel.v1.JoinNotification.CreateBuilder().SetChannelState(channelState);
var notification = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder().SetStateChange(channelState); var notification = bgs.protocol.channel.v1.UpdateChannelStateNotification.CreateBuilder().SetStateChange(channelState);
client.MakeTargetedRPC(this, (lid) => client.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnJoin(new HandlerController() { ListenerId = lid }, builder.Build(), callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnJoin(new HandlerController() { ListenerId = lid }, builder.Build(), callback => { }));
client.MakeTargetedRPC(this, (lid) => client.MakeTargetedRpc(this, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(client).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
} }

View File

@ -10,7 +10,7 @@ namespace DiIiS_NA.LoginServer.Objects
private static readonly Logger Logger = LogManager.CreateLogger(); private static readonly Logger Logger = LogManager.CreateLogger();
private static ulong _nextId = 10000; private static ulong _nextId = 10000;
public static readonly Dictionary<ulong, RPCObject> Objects = new Dictionary<ulong, RPCObject>(); public static readonly Dictionary<ulong, RPCObject> Objects = new();
static RPCObjectManager() static RPCObjectManager()
{ } { }

View File

@ -88,21 +88,21 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
} }
switch (request.Locale) switch (request.Locale)
{ {
case "deDE": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.deDE; break; case "deDE": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.DE_DE; break;
case "enGB": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.enGB; break; case "enGB": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.EN_GB; break;
case "enSG": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.enSG; break; case "enSG": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.EN_SG; break;
case "enUS": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.enUS; break; case "enUS": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.EN_US; break;
case "esES": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.esES; break; case "esES": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.ES_ES; break;
case "esMX": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.esMX; break; case "esMX": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.ES_MX; break;
case "frFR": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.frFR; break; case "frFR": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.FR_FR; break;
case "itIT": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.itIT; break; case "itIT": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.IT_IT; break;
case "koKR": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.koKR; break; case "koKR": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.KO_KR; break;
case "plPL": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.plPL; break; case "plPL": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.PL_PL; break;
case "ptBR": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.ptBR; break; case "ptBR": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.PT_BR; break;
case "ptPT": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.ptPT; break; case "ptPT": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.PT_PT; break;
case "ruRU": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.ruRU; break; case "ruRU": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.RU_RU; break;
case "trTR": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.trTR; break; case "trTR": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.TR_TR; break;
case "zhCN": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.zhCN; break; case "zhCN": ((HandlerController)controller).Client.ClientLanguage = BattleClient.ClientLocale.ZH_CN; break;
} }
done(NoData.CreateBuilder().Build()); done(NoData.CreateBuilder().Build());
var builder = ChallengeExternalRequest.CreateBuilder(); var builder = ChallengeExternalRequest.CreateBuilder();
@ -124,7 +124,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
builder.SetPayload(ByteString.CopyFromUtf8( builder.SetPayload(ByteString.CopyFromUtf8(
$"http://{Program.RESTSERVERIP}:{REST.Config.Instance.PORT}/battlenet/login")); $"http://{Program.RESTSERVERIP}:{REST.Config.Instance.PORT}/battlenet/login"));
((HandlerController)controller).Client.MakeRPC((lid) => ChallengeListener.CreateStub(((HandlerController)controller).Client).OnExternalChallenge(controller, builder.Build(), callback => { })); ((HandlerController)controller).Client.MakeRpc((lid) => ChallengeListener.CreateStub(((HandlerController)controller).Client).OnExternalChallenge(controller, builder.Build(), callback => { }));
#endregion #endregion
} }
break; break;
@ -191,7 +191,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
if (((HandlerController)controller).Client.Account == null) if (((HandlerController)controller).Client.Account == null)
{ {
var complete = LogonResult.CreateBuilder().SetErrorCode(2); var complete = LogonResult.CreateBuilder().SetErrorCode(2);
((HandlerController)controller).Client.MakeRPC((lid) => AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnLogonComplete(controller, complete.Build(), callback => { })); ((HandlerController)controller).Client.MakeRpc((lid) => AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnLogonComplete(controller, complete.Build(), callback => { }));
((HandlerController)controller).Client.SocketConnection.CloseAsync(); ((HandlerController)controller).Client.SocketConnection.CloseAsync();
((HandlerController)controller).Client.Connect.CloseAsync(); ((HandlerController)controller).Client.Connect.CloseAsync();
} }
@ -210,12 +210,12 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
.SetErrorCode(0) .SetErrorCode(0)
.AddGameAccountId(((HandlerController)controller).Client.Account.GameAccount.BnetEntityId); //D3 .AddGameAccountId(((HandlerController)controller).Client.Account.GameAccount.BnetEntityId); //D3
((HandlerController)controller).Client.Account.GameAccount.LoggedInClient = ((HandlerController)controller).Client; ((HandlerController)controller).Client.Account.GameAccount.LoggedInClient = ((HandlerController)controller).Client;
((HandlerController)controller).Client.MakeRPC((lid) => AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnLogonComplete(controller, complete.Build(), callback => { })); ((HandlerController)controller).Client.MakeRpc((lid) => AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnLogonComplete(controller, complete.Build(), callback => { }));
PlayerManager.PlayerConnected(((HandlerController)controller).Client); PlayerManager.PlayerConnected(((HandlerController)controller).Client);
var selectedGameAccount = GameAccountSelectedRequest.CreateBuilder().SetResult(0).SetGameAccountId(((HandlerController)controller).Client.Account.GameAccount.BnetEntityId); var selectedGameAccount = GameAccountSelectedRequest.CreateBuilder().SetResult(0).SetGameAccountId(((HandlerController)controller).Client.Account.GameAccount.BnetEntityId);
((HandlerController)controller).Client.MakeRPC((lid) => ((HandlerController)controller).Client.MakeRpc((lid) =>
AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnGameAccountSelected(new HandlerController() { ListenerId = lid }, selectedGameAccount.Build(), callback => { })); AuthenticationListener.CreateStub(((HandlerController)controller).Client).OnGameAccountSelected(new HandlerController() { ListenerId = lid }, selectedGameAccount.Build(), callback => { }));
} }
#endregion #endregion

View File

@ -101,9 +101,9 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
var builder = JoinNotification.CreateBuilder().SetChannelState(ChannelState.CreateBuilder().AddInvitation(invitation.Clone())); var builder = JoinNotification.CreateBuilder().SetChannelState(ChannelState.CreateBuilder().AddInvitation(invitation.Clone()));
((HandlerController) controller).Client.MakeTargetedRPC(channel, (lid) => ChannelListener.CreateStub(((HandlerController) controller).Client) ((HandlerController) controller).Client.MakeTargetedRpc(channel, (lid) => ChannelListener.CreateStub(((HandlerController) controller).Client)
.OnUpdateChannelState(controller, notification.Build(), callback => { })); .OnUpdateChannelState(controller, notification.Build(), callback => { }));
((HandlerController) controller).Client.MakeTargetedRPC(channel, (lid) => ((HandlerController) controller).Client.MakeTargetedRpc(channel, (lid) =>
ChannelListener.CreateStub(((HandlerController) controller).Client).OnJoin(new HandlerController() { ListenerId = lid }, builder.Build(), callback => { })); ChannelListener.CreateStub(((HandlerController) controller).Client).OnJoin(new HandlerController() { ListenerId = lid }, builder.Build(), callback => { }));
_invitationManager.HandleInvitation(((HandlerController) controller).Client, invitation.Build()); _invitationManager.HandleInvitation(((HandlerController) controller).Client, invitation.Build());
@ -137,7 +137,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
var notification = SuggestionAddedNotification.CreateBuilder().SetSuggestion(suggestion); var notification = SuggestionAddedNotification.CreateBuilder().SetSuggestion(suggestion);
suggestee.LoggedInClient.MakeTargetedRPC(_invitationManager, (lid) => suggestee.LoggedInClient.MakeTargetedRpc(_invitationManager, (lid) =>
ChannelInvitationListener.CreateStub(suggestee.LoggedInClient).OnReceivedSuggestionAdded(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); ChannelInvitationListener.CreateStub(suggestee.LoggedInClient).OnReceivedSuggestionAdded(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
} }

View File

@ -346,7 +346,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
//Notify all Channel members //Notify all Channel members
foreach (var member in channel.Members.Keys) foreach (var member in channel.Members.Keys)
{ {
member.MakeTargetedRPC(channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification, callback => { })); member.MakeTargetedRpc(channel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notification, callback => { }));
} }
} }
@ -401,7 +401,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
//Notify all Channel members //Notify all Channel members
foreach (var member in channel.Members.Keys) foreach (var member in channel.Members.Keys)
{ {
member.MakeTargetedRPC(channel, (lid) => member.MakeTargetedRpc(channel, (lid) =>
bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateMemberState(new HandlerController() { ListenerId = lid }, notification, callback => { })); bgs.protocol.channel.v1.ChannelListener.CreateStub(member).OnUpdateMemberState(new HandlerController() { ListenerId = lid }, notification, callback => { }));
} }
//*/ //*/

View File

@ -72,7 +72,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
QueueEntryNotification.Builder qen = QueueEntryNotification.CreateBuilder(); QueueEntryNotification.Builder qen = QueueEntryNotification.CreateBuilder();
qen.SetRequestId(id).SetWaitTimes(timers).AddMember(member).SetRequestInitiator(member); qen.SetRequestId(id).SetWaitTimes(timers).AddMember(member).SetRequestInitiator(member);
((HandlerController) controller).Client.MakeRPC((lid) => GameRequestListener.CreateStub(((HandlerController) controller).Client).OnQueueEntry(new HandlerController() { ListenerId = lid }, qen.Build(), callback => { })); ((HandlerController) controller).Client.MakeRpc((lid) => GameRequestListener.CreateStub(((HandlerController) controller).Client).OnQueueEntry(new HandlerController() { ListenerId = lid }, qen.Build(), callback => { }));
#endregion #endregion
#region Update Queue #region Update Queue
@ -80,7 +80,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
qun.SetRequestId(id) qun.SetRequestId(id)
.SetWaitTimes(timers) .SetWaitTimes(timers)
.SetIsMatchmaking(true); .SetIsMatchmaking(true);
((HandlerController) controller).Client.MakeRPC((lid) => GameRequestListener.CreateStub(((HandlerController) controller).Client).OnQueueUpdate(new HandlerController() { ListenerId = lid }, qun.Build(), callback => { })); ((HandlerController) controller).Client.MakeRpc((lid) => GameRequestListener.CreateStub(((HandlerController) controller).Client).OnQueueUpdate(new HandlerController() { ListenerId = lid }, qun.Build(), callback => { }));
#endregion #endregion
@ -124,7 +124,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
var joinNotification = bgs.protocol.channel.v1.JoinNotification.CreateBuilder().SetChannelState(channelStatePermission).Build(); var joinNotification = bgs.protocol.channel.v1.JoinNotification.CreateBuilder().SetChannelState(channelStatePermission).Build();
(((HandlerController) controller).Client).MakeTargetedRPC((((HandlerController) controller).Client).CurrentChannel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub((((HandlerController) controller).Client)).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notificationPermission, callback => { })); (((HandlerController) controller).Client).MakeTargetedRpc((((HandlerController) controller).Client).CurrentChannel, (lid) => bgs.protocol.channel.v1.ChannelListener.CreateStub((((HandlerController) controller).Client)).OnUpdateChannelState(new HandlerController() { ListenerId = lid }, notificationPermission, callback => { }));
} }
gameFound.StartGame(clients, gameFound.DynamicId); gameFound.StartGame(clients, gameFound.DynamicId);
@ -137,7 +137,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
.SetValue(Variant.CreateBuilder().SetUintValue(gameFound.RequestId).Build()); .SetValue(Variant.CreateBuilder().SetUintValue(gameFound.RequestId).Build());
notificationFound.AddAttribute(attrF); notificationFound.AddAttribute(attrF);
(((HandlerController) controller).Client).MakeRPC((lid) => (((HandlerController) controller).Client).MakeRpc((lid) =>
bgs.protocol.notification.v1.NotificationListener.CreateStub((((HandlerController) controller).Client)).OnNotificationReceived(new HandlerController() { ListenerId = lid }, notificationFound.Build(), callback => { })); bgs.protocol.notification.v1.NotificationListener.CreateStub((((HandlerController) controller).Client)).OnNotificationReceived(new HandlerController() { ListenerId = lid }, notificationFound.Build(), callback => { }));
@ -152,7 +152,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
notification.SetGameHandle(gh); notification.SetGameHandle(gh);
System.Threading.Tasks.Task.Delay(2000).ContinueWith(delegate { System.Threading.Tasks.Task.Delay(2000).ContinueWith(delegate {
((HandlerController) controller).Client.MakeRPC((lid) => GameRequestListener.CreateStub(((HandlerController) controller).Client).OnMatchmakingResult(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { })); ((HandlerController) controller).Client.MakeRpc((lid) => GameRequestListener.CreateStub(((HandlerController) controller).Client).OnMatchmakingResult(new HandlerController() { ListenerId = lid }, notification.Build(), callback => { }));
}); });
} }
} }

View File

@ -197,7 +197,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
builder.AddAttribute(messageId); builder.AddAttribute(messageId);
builder.AddAttribute(payload); builder.AddAttribute(payload);
Client.MakeRPC((lid) => Client.MakeRpc((lid) =>
NotificationListener.CreateStub(Client) NotificationListener.CreateStub(Client)
.OnNotificationReceived(new HandlerController() { ListenerId = lid }, builder.Build(), .OnNotificationReceived(new HandlerController() { ListenerId = lid }, builder.Build(),
callback => { })); callback => { }));

View File

@ -42,7 +42,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
.SetSenderAccountId(((HandlerController) controller).Client.Account.BnetEntityId) .SetSenderAccountId(((HandlerController) controller).Client.Account.BnetEntityId)
.Build(); .Build();
targetAccount.LoggedInClient.MakeRPC((lid) => targetAccount.LoggedInClient.MakeRpc((lid) =>
NotificationListener.CreateStub(targetAccount.LoggedInClient).OnNotificationReceived(controller, notification, callback => { })); NotificationListener.CreateStub(targetAccount.LoggedInClient).OnNotificationReceived(controller, notification, callback => { }));
} }
break; break;

View File

@ -28,7 +28,7 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services
n.SetIdentity(request.Identity) n.SetIdentity(request.Identity)
.SetReason(0) .SetReason(0)
.SetSessionId(session); .SetSessionId(session);
((HandlerController) controller).Client.MakeRPC((lid) => SessionListener.CreateStub(((HandlerController) controller).Client).OnSessionCreated(controller, n.Build(), callback => { })); ((HandlerController) controller).Client.MakeRpc((lid) => SessionListener.CreateStub(((HandlerController) controller).Client).OnSessionCreated(controller, n.Build(), callback => { }));
} }
private void DisconnectClient(HandlerController controller) private void DisconnectClient(HandlerController controller)

View File

@ -175,7 +175,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
{ {
Task.Run(() => Task.Run(() =>
{ {
lock (client._serviceLock) lock (client.ServiceLock)
{ {
Logger.MethodTrace(MethodBase.GetCurrentMethod(), "id {0}", achievementId); Logger.MethodTrace(MethodBase.GetCurrentMethod(), "id {0}", achievementId);
if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return; if (client.Account.GameAccount.Achievements.Where(a => a.AchievementId == achievementId && a.Completion != -1).Count() > 0) return;
@ -240,7 +240,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
{ {
Task.Run(() => Task.Run(() =>
{ {
lock (client._serviceLock) lock (client.ServiceLock)
{ {
Logger.MethodTrace(MethodBase.GetCurrentMethod(), "id {0}", criteriaId); Logger.MethodTrace(MethodBase.GetCurrentMethod(), "id {0}", criteriaId);
D3.AchievementsStaticData.StaticCriteriaDefinition definition = null; D3.AchievementsStaticData.StaticCriteriaDefinition definition = null;
@ -375,7 +375,7 @@ namespace DiIiS_NA.GameServer.AchievementSystem
{ {
Task.Run(() => Task.Run(() =>
{ {
lock (client._serviceLock) lock (client.ServiceLock)
{ {
if (additionalQuantity == 0) return; if (additionalQuantity == 0) return;
Logger.MethodTrace(MethodBase.GetCurrentMethod(), "id {0}", achievementId); Logger.MethodTrace(MethodBase.GetCurrentMethod(), "id {0}", achievementId);

View File

@ -26,18 +26,18 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
{ {
public class QuestManager public class QuestManager
{ {
private static readonly Logger Logger = new Logger("QuestManager"); private static readonly Logger Logger = new(nameof(QuestManager));
/// <summary> /// <summary>
/// Accessor for quests /// Accessor for quests
/// </summary> /// </summary>
/// <param name="snoQuest">snoId of the quest to retrieve</param> /// <param name="snoQuest">snoId of the quest to retrieve</param>
/// <returns></returns> /// <returns></returns>
public Dictionary<int, QuestRegistry.Quest> Quests = new Dictionary<int, QuestRegistry.Quest>(); public readonly Dictionary<int, QuestRegistry.Quest> Quests = new();
public Dictionary<int, QuestRegistry.Quest> SideQuests = new Dictionary<int, QuestRegistry.Quest>(); public readonly Dictionary<int, QuestRegistry.Quest> SideQuests = new();
public List<Bounty> Bounties = new List<Bounty>(); public readonly List<Bounty> Bounties = new();
public Game Game { get; set; } public Game Game { get; set; }
@ -191,7 +191,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
if (!Game.Empty) if (!Game.Empty)
{ {
SaveQuestProgress(true); SaveQuestProgress(true);
Logger.Trace(" (Advance) quest {0} completed: {1}", Game.CurrentQuest, Quests[Game.CurrentQuest].Completed); Logger.Trace($"$[white]$(Advance)$[/]$ Game {Game.GameId} Advanced to quest $[underline white]${Game.CurrentQuest}$[/], completed $[underline white]${Quests[Game.CurrentQuest].Completed}$[/]$");
foreach (var player in Game.Players.Values) foreach (var player in Game.Players.Values)
{ {
int xpReward = (int)(Quests[Game.CurrentQuest].RewardXp * Game.XPModifier); int xpReward = (int)(Quests[Game.CurrentQuest].RewardXp * Game.XPModifier);
@ -269,7 +269,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
} }
OnQuestProgress(); OnQuestProgress();
AutoSetQuestMarker(); AutoSetQuestMarker();
Logger.Trace(" (Advance) Advanced to quest {0}, step {1}", Game.CurrentQuest, Game.CurrentStep); Logger.Trace($"$[white]$(Advance)$[/]$ Game {Game.GameId} Advanced to quest $[underline white]${Game.CurrentQuest}$[/], step $[underline white]${Game.CurrentStep}$[/]$");
} }
public void SideAdvance() public void SideAdvance()
@ -295,7 +295,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
SideQuests[Game.CurrentSideQuest].Steps[Game.CurrentSideStep] == SideQuests[Game.CurrentSideQuest].Steps.Last().Value) SideQuests[Game.CurrentSideQuest].Steps[Game.CurrentSideStep] == SideQuests[Game.CurrentSideQuest].Steps.Last().Value)
{ {
SideQuests[Game.CurrentSideQuest].Completed = true; SideQuests[Game.CurrentSideQuest].Completed = true;
Logger.Trace(" (SideAdvance) quest {0} completed: {1}", Game.CurrentSideQuest, SideQuests[Game.CurrentSideQuest].Completed); Logger.Trace($"$[white]$(Side-Advance)$[/]$ Game {Game.GameId} Side-Advanced to quest {Game.CurrentSideQuest} completed: {SideQuests[Game.CurrentSideQuest].Completed}");
foreach (var player in Game.Players.Values) foreach (var player in Game.Players.Values)
{ {
@ -339,7 +339,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
} }
OnQuestProgress(); OnQuestProgress();
Logger.Trace(" (SideAdvance) Advanced to side quest {0}, step {1}", Game.CurrentSideQuest, Game.CurrentSideStep); Logger.Trace($"$[white]$(Side-Advance)$[/]$ Game {Game.GameId} Side-Advanced to side-quest {Game.CurrentSideQuest} completed: {Game.CurrentSideStep}");
} }
public void LaunchSideQuest(int questId, bool forceAbandon = false) public void LaunchSideQuest(int questId, bool forceAbandon = false)
@ -855,7 +855,7 @@ namespace DiIiS_NA.D3_GameServer.GSSystem.GameSystem
public List<int> LevelAreaChecks { get; set; } public List<int> LevelAreaChecks { get; set; }
public bool Finished = false; public bool Finished = false;
public static Dictionary<int, int> LevelAreaOverrides = new Dictionary<int, int>() //first is in-game, second is in-data public static Dictionary<int, int> LevelAreaOverrides = new() //first is in-game, second is in-data
{ {
{338602, 377700}, //battlefields of eterntity {338602, 377700}, //battlefields of eterntity
{271234, 370512}, //x1 fortress lv1 {271234, 370512}, //x1 fortress lv1