diff --git a/src/DiIiS-NA/BGS-Server/FriendsSystem/FriendManager.cs b/src/DiIiS-NA/BGS-Server/FriendsSystem/FriendManager.cs index 981b66b..75f6012 100644 --- a/src/DiIiS-NA/BGS-Server/FriendsSystem/FriendManager.cs +++ b/src/DiIiS-NA/BGS-Server/FriendsSystem/FriendManager.cs @@ -27,6 +27,7 @@ namespace DiIiS_NA.LoginServer.FriendsSystem private static readonly FriendManager _instance = new FriendManager(); public static FriendManager Instance { get { return _instance; } } + public static readonly Dictionary OnGoingInvitations = new Dictionary(); @@ -37,27 +38,247 @@ namespace DiIiS_NA.LoginServer.FriendsSystem _instance.BnetEntityId = bgs.protocol.EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.Unknown).SetLow(0x0000000110000000L + 1).Build(); } - - public static void HandleIgnore(BattleClient client, bgs.protocol.friends.v1.IgnoreInvitationRequest request) + + public static bool AreFriends(Account account1, Account account2) { - + + foreach (ulong friendId in account1.FriendsIds) + { + if (friendId == account2.PersistentID) return true; + } + return false; } + public static bool InvitationExists(Account inviter, Account invitee) + { + foreach (var invitation in OnGoingInvitations.Values) + { + if ((invitation.InviterIdentity.AccountId == inviter.BnetEntityId) && (invitation.InviteeIdentity.AccountId == invitee.BnetEntityId)) + return true; + } + return false; + } + //Done + public static void HandleInvitation(BattleClient client, bgs.protocol.friends.v1.ReceivedInvitation invitation) + { + var invitee = AccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.AccountId.Low); + if (invitee == null) return; + + if (OnGoingInvitations.Values.Any(oldInvite => (oldInvite.InviteeIdentity.AccountId == invitation.InviteeIdentity.AccountId) && (oldInvite.InviterIdentity.AccountId == invitation.InviterIdentity.AccountId))) + return; + + OnGoingInvitations.Add(invitation.Id, invitation); // track ongoing invitations so we can tranport it forth and back. + + if (invitee.IsOnline) + { + var inviter = AccountManager.GetAccountByPersistentID(invitation.InviterIdentity.AccountId.Low); + + var notification = bgs.protocol.friends.v1.InvitationNotification.CreateBuilder() + .SetInvitation(invitation) + .SetAccountId(invitee.BnetEntityId); + + invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationAdded(new HandlerController() { ListenerId = lid }, notification.Build(), callback => + { + })); + } + } + //Done + public static void HandleIgnore(BattleClient client, bgs.protocol.friends.v1.IgnoreInvitationRequest request) + { + var invitation = OnGoingInvitations[request.InvitationId]; + + var inviter = AccountManager.GetAccountByPersistentID(invitation.InviterIdentity.AccountId.Low); + var invitee = AccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.AccountId.Low); + + + var declinedNotification = bgs.protocol.friends.v1.InvitationNotification.CreateBuilder() + .SetInvitation(invitation) + .SetAccountId(invitee.BnetEntityId) + .SetReason((uint)InvitationRemoveReason.Ignored).Build(); + + if (inviter.GameAccount.IsOnline) + { + inviter.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { })); + } + + if (invitee.GameAccount.IsOnline) + { + invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { })); + } + + OnGoingInvitations.Remove(request.InvitationId); + } + //Done public static void HandleAccept(BattleClient client, bgs.protocol.friends.v1.AcceptInvitationRequest request) { - + if (!OnGoingInvitations.ContainsKey(request.InvitationId)) return; + var invitation = OnGoingInvitations[request.InvitationId]; + + var inviter = AccountManager.GetAccountByPersistentID(invitation.InviterIdentity.AccountId.Low); + var invitee = AccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.AccountId.Low); + var inviteeAsFriend = bgs.protocol.friends.v1.Friend.CreateBuilder() + .SetAccountId(invitation.InviteeIdentity.AccountId) + .AddRole(2) + .SetPrivileges(3) + .Build(); + var inviterAsFriend = bgs.protocol.friends.v1.Friend.CreateBuilder() + .SetAccountId(invitation.InviterIdentity.AccountId) + .AddRole(2) + .SetPrivileges(3) + .Build(); + + var notificationToInviter = bgs.protocol.friends.v1.InvitationNotification.CreateBuilder() + .SetAccountId(inviter.BnetEntityId) + .SetInvitation(invitation) + .SetReason((uint)InvitationRemoveReason.Accepted) + .Build(); + + var notificationToInvitee = bgs.protocol.friends.v1.InvitationNotification.CreateBuilder() + .SetAccountId(invitee.BnetEntityId) + .SetInvitation(invitation) + .SetReason((uint)InvitationRemoveReason.Accepted) + .Build(); + + if (!inviter.FriendsIds.Contains(invitee.PersistentID)) + inviter.FriendsIds.Add(invitee.PersistentID); + AddFriendshipToDB(inviter, invitee); + + // send friend added notifications + var friendAddedNotificationToInviter = bgs.protocol.friends.v1.FriendNotification.CreateBuilder() + .SetTarget(inviteeAsFriend).SetAccountId(inviter.BnetEntityId).Build(); + var friendAddedNotificationToInvitee = bgs.protocol.friends.v1.FriendNotification.CreateBuilder() + .SetTarget(inviterAsFriend).SetAccountId(invitee.BnetEntityId).Build(); + + if (inviter.GameAccount.IsOnline) + { + inviter.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notificationToInviter, callback => { })); + + inviter.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnFriendAdded(new HandlerController() { ListenerId = lid }, friendAddedNotificationToInviter, callback => { })); + } + + if (invitee.GameAccount.IsOnline) + { + invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnFriendAdded(new HandlerController() { ListenerId = lid }, friendAddedNotificationToInvitee, callback => { })); + + invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, notificationToInvitee, callback => { })); + } + + OnGoingInvitations.Remove(request.InvitationId); } public static void HandleDecline(BattleClient client, bgs.protocol.friends.v1.DeclineInvitationRequest request) { - + if (!OnGoingInvitations.ContainsKey(request.InvitationId)) return; + var invitation = OnGoingInvitations[request.InvitationId]; + + var inviter = AccountManager.GetAccountByPersistentID(invitation.InviterIdentity.AccountId.Low); + var invitee = AccountManager.GetAccountByPersistentID(invitation.InviteeIdentity.AccountId.Low); + + var declinedNotification = bgs.protocol.friends.v1.InvitationNotification.CreateBuilder() + .SetInvitation(invitation) + .SetReason((uint)InvitationRemoveReason.Declined).Build(); + + if (inviter.GameAccount.IsOnline) + { + inviter.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(inviter.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { })); + } + + if (invitee.GameAccount.IsOnline) + { + invitee.GameAccount.LoggedInClient.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(invitee.GameAccount.LoggedInClient).OnReceivedInvitationRemoved(new HandlerController() { ListenerId = lid }, declinedNotification, callback => { })); + } + + OnGoingInvitations.Remove(request.InvitationId); } public static void HandleRemove(BattleClient client, bgs.protocol.friends.v1.RemoveFriendRequest request) { - + var removee = AccountManager.GetAccountByPersistentID(request.TargetId.Low); + var remover = client.Account; + + var removeeAsFriend = bgs.protocol.friends.v1.Friend.CreateBuilder() + .SetAccountId(removee.BnetEntityId) + .SetPrivileges(1) + .AddRole(1) + .Build(); + var removerAsFriend = bgs.protocol.friends.v1.Friend.CreateBuilder() + .SetAccountId(remover.BnetEntityId) + .SetPrivileges(1) + .AddRole(1) + .Build(); + + if (remover.FriendsIds.Contains(removee.PersistentID)) + remover.FriendsIds.Remove(removee.PersistentID); + RemoveFriendshipFromDB(remover, removee); + + var notifyRemover = bgs.protocol.friends.v1.FriendNotification.CreateBuilder() + .SetTarget(removeeAsFriend) + .SetAccountId(remover.BnetEntityId) + .Build(); + + client.MakeTargetedRPC(FriendManager.Instance, (lid) => + bgs.protocol.friends.v1.FriendsListener.CreateStub(client).OnFriendRemoved(new HandlerController() { ListenerId = lid }, notifyRemover, callback => { })); + + if (removee.GameAccount.IsOnline) + { + 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 => { })); + } } + private static void AddFriendshipToDB(Account inviter, Account invitee) + { + try + { + var inviterRecord = new DBAccountLists + { + ListOwner = inviter.DBAccount, + ListTarget = invitee.DBAccount, + Type = "FRIEND" + }; + DBSessions.SessionSave(inviterRecord); + + var inviteeRecord = new DBAccountLists + { + ListOwner = invitee.DBAccount, + ListTarget = inviter.DBAccount, + Type = "FRIEND" + }; + DBSessions.SessionSave(inviteeRecord); + + } + catch (Exception e) + { + Logger.ErrorException(e, "FriendManager.AddFriendshipToDB()"); + } + } + + private static void RemoveFriendshipFromDB(Account remover, Account removee) + { + try + { + var removerRecords = DBSessions.SessionQueryWhere(dbl => dbl.ListOwner.Id == remover.PersistentID && dbl.ListTarget.Id == removee.PersistentID && dbl.Type == "FRIEND"); + foreach (var rec in removerRecords) + DBSessions.SessionDelete(rec); + + var removeeRecords = DBSessions.SessionQueryWhere(dbl => dbl.ListOwner.Id == removee.PersistentID && dbl.ListTarget.Id == remover.PersistentID && dbl.Type == "FRIEND"); + foreach (var rec in removeeRecords) + DBSessions.SessionDelete(rec); + } + catch (Exception e) + { + Logger.ErrorException(e, "FriendManager.RemoveFriendshipFromDB()"); + } + } } diff --git a/src/DiIiS-NA/BGS-Server/GamesSystem/GameDescriptor.cs b/src/DiIiS-NA/BGS-Server/GamesSystem/GameDescriptor.cs index 4da18cb..1bf3477 100644 --- a/src/DiIiS-NA/BGS-Server/GamesSystem/GameDescriptor.cs +++ b/src/DiIiS-NA/BGS-Server/GamesSystem/GameDescriptor.cs @@ -73,9 +73,7 @@ namespace DiIiS_NA.LoginServer.GamesSystem foreach (bgs.protocol.v2.Attribute attribute in request.MatchmakerFilter.AttributeList) { - if (attribute.Name != "version") - ; - else + if (attribute.Name == "version") this.Version = attribute.Value.StringValue; } } diff --git a/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/FriendService.cs b/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/FriendService.cs index 5b6b122..31a494e 100644 --- a/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/FriendService.cs +++ b/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/FriendService.cs @@ -1,45 +1,230 @@ -//Blizzless Project 2022 -//Blizzless Project 2022 +//Blizzless Project 2022 using bgs.protocol; //Blizzless Project 2022 using bgs.protocol.friends.v1; //Blizzless Project 2022 +using DiIiS_NA.Core.Extensions; +//Blizzless Project 2022 using DiIiS_NA.Core.Logging; //Blizzless Project 2022 +using DiIiS_NA.LoginServer.AccountsSystem; +//Blizzless Project 2022 +using DiIiS_NA.LoginServer.Base; +//Blizzless Project 2022 +using DiIiS_NA.LoginServer.FriendsSystem; +//Blizzless Project 2022 +using DiIiS_NA.LoginServer.Helpers; +//Blizzless Project 2022 using Google.ProtocolBuffers; //Blizzless Project 2022 using System; +//Blizzless Project 2022 +using System.Collections.Generic; namespace DiIiS_NA.LoginServer.ServicesSystem.Services { [Service(serviceID: 0x36, serviceName: "bnet.protocol.friends.FriendsService")] - public class FriendService : bgs.protocol.friends.v1.FriendsService, IServerService + public class FriendService : FriendsService, IServerService { private static readonly Logger Logger = LogManager.CreateLogger(); + public override void Subscribe(IRpcController controller, SubscribeRequest request, Action done) + { + Logger.Trace("Subscribe() {0}", ((controller as HandlerController).Client)); - public override void AcceptInvitation(IRpcController controller, AcceptInvitationRequest request, Action done) + FriendManager.Instance.AddSubscriber(((controller as HandlerController).Client), request.ObjectId); + + var builder = SubscribeResponse.CreateBuilder() + .SetMaxFriends(127) + .SetMaxReceivedInvitations(127) + .SetMaxSentInvitations(127) + .AddRole(Role.CreateBuilder().SetId(1).SetName("battle_tag_friend").Build()) + .AddRole(Role.CreateBuilder().SetId(2).SetName("real_id_friend").Build()); + + var friendsIDs = ((controller as HandlerController).Client).Account.FriendsIds; + foreach (var dbidFriend in friendsIDs) // send friends list. + { + var resp = Friend.CreateBuilder() + .SetAccountId(EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.AccountId).SetLow(dbidFriend)) + .SetPrivileges(384) + + .AddRole(1); + builder.AddFriends(resp.Build()); + } + + var invitations = new List(); + + foreach (var invitation in FriendManager.OnGoingInvitations.Values) + { + if (invitation.InviteeIdentity.AccountId == ((controller as HandlerController).Client).Account.BnetEntityId && !friendsIDs.Contains(invitation.InviterIdentity.AccountId.Low)) + { + invitations.Add(invitation); + } + } + + if (invitations.Count > 0) + builder.AddRangeReceivedInvitations(invitations); + + done(builder.Build()); + } + public override void SendInvitation(IRpcController controller, SendInvitationRequest request, Action done) + { + var extensionBytes = request.Params.UnknownFields.FieldDictionary[103].LengthDelimitedList[0].ToByteArray(); + var friendRequest = FriendInvitationParams.ParseFrom(extensionBytes); + + var response = NoData.CreateBuilder(); + + if (friendRequest.TargetEmail.ToLower() == ((controller as HandlerController).Client).Account.Email.ToLower()) + { + ((controller as HandlerController).Status) = 317202; + done(response.Build()); + return; + } + + if (friendRequest.TargetBattleTag == ((controller as HandlerController).Client).Account.BattleTag) + { + ((controller as HandlerController).Status) = 317202; + done(response.Build()); + return; + } + + Account invitee; + + Logger.Trace("Friend request body: {0}", friendRequest.ToString()); + + if (friendRequest.HasTargetEmail) + invitee = AccountManager.GetAccountByEmail(friendRequest.TargetEmail); + else + invitee = AccountManager.GetAccountByBattletag(friendRequest.TargetBattleTag); + + if (invitee == null) + { + if (friendRequest.HasTargetEmail) + ((controller as HandlerController).Status) = 4; + else + ((controller as HandlerController).Status) = 317203; + done(response.Build()); + return; + } + else if (FriendManager.AreFriends(((controller as HandlerController).Client).Account, invitee)) + { + if (friendRequest.HasTargetEmail) + ((controller as HandlerController).Status) = 317201; + else + ((controller as HandlerController).Status) = 5003; + done(response.Build()); + return; + } + else if (FriendManager.InvitationExists(((controller as HandlerController).Client).Account, invitee)) + { + if (friendRequest.HasTargetEmail) + ((controller as HandlerController).Status) = 317200; + else + ((controller as HandlerController).Status) = 5005; + done(response.Build()); + return; + } + else if (invitee.IgnoreIds.Contains((controller as HandlerController).Client.Account.PersistentID)) + { + ((controller as HandlerController).Status) = 5006; + done(response.Build()); + return; + } + + Logger.Trace("{0} sent {1} friend invitation.", ((controller as HandlerController).Client).Account, invitee); + + var invitation = ReceivedInvitation.CreateBuilder() + .SetId(FriendManager.InvitationIdCounter++) // we may actually need to store invitation ids in database with the actual invitation there. /raist. + .SetInviterIdentity(Identity.CreateBuilder().SetAccountId(((controller as HandlerController).Client).Account.BnetEntityId)) + .SetInviteeIdentity(Identity.CreateBuilder().SetAccountId(invitee.BnetEntityId)) + .SetInviterName(((controller as HandlerController).Client).Account.BattleTagName) + .SetInviteeName(invitee.BattleTagName) + .SetCreationTime(DateTime.Now.ToUnixTime()) + .SetUnknownFields(UnknownFieldSet.CreateBuilder() + .AddField(9, UnknownField.CreateBuilder().AddFixed32(17459).Build()) + .AddField(103, UnknownField.CreateBuilder().AddLengthDelimited(request.Params.UnknownFields.FieldDictionary[103].LengthDelimitedList[0]).Build()) + .Build()); + + done(response.Build()); + + // notify the invitee on invitation. + FriendManager.HandleInvitation(((controller as HandlerController).Client), invitation.Build()); + FriendManager.Instance.NotifyUpdate(); + (controller as HandlerController).Client.Account.NotifyUpdate(); + (controller as HandlerController).Client.Account.GameAccount.NotifyUpdate(); + } + public override void AcceptInvitation(IRpcController controller, AcceptInvitationRequest request, Action done) + { + Logger.Trace("{0} accepted friend invitation.", ((controller as HandlerController).Client).Account); + + var response = bgs.protocol.NoData.CreateBuilder(); + done(response.Build()); + + FriendManager.HandleAccept(((controller as HandlerController).Client), request); + } + public override void RevokeInvitation(IRpcController controller, RevokeInvitationRequest request, Action done) { throw new NotImplementedException(); } - public override void CreateFriendship(IRpcController controller, CreateFriendshipRequest request, Action done) + public override void DeclineInvitation(IRpcController controller, DeclineInvitationRequest request, Action done) { - throw new NotImplementedException(); + Logger.Trace("{0} declined friend invitation.", ((controller as HandlerController).Client).Account); + + var response = bgs.protocol.NoData.CreateBuilder(); + done(response.Build()); + + FriendManager.HandleDecline(((controller as HandlerController).Client), request); } - public override void DeclineInvitation(IRpcController controller, DeclineInvitationRequest request, Action done) + public override void IgnoreInvitation(IRpcController controller, IgnoreInvitationRequest request, Action done) { - throw new NotImplementedException(); - } - public override void GetFriendList(IRpcController controller, GetFriendListRequest request, Action done) - { - throw new NotImplementedException(); - } - public override void IgnoreInvitation(IRpcController controller, IgnoreInvitationRequest request, Action done) - { - throw new NotImplementedException(); + + //throw new NotImplementedException(); + var response = bgs.protocol.NoData.CreateBuilder(); + done(response.Build()); + + FriendManager.HandleIgnore(((controller as HandlerController).Client), request); + } public override void RemoveFriend(IRpcController controller, RemoveFriendRequest request, Action done) + { + Logger.Trace("{0} removed friend with id {1}.", ((controller as HandlerController).Client).Account, request.TargetId); + + + done(NoData.DefaultInstance); + + FriendManager.HandleRemove(((controller as HandlerController).Client), request); + FriendManager.Instance.NotifyUpdate(); + (controller as HandlerController).Client.Account.NotifyUpdate(); + (controller as HandlerController).Client.Account.GameAccount.NotifyUpdate(); + + } + public override void ViewFriends(IRpcController controller, ViewFriendsRequest request, Action done) + { + Logger.Trace("ViewFriends(): {0}.", request.ToString()); + + var builder = ViewFriendsResponse.CreateBuilder(); + var friendsIDs = AccountManager.GetAccountByPersistentID(request.TargetId.Low).FriendsIds; + foreach (var dbidFriend in friendsIDs) // send friends list. + { + var friend = AccountManager.GetAccountByPersistentID(dbidFriend); + var resp = FriendOfFriend.CreateBuilder() + .SetAccountId(EntityId.CreateBuilder().SetHigh((ulong)EntityIdHelper.HighIdType.AccountId).SetLow(dbidFriend)) + .SetBattleTag(friend.BattleTag) + .SetFullName(friend.BattleTagName) + .SetPrivileges(384) + .AddRole(1); + builder.AddFriends(resp.Build()); + } + done(builder.Build()); + } + public override void UpdateFriendState(IRpcController controller, UpdateFriendStateRequest request, Action done) + { + Logger.Trace("UpdateFriendState(): {0}.", request.ToString()); + + done(NoData.CreateBuilder().Build()); + } + public override void Unsubscribe(IRpcController controller, UnsubscribeRequest request, Action done) { throw new NotImplementedException(); } @@ -47,11 +232,11 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services { throw new NotImplementedException(); } - public override void RevokeInvitation(IRpcController controller, RevokeInvitationRequest request, Action done) + public override void GetFriendList(IRpcController controller, GetFriendListRequest request, Action done) { throw new NotImplementedException(); } - public override void SendInvitation(IRpcController controller, SendInvitationRequest request, Action done) + public override void CreateFriendship(IRpcController controller, CreateFriendshipRequest request, Action done) { throw new NotImplementedException(); } @@ -59,22 +244,6 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services { throw new NotImplementedException(); } - public override void Subscribe(IRpcController controller, SubscribeRequest request, Action done) - { - throw new NotImplementedException(); - } - public override void Unsubscribe(IRpcController controller, UnsubscribeRequest request, Action done) - { - throw new NotImplementedException(); - } - public override void UpdateFriendState(IRpcController controller, UpdateFriendStateRequest request, Action done) - { - throw new NotImplementedException(); - } - public override void ViewFriends(IRpcController controller, ViewFriendsRequest request, Action done) - { - throw new NotImplementedException(); - } } diff --git a/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/GameRequestService.cs b/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/GameRequestService.cs index 39a7097..a48958b 100644 --- a/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/GameRequestService.cs +++ b/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/GameRequestService.cs @@ -51,7 +51,6 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services int CurrentAct = 0; int CurrentQuest = 0; int CurrentStep = 0; - string GameTag = ""; foreach (var attr in request.Options.CreationProperties.AttributeList) { switch (attr.Name) diff --git a/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/GameUtilitiesService.cs b/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/GameUtilitiesService.cs index 270c8c8..86dc78b 100644 --- a/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/GameUtilitiesService.cs +++ b/src/DiIiS-NA/BGS-Server/ServicesSystem/Services/GameUtilitiesService.cs @@ -585,7 +585,6 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services foreach (var item in Hero.Profile.Equipment.ItemsList) { int pos = 0; - int a = 8; switch ((item.ItemSlot - 272) / 16) { case 1: pos = 0; break; //0 - Шлем @@ -1354,188 +1353,9 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services uint countofTravels = 0; if (criteria.CriteriaId32AndFlags8 == 3367569) countofTravels++; - //else - snapshot.AddCriteriaSnapshot(criteria); } - - - foreach (var Achievement in AchievementManager.GetAllAchievements) - { - //ToonClass.Wizard: GrantAchievement(client, 74987243307581); - //Четвертая глава - if (Achievement.Id == 74987248297399) - { - var criterias = AchievementManager.GetCriterias(Achievement.Id); - //snapshot.AddCriteriaSnapshot(D3.Achievements.CriteriaUpdateRecord.CreateBuilder().SetCriteriaId32AndFlags8(unchecked((uint)74987244572493)).SetQuantity32(1)); - // - //{criteria_id: 74987244038688 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987250791778 } necessary_quantity: 1 order_hint: 12 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:Learn_5_Jewelcrafting_Recipies_Title_Tag" } } - // - //{criteria_id: 74987244572493 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987244692586 } necessary_quantity: 1 order_hint: 5 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourney_XahRithKeywardenT1_Title_Tag_4" } } - // - //{criteria_id: 74987245130342 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987247265988 } necessary_quantity: 1 evalutation_class: 1144211309 flags: 1536 attributes { key: ":title:" value: "Achievements:SeasonJourneyMainPartII_Title_Tag_28" } } - // - //{criteria_id: 74987245723942 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987243712360 } necessary_quantity: 1 order_hint: 1 evalutation_class: 1144211309 flags: 1024 attributes {key: ":title:" value: "Achievements:MaxLevelNephalemRift_T12Minutes_Title_Tag"} } - // - //{criteria_id: 74987245863958 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987246565133 } necessary_quantity: 1 order_hint: 10 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement274_Title_Tag" }} - // - //{criteria_id: 74987247667055 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987258323927 } necessary_quantity: 1 order_hint: 11 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:Learn_5_Blacksmith_Recipies_Title_Tag" }} - // - //{criteria_id: 74987247674914 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987243333398 } necessary_quantity: 1 order_hint: 4 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourney_SokahrKeywardenT1_Title_Tag_4" }} - // - //{criteria_id: 74987250762680 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987247015305 } necessary_quantity: 1 order_hint: 6 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourney_NekaratKeywardenT1_Title_Tag_4" }} - // - //{criteria_id: 74987252164114 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987254930175 } necessary_quantity: 1 order_hint: 7 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKillBelialT2_Title_Tag" }} - // - //{criteria_id: 74987253329205 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987256362609 } necessary_quantity: 1 order_hint: 3 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourney_OdegKeywardenT1omplete4Bounties_Title_Tag_4" }} - // - //{criteria_id: 74987255999493 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987252937364 } necessary_quantity: 1 order_hint: 8 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKillGhomT4_Title_Tag" }} - // - //{criteria_id: 74987256952350 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987258699516 } necessary_quantity: 1 order_hint: 2 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement273_Title_Tag" }} - // - //{criteria_id: 74987257331078 parent_achievement_id: 74987248297399 advance_event { id: 200 comparand: 74987245627492 } necessary_quantity: 1 order_hint: 9 evalutation_class: 1144211309 flags: 1024 attributes {key: ":title:" value: "Achievements:SeasonGreaterRifts10Solo_Title_Tag" }} - } - if (Achievement.Id == 74987247265988) - { - var criterias = AchievementManager.GetCriterias(Achievement.Id); - //snapshot.AddCriteriaSnapshot(D3.Achievements.CriteriaUpdateRecord.CreateBuilder().SetCriteriaId32AndFlags8(unchecked((uint)74987258962046)).SetQuantity32(1)); - //Мастер - //{criteria_id: 74987248395427 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987255801934 } necessary_quantity: 1 order_hint: 1 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:MASTER_Title_Tag" }} - //Камень - //{criteria_id: 74987245885431 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987243963733 } necessary_quantity: 1 order_hint: 2 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourney_ImperialGem_Title_Tag" }} - //Привет Кадала - //{criteria_id: 74987248526596 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987254870297 } necessary_quantity: 1 order_hint: 3 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKadala_Title_Tag" }} - //Я становлюсь Звездой - //{criteria_id: 74987252384014 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987249059532 } necessary_quantity: 1 order_hint: 4 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKillAdriaMaster_Title_Tag" }} - //Сделай свой выбор - //{criteria_id: 74987246511881 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987251648219 } necessary_quantity: 1 order_hint: 5 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKillSiegebreakerMaster_Title_Tag" }} - //Разыскивается в Тристраме - //{criteria_id: 74987258781748 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987255156784 } necessary_quantity: 1 order_hint: 6 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement280_Title_Tag" }} - //Разыскивается в Калдее - //{criteria_id: 74987247833299 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987259347561 } necessary_quantity: 1 order_hint: 7 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement280_Title_Tag_1" }} - //Разыскивается на Арреате - //{criteria_id: 74987248811185 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987255614468 } necessary_quantity: 1 order_hint: 8 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement280_Title_Tag_2" }} - //Разыскивается на Небесах - //{criteria_id: 74987256262166 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987254301166 } necessary_quantity: 1 order_hint: 9 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement280_Title_Tag_3" }} - //Разыскивается в Вестмарше - //{criteria_id: 74987249495955 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987248936002 } necessary_quantity: 1 order_hint: 10 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement280_Title_Tag_4" }} - //Сезонный кубист - //{criteria_id: 74987245494264 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987254169957 } necessary_quantity: 1 order_hint: 11 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:CraftingKanaisCubeExtractPower1_Title_Tag_2" }} - - - // - //{criteria_id: 74987258962046 parent_achievement_id: 74987247265988 advance_event { id: 200 comparand: 74987254626662 } necessary_quantity: 1 evalutation_class: 1144211309 flags: 1536 attributes { key: ":title:" value: "Achievements:SeasonJourneyMainPartII_Title_Tag_27" }} - } - //Вторая глава - if (Achievement.Id == 74987254626662) - { - var criterias = AchievementManager.GetCriterias(Achievement.Id); - - //Эксперт - //{ criteria_id: 74987250579270 advance_event { id: 200 comparand: 74987259480511 } necessary_quantity: 1 order_hint: 1 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement267_Title_Tag" } } - //Как закалять сталь - //{ criteria_id: 74987254004798 advance_event { id: 200 comparand: 74987256755434 } necessary_quantity: 1 order_hint: 2 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement264_Title_Tag" } } - //Лучшие друзья - //{ criteria_id: 74987246031286 advance_event { id: 200 comparand: 74987252641760 } necessary_quantity: 1 order_hint: 3 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourney_EquipFollower_Title_Tag" } - //Максимальная эффективность - //{ criteria_id: 74987249993545 advance_event { id: 200 comparand: 74987244456174 } necessary_quantity: 1 order_hint: 4 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement263_Title_Tag" } } - //Невероятные приключения Канаи - //{ criteria_id: 74987252674266 advance_event { id: 200 comparand: 74987243457910 } necessary_quantity: 1 order_hint: 5 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:CraftingKanaisCubeExtractPower1_Title_Tag_1" } } - //Все выше и выше - //{ criteria_id: 74987254853541 advance_event { id: 200 comparand: 74987257058411 } necessary_quantity: 1 order_hint: 6 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:Level_10_Title_Tag_6" } } - //Оставь надежду - //{ criteria_id: 74987254022737 advance_event { id: 200 comparand: 74987253273237 } necessary_quantity: 1 order_hint: 7 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKillRakanothHard_Title_Tag" } } - //Сущий ад - //{ criteria_id: 74987252582955 advance_event { id: 200 comparand: 74987259900862 } necessary_quantity: 1 order_hint: 8 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKillSKHard_Title_Tag" } } - //Приятные мелочи - //{ criteria_id: 74987254245219 advance_event { id: 200 comparand: 74987243791733 } necessary_quantity: 1 order_hint: 9 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesAchievement265_Title_Tag" } } - //Очаровательные чары - //{ criteria_id: 74987255495718 advance_event { id: 200 comparand: 74987243946801 } necessary_quantity: 1 order_hint: 10 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourney_EnchantAnItem_Title_Tag" } } - //Новый гардероб - //{ criteria_id: 74987253143400 advance_event { id: 200 comparand: 74987255480628 } necessary_quantity: 1 order_hint: 11 evalutation_class: 1144211309 flags: 1024 attributes { key: ":title:" value: "Achievements:SeasonJourney_TransmogrifyAnItem_Title_Tag" } } - } - //Первая глава - if (Achievement.Id == 74987254816831) - { - var criterias = AchievementManager.GetCriterias(Achievement.Id); - //3367569 - Количество приключений -// snapshot.AddCriteriaSnapshot(D3.Achievements.CriteriaUpdateRecord.CreateBuilder().SetCriteriaId32AndFlags8(3367569).SetQuantity32(5)); - //snapshot.AddCriteriaSnapshot(D3.Achievements.CriteriaUpdateRecord.CreateBuilder().SetCriteriaId32AndFlags8(unchecked((uint)74987254401623)).SetQuantity32(1)); - //snapshot.AddCriteriaSnapshot(D3.Achievements.CriteriaUpdateRecord.CreateBuilder().SetCriteriaId32AndFlags8(unchecked((uint)74987246353740)).SetQuantity32(0)); - //{id: 200 - //comparand: 74987256867455 - - /* - Глава Первая - TODO: Критерии первой главы - {criteria_id: 74987243379080 advance_event { id: 200 comparand: 74987247751174 } necessary_quantity: 1 attributes { key: ":title:" value: "Achievements:Complete4Bounties_Title_Tag_2" } } - {criteria_id: 74987246353740 advance_event { id: 200 comparand: 74987256867455 } necessary_quantity: 1 order_hint: 1 attributes { key: ":title:" value: "Achievements:Complete4Bounties_Title_Tag_1" } } - //{id: 200 comparand: 74987256867455} - ---{criteria_id: 74987254401623 advance_event { id: 200 comparand: 74987259370936 } necessary_quantity: 1 order_hint: 2 attributes { key: ":title:" value: "Achievements:Socket_5_Gems_Title_Tag" } } - - Готово: - {criteria_id: 74987249071497 advance_event { id: 200 comparand: 74987250124925 } necessary_quantity: 1 order_hint: 3 attributes { key: ":title:" value: "Achievements:Level_10_Blacksmith_Title_Tag_2" } } - {criteria_id: 74987245845978 advance_event { id: 200 comparand: 74987255697859 } necessary_quantity: 1 order_hint: 4 attributes { key: ":title:" value: "Achievements:Level_10_Jeweler_Title_Tag_2" } } - {criteria_id: 74987259424359 advance_event { id: 200 comparand: 74987255324210 } necessary_quantity: 1 order_hint: 5 attributes { key: ":title:" value: "Achievements:Level_10_Mystic_Title_Tag_1" } } - {criteria_id: 74987250915380 advance_event { id: 200 comparand: 74987258964574 } necessary_quantity: 1 order_hint: 6 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKillDiabloNormal_Title_Tag" } } - {criteria_id: 74987249642121 advance_event { id: 200 comparand: 74987247606809 } necessary_quantity: 1 order_hint: 7 attributes { key: ":title:" value: "Achievements:SeasonJourneyObjectivesKillIzualNormal_Title_Tag" } } - {criteria_id: 74987250038929 advance_event { id: 200 comparand: 74987251848215 } necessary_quantity: 1 order_hint: 8 attributes { key: ":title:" value: "Achievements:Level_50_Title_Tag_1" } } - */ - } - if (Achievement.AttributesList[0].Value.Contains("Kanai")) - { - //Logger.Info(Achievement.AttributesList[0].Value); - } - if (Achievement.AttributesList[0].Value.Contains("Season")) - { - //Logger.Info(Achievement.AttributesList[0].Value); - } - if (Achievement.AttributesList[0].Value.Contains("SeasonJourney")) - { - //"Achievements:SeasonJourney_SokahrKeywardenT1_Title_Tag_4" - //"Achievements:Level_10_Blacksmith_Title_Tag_2" - //"Achievements:SeasonJourney_SokahrKeywardenT1_Title_Tag_4" - //"Achievements:Kill_AncientBeasts_ActV_SeasonOnly_Title_Tag" - //"Achievements:SeasonJourneyObjectivesFollowerLegendary_Title_Tag" - string Name = ""; - foreach (var attr in Achievement.AttributesList) - { - switch (attr.Key) - { - case ":title:": Name = attr.Value; break; - case "Partition": - if (attr.Value == "1") //Сезон - { - //Logger.Warn("Name: {0}, Partition: {1}", Name, attr.Value); - if (Achievement.CategoryId == 5548889 - || - Achievement.CategoryId == 5519843 //> 4 главы - //|| - //Achievement.CategoryId == 5518623 - ) ; - //snapshot.AddAchievementSnapshot(D3.Achievements.AchievementUpdateRecord.CreateBuilder().SetAchievementId(Achievement.Id).SetCompletion(1)); - else - { - //snapshot.AddAchievementSnapshot(D3.Achievements.AchievementUpdateRecord.CreateBuilder().SetAchievementId(Achievement.Id).SetCompletion(1)); - //Logger.Warn("Name: {0}, Partition: {1}, ID: {2}", Name, attr.Value, Achievement.Id); - } - } - //Logger.Warn("Partition: {0}", attr.Value); - break; - } - // if(attr) - } - //Achievements:SeasonJourneyObjectivesFollowerLegendary_Description_Tag - } - //snapshot.AddAchievementSnapshot(D3.Achievements.AchievementUpdateRecord.CreateBuilder().SetAchievementId(Achievement.Id).SetCompletion(1)); - } - - //Name: Achievements: SeasonJourneyMainPartII_Title_Tag_29, Partition: 1, ID: 74987248297399 - Четвертая глава - //Name: Achievements: SeasonJourneyMainPartII_Title_Tag_28, Partition: 1, ID: 74987247265988 - Третья глава - //Name: Achievements: SeasonJourneyMainPartII_Title_Tag_27, Partition: 1, ID: 74987254626662 - Вторая глава - //Name: Achievements: SeasonJourneyMainPartI_Title_Tag_9, Partition: 1, ID: 74987254816831 - Первая глава - return AchievementsSnapshot.CreateBuilder().SetErrorCode(0).SetGameAccountId(request.GameAccountId).SetSnapshot(snapshot).Build().ToByteString(); } @@ -2402,7 +2222,6 @@ namespace DiIiS_NA.LoginServer.ServicesSystem.Services var response = MatchmakingGetStatsResponse.CreateBuilder().AddStatsBucket(back); return response.Build().ToByteString(); - return ByteString.Empty; } #endregion diff --git a/src/DiIiS-NA/Core/Extensions/ObjectExtensions.cs b/src/DiIiS-NA/Core/Extensions/ObjectExtensions.cs index 6fb3a26..19e356f 100644 --- a/src/DiIiS-NA/Core/Extensions/ObjectExtensions.cs +++ b/src/DiIiS-NA/Core/Extensions/ObjectExtensions.cs @@ -10,8 +10,7 @@ namespace DiIiS_NA.Core.Extensions { public static T DeepClone(T obj) { - //Blizzless Project 2022 -using (var ms = new MemoryStream()) + using (var ms = new MemoryStream()) { var formatter = new BinaryFormatter(); formatter.Serialize(ms, obj); diff --git a/src/DiIiS-NA/Core/MPQ/Data.cs b/src/DiIiS-NA/Core/MPQ/Data.cs index ccb4b46..173b7d3 100644 --- a/src/DiIiS-NA/Core/MPQ/Data.cs +++ b/src/DiIiS-NA/Core/MPQ/Data.cs @@ -68,7 +68,7 @@ namespace DiIiS_NA.Core.MPQ #endregion - private static readonly Logger Logger = LogManager.CreateLogger("DataBaseWorker"); + private static new readonly Logger Logger = LogManager.CreateLogger("DataBaseWorker"); public Data() //: base(0, new List { "CoreData.mpq", "ClientData.mpq" }, "/base/d3-update-base-(?.*?).mpq") @@ -230,29 +230,24 @@ using (StreamWriter sw = new StreamWriter(writePath, false, System.Text.Encoding var timerStart = DateTime.Now; - // read all assets from the catalog first and process them (ie. find the parser if any available). while (stream.Position < stream.Length) { stream.Position += 8; var group = (SNOGroup)stream.ReadValueS32(); var snoId = stream.ReadValueS32(); var name = stream.ReadString(128, true); - if (group == SNOGroup.SkillKit) - ; - if (groupsToLoad != null && !groupsToLoad.Contains(group)) // if we're handled groups to load, just ignore the ones not in the list. + if (groupsToLoad != null && !groupsToLoad.Contains(group)) continue; var asset = new MPQAsset(group, snoId, name); - asset.MpqFile = this.GetFile(asset.FileName, PatchExceptions.Contains(asset.Group)); // get the file. note: if file is in any of the groups in PatchExceptions it'll from load the original version - the reason is that assets in those groups got patched to 0 bytes. /raist. + asset.MpqFile = this.GetFile(asset.FileName, PatchExceptions.Contains(asset.Group)); if (asset.MpqFile != null) this.ProcessAsset(asset); // process the asset. } stream.Close(); - - // Run the parsers for assets (that have a parser). - + if (this._tasks.Count > 0) // if we're running in tasked mode, run the parser tasks. { foreach (var task in this._tasks) diff --git a/src/DiIiS-NA/D3-GameServer/ClientSystem/GameClient.cs b/src/DiIiS-NA/D3-GameServer/ClientSystem/GameClient.cs index 8137e25..7978424 100644 --- a/src/DiIiS-NA/D3-GameServer/ClientSystem/GameClient.cs +++ b/src/DiIiS-NA/D3-GameServer/ClientSystem/GameClient.cs @@ -110,8 +110,8 @@ namespace DiIiS_NA.GameServer.ClientSystem } else if (message is ISelfHandler) (message as ISelfHandler).Handle(this); // if message is able to handle itself, let it do so. - else if (message.Id == 217) ; - else Logger.Warn("{0} - ID:{1} has no consumer or self-handler.", message.GetType(), message.Id); + else if (message.Id != 217) + Logger.Warn("{0} - ID:{1} has no consumer or self-handler.", message.GetType(), message.Id); } catch (NotImplementedException) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Actor.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Actor.cs index 673bfa6..7c2c343 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Actor.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Actor.cs @@ -120,9 +120,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem /// The angle in radians. public void SetFacingRotation(float facingAngle) { - if (this.Spawner) - ; - else + if (!this.Spawner) { Quaternion q = Quaternion.FacingRotation(facingAngle); this.RotationW = q.W; @@ -450,10 +448,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem if (this is Player) { (this as Player).BetweenWorlds = true; - /*(this as Player).InGameClient.SendMessage(new FreezeGameMessage - { - Field0 = true - });*/ (this as Player).InGameClient.SendMessage(new ACDTranslateSyncMessage() { ActorId = this.DynamicID(this as Player), @@ -476,10 +470,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem if (this is Player) { (this as Player).BetweenWorlds = false; - /*(this as Player).InGameClient.SendMessage(new FreezeGameMessage - { - Field0 = false - });*/ } if (this is Player) @@ -490,7 +480,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem (hireling as Hireling).Brain.DeActivate(); hireling.Position = position; (hireling as Hireling).Brain.Activate(); - //(this as Player).ActiveHireling = hireling; } var questhireling = (this as Player).SetQuestHireling; if (questhireling != null) @@ -498,7 +487,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem (questhireling as Hireling).Brain.DeActivate(); questhireling.Position = position; (questhireling as Hireling).Brain.Activate(); - //(this as Player).ActiveHireling = hireling; } foreach (var fol in (this as Player).Followers) { @@ -517,6 +505,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem this.Attributes[GameAttribute.Looping_Animation_End_Time] = -1; this.Attributes.BroadcastChangedIfRevealed(); //Refresh Inventory + (this as Player).Inventory.RefreshInventoryToClient(); } } @@ -530,9 +519,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem this.SetFacingRotation(facingAngle); if (this.World == null) return; - if (Spawner) - ; - else + if (!Spawner) this.World.BroadcastIfRevealed(plr => new ACDTranslateFacingMessage { ActorId = DynamicID(plr), @@ -861,10 +848,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem { lock (player.RevealedObjects) { - if (this.ActorSNO.Id == 3205) - ; if (this.Hidden || this.Dead || !this.Visible || this.World == null) return false; - //Leave Miriam in Crypt if (this.ActorSNO.Id == 175310) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Hirelings/MalthaelHireling.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Hirelings/MalthaelHireling.cs index f703eb8..755033f 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Hirelings/MalthaelHireling.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Hirelings/MalthaelHireling.cs @@ -112,9 +112,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.Hirelings public override bool Reveal(Player player) { return false; - - - return base.Reveal(player); + //return base.Reveal(player); } } } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/NPC/Humans.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/NPC/Humans.cs index abb7bc4..ee98b8a 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/NPC/Humans.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/NPC/Humans.cs @@ -46,9 +46,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations switch (this.ActorSNO.Id) { case 308474: - //[311433][Conversation] X1_westm_Intro_FirstRunnerFromDeath - - //{[Actor] [Type: Monster] SNOId:308474 GlobalId: 1017300800 Position: x:1443.9391 y:439.9689 z:14.999992 Name: X1_WestM_Intro_Human_Male} - Actor IntroMan = null; if (this.Position.X > 1440) StartConversation(this.World, 311433); else diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/trDun_Crypt_2floor.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/trDun_Crypt_2floor.cs index 4da9547..88f40b7 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/trDun_Crypt_2floor.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/ScriptObjects/trDun_Crypt_2floor.cs @@ -33,8 +33,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations.ScriptObjects if (player.Position.DistanceSquared(ref _position) < ActorData.Sphere.Radius * ActorData.Sphere.Radius * 3f * this.Scale && !_collapsed) { _collapsed = true; - int duration = 500; // ticks - this.PlayAnimation(5, 116098); //- Разлом this.World.SpawnMonster(76953, this.Position); } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Vendor.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Vendor.cs index 15e4ac7..5e36768 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Vendor.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Implementations/Vendor.cs @@ -150,8 +150,9 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem.Implementations public override void OnTargeted(Player player, TargetMessage message) { base.OnTargeted(player, message); - player.InGameClient.SendMessage(new OpenTradeWindowMessage((int)this.DynamicID(player))); + //player.RefreshReveal(); _vendorGrid.Reveal(player); + player.InGameClient.SendMessage(new OpenTradeWindowMessage((int)this.DynamicID(player))); } public virtual void OnRequestBuyItem(PlayerSystem.Player player, uint itemId) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/InteractiveNPC.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/InteractiveNPC.cs index 58f787a..56222fa 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/InteractiveNPC.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/InteractiveNPC.cs @@ -299,7 +299,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem NPCInteraction[] npcInters = new NPCInteraction[count]; - bool HaveWithTitles = false; + //bool HaveWithTitles = false; var it = 0; foreach (var conv in Conversations) { @@ -311,7 +311,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem { npcInters[it] = conv.AsNPCInteraction(this, player); it++; - HaveWithTitles = true; + //HaveWithTitles = true; } } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Minion.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Minion.cs index 07188c8..45f3663 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Minion.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Minion.cs @@ -246,29 +246,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem PetId = this.DynamicID(player), }); } - else - { - int TypeID = 7; - int PlusIndex = 0; - bool isGolem = false; - if (this is BaseGolem || - this is IceGolem || - this is BoneGolem || - this is DecayGolem || - this is ConsumeFleshGolem || - this is BloodGolem) - { - TypeID = 27; - isGolem = false; - } - if (this is SkeletalMage) - { - PlusIndex += 10; - TypeID = 9; - } - if (this is NecromancerSkeleton_A) - TypeID = 28; - } return true; } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Portal.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Portal.cs index 9291a09..a748439 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Portal.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ActorSystem/Portal.cs @@ -99,6 +99,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem this.Destination = SmartExitGenerate(); } + else if (this.World.WorldSNO.Id == 62751) //portal Adria's Hut this.Destination = new ResolvedPortalDestination { @@ -1290,6 +1291,10 @@ namespace DiIiS_NA.GameServer.GSSystem.ActorSystem if (this.Destination.DestLevelAreaSNO == 81178) return false; if (this.Destination.DestLevelAreaSNO == 210451 && !(this.World.Game.CurrentQuest == 121792 || this.World.Game.CurrentQuest == 57339)) return false; if (this.Destination.DestLevelAreaSNO == 19789 && this.World.WorldSNO.Id == 50585) return false; + if (this.Destination.WorldSNO == 332336 && this.Destination.StartingPointActorTag == 483 && this.World.WorldSNO.Id == 71150) + { + this.Destination.WorldSNO = 71150; this.Destination.StartingPointActorTag = 338; + } } if (this.World.WorldSNO.Id == 80763 && this.Destination.WorldSNO == 85201) //Tower of the Damned lvl2 diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/GeneratorsSystem/WorldGenerator.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/GeneratorsSystem/WorldGenerator.cs index 07a943a..fd56877 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/GeneratorsSystem/WorldGenerator.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/GeneratorsSystem/WorldGenerator.cs @@ -687,7 +687,6 @@ namespace DiIiS_NA.GameServer.GSSystem.GeneratorsSystem if (waypoints.Count > 1) { int RandomPoint = RandomHelper.Next(0, waypoints.Count - 1); - int pos = 0; for (int i = 0; i < waypoints.Count; i++) { if (i != RandomPoint) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs index e02d999..84d2885 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ItemsSystem/Item.cs @@ -435,8 +435,6 @@ namespace DiIiS_NA.GameServer.GSSystem.ItemsSystem if (IsWeapon(this.ItemType)) { - if (Attributes[GameAttribute.Attacks_Per_Second_Item] == 0) - ; if (Attributes[GameAttribute.Damage_Weapon_Min, 0] == 0) Attributes[GameAttribute.Damage_Weapon_Min, 0] = 34; if (Attributes[GameAttribute.Damage_Weapon_Delta, 0] == 0) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/GameAttributeMap.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/GameAttributeMap.cs index f58f49b..9170464 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/GameAttributeMap.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/GameAttributeMap.cs @@ -288,23 +288,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem foreach (var attr in attributes.Where(a => GameAttribute.Attributes[a.Id].Id == 408).ToList()) if (_parent is Item) attributes.Remove(attr); - - foreach (var attr in attributes.Where(a => !this.Replicateable(GameAttribute.Attributes[a.Id])).ToList()) - if (_parent is Item) - ;// attributes.Remove(attr); - - if (this._parent.World != null && this._parent.World.IsPvP) - { - if (this._parent == client.Player || (this._parent is Minion && (this._parent as Minion).Master == client.Player)) - ;// attributes.RemoveWhere(a => a.Id == 104); - } - - if (!(this._parent is Living && !(this._parent is NPC)) && !(this._parent is Player && (this._parent as Player) == client.Player)) - { - foreach (var attr in attributes.Where(a => ((_attributeValues[a].Value == GameAttribute.Attributes[a.Id]._DefaultValue.Value) && (_attributeValues[a].ValueF == GameAttribute.Attributes[a.Id]._DefaultValue.ValueF))).ToList()) - ;// attributes.Remove(attr); - } - //*/ + var ids = attributes.GetEnumerator(); bool level = attributes.Contains(new KeyId() { Id = GameAttribute.Level.Id }); diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/WorldObject.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/WorldObject.cs index 2805f9d..9419bd6 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/WorldObject.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/ObjectsSystem/WorldObject.cs @@ -39,7 +39,7 @@ namespace DiIiS_NA.GameServer.GSSystem.ObjectsSystem set { _position = value; - if (_position == null || this.Size == null) return; + if (_position == null) return; this.Bounds = new RectangleF(this.Position.X, this.Position.Y, this.Size.Width, this.Size.Height); var handler = PositionChanged; if (handler != null) handler(this, EventArgs.Empty); diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/ConversationManager.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/ConversationManager.cs index e955a76..c525c45 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/ConversationManager.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/ConversationManager.cs @@ -728,7 +728,6 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem foreach (var ghost in cryptwrld.GetActorsBySNO(5360)) ghost.Destroy(); break; - break; #endregion #region A1-Q4 Event_DoK case 139823: //Event_DoK_Kill.cnv diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Inventory.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Inventory.cs index f94d03c..c6a67f1 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Inventory.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Inventory.cs @@ -348,6 +348,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem item.Unreveal(_owner); this.AddGoldAmount(cost); (vendor as Vendor).AddBuybackItem(item, _owner); + _owner.PlayEffect(Effect.Sound, 36744); } public bool CheckItemSlots(Item target_item, int destination_slot) @@ -602,9 +603,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem var addedItem = destGrid.GetItem(item.InvLoc(_owner).Row + 1, item.InvLoc(_owner).Column); if (addedItem != null) { - if (sourceGrid.GetItemInventorySize(addedItem).Height == 2) - ; - else + if (sourceGrid.GetItemInventorySize(addedItem).Height != 2) { ChangeItemSlotDB(request.Location.EquipmentSlot, addedItem); ChangeItemLocationDB(old_x, old_y + 1, addedItem); diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs index b5f44e6..5b0777b 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PlayerSystem/Player.cs @@ -1604,7 +1604,6 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem Actor NStone = null; Portal portal = null; int map = -1; - int x = 0; int[] Maps = new int[] { @@ -2293,32 +2292,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem { this.Attributes.BroadcastChangedIfRevealed(); var a = this.GetActorsInRange(15f); - ; - //2896 2968 - - //this.World.SpawnRandomLegOrSetEquip(this, this); - //this.World.SpawnRandomEquip(this, this - // , RandomHelper.Next(3, 8)); - //this.GrantCriteria(74987249495955); - // foreach (var actor in World.GetActorsInGroup(-1248096796)) - //actor.PlayActionAnimation(11514); - //for (int i = 0; i < 20; i++) - //0 - хз - //1 - Инвентарь - //2 - Скиллы - //3 - Парагон скиллы - //4,5,6 - краш - //7 - пустая карта - //8 - Задания - //9 - Тайник - //10 - Соратник - //11,12,15 - ? - //13 - Админка - //14 - Мини карта - //16 - Почта - //17,18,19,20,21,22,23 - разрыв соединения - // this.InGameClient.SendMessage(new UIElementMessage() { Element = 13, Action = true }); - + #region //UpdateExp(5000000); /* @@ -2529,10 +2503,9 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem private void OnTryWaypoint(GameClient client, TryWaypointMessage tryWaypointMessage) { - //{[World] SNOId: 460587 GlobalId: 117440518 Name: lost_souls_prototype_v5} var wpWorld = this.World.Game.GetWayPointWorldById(tryWaypointMessage.nWaypoint); var wayPoint = wpWorld.GetWayPointById(tryWaypointMessage.nWaypoint); - + Logger.Warn("---Waypoint Debug---"); var proximity = new RectangleF(wayPoint.Position.X - 1f, wayPoint.Position.Y - 1f, 2f, 2f); var scenes = wpWorld.QuadTree.Query(proximity); if (scenes.Count == 0) return; // cork (is it real?) @@ -2546,21 +2519,15 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem } var levelArea = scene.Specification.SNOLevelAreas[0]; - Logger.Trace("OnTryWaypoint: Id: {0}, WorldId: {1}, levelArea: {2}", tryWaypointMessage.nWaypoint, wpWorld.WorldSNO.Id, levelArea); + Logger.Warn($"OnTryWaypoint: Id: {tryWaypointMessage.nWaypoint}, WorldId: {wpWorld.WorldSNO.Id}, levelArea: {levelArea}"); if (wayPoint == null) return; - + Logger.Warn($"WpWorld: {wpWorld}, wayPoint: {wayPoint}"); InGameClient.SendMessage(new SimpleMessage(Opcodes.LoadingWarping)); if (wpWorld == this.World) this.Teleport(wayPoint.Position); else this.ChangeWorld(wpWorld, wayPoint.Position); - /*this.Attributes[GameAttribute.Hidden] = false; - this.Attributes[GameAttribute.Loading] = false; - this.Attributes[GameAttribute.Disabled] = false; - this.Attributes[GameAttribute.CantStartDisplayedPowers] = false; - this.Attributes.BroadcastChangedIfRevealed();*/ - //handling quest triggers if (this.World.Game.QuestProgress.QuestTriggers.ContainsKey(levelArea)) //EnterLevelArea { @@ -2585,8 +2552,21 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem PlayerIndex = this.PlayerIndex, LevelAreaSNO = levelArea }); + Logger.Warn("---Waypoint Debug End---"); } + public void RefreshReveal() + { + float Range = 200f; + if (this.InGameClient.Game.CurrentEncounter.activated) + Range = 360f; + List actors_around = this.GetActorsInRange(Range); + + foreach (var actor in actors_around) + if (actor is not Player) + actor.Unreveal(this); + RevealActorsToPlayer(); + } private void OnRequestBuyItem(GameClient client, RequestBuyItemMessage requestBuyItemMessage) { var vendor = this.SelectedNPC as Vendor; @@ -2722,7 +2702,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem if (!this.Inventory.HaveEnough(ingr.ItemsGBID, ingr.Count)) { haveEnoughIngredients = false; break; } //if havent enough then exit } - //if (!haveEnoughIngredients) return; + if (!haveEnoughIngredients) return; this.Inventory.RemoveGoldAmount(recipeDefinition.Gold); foreach (var ingr in recipeDefinition.Ingredients) //second loop (getting) @@ -2790,7 +2770,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem if (!this.Inventory.HaveEnough(ingr.ItemsGBID, ingr.Count)) { haveEnoughIngredients = false; break; } //if havent enough then exit } - //if (!haveEnoughIngredients) return; + if (!haveEnoughIngredients) return; this.Inventory.RemoveGoldAmount(recipeDefinition.Gold); foreach (var ingr in recipeDefinition.Ingredients) //second loop (getting) @@ -2855,7 +2835,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem if (!this.Inventory.HaveEnough(ingr.ItemsGBID, ingr.Count)) { haveEnoughIngredients = false; break; } //if havent enough then exit } - //if (!haveEnoughIngredients) return; + if (!haveEnoughIngredients) return; this.Inventory.RemoveGoldAmount(recipeDefinition.Gold); foreach (var ingr in recipeDefinition.Ingredients) //second loop (getting) @@ -3399,8 +3379,6 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem { actor.Reveal(this); } - else - ; } foreach (var actor in this.World.Actors.Values) // unreveal far actors @@ -3606,12 +3584,12 @@ namespace DiIiS_NA.GameServer.GSSystem.PlayerSystem if (this == player) // only send this when player's own actor being is revealed. /raist. { - player.InGameClient.SendMessage(new PlayerWarpedMessage() - { - WarpReason = 9, - WarpFadeInSecods = 0f, - }); - } + player.InGameClient.SendMessage(new PlayerWarpedMessage() + { + WarpReason = 9, + WarpFadeInSecods = 0f, + }); + } if (this.SkillSet.HasSkill(460757)) foreach (var skill in this.SkillSet.ActiveSkills) diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/ChanneledSkill.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/ChanneledSkill.cs index 3386691..a4b6fee 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/ChanneledSkill.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/ChanneledSkill.cs @@ -18,7 +18,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem public bool IsChannelOpen = false; public float EffectsPerSecond = 1.0f; public bool WaitForSpawn = false; - public float WaitSeconds = 1.0f; + public new float WaitSeconds = 1.0f; public virtual void OnChannelOpen() { } public virtual void OnChannelClose() { } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/EffectActor.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/EffectActor.cs index 2c9a04b..094d4d7 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/EffectActor.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/EffectActor.cs @@ -47,7 +47,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem this.Position = position; // copy in important effect params from user - if (context.PowerSNO != null) + if (context != null) if (context.PowerSNO != 0) { this.Attributes[GameAttribute.Rune_A, context.PowerSNO] = context.User.Attributes[GameAttribute.Rune_A, context.PowerSNO]; diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Barbarian.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Barbarian.cs index 3dff62a..44b22cf 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Barbarian.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Barbarian.cs @@ -39,7 +39,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations bool hitAnything = false; var ShockWavePos = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, - ScriptFormula(23)); + 10.0f); var maxHits = 1; for (int i = 0; i < maxHits; ++i) { @@ -56,7 +56,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations hitAnything = true; if (Rune_D > 0) { - GeneratePrimaryResource(ScriptFormula(10)); + GeneratePrimaryResource(6.0f); } if (Rune_B > 0) { @@ -68,18 +68,16 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations } else if (Rune_C > 0) { - if (Rand.NextDouble() < ScriptFormula(14)) - AddBuff(hitPayload.Target, new DebuffStunned(WaitSeconds(ScriptFormula(15)))); + if (Rand.NextDouble() < 0.5) + AddBuff(hitPayload.Target, new DebuffStunned(WaitSeconds(1.5f))); } else { - if (Rand.NextDouble() < ScriptFormula(0)) + if (Rand.NextDouble() < 0.1) Knockback(hitPayload.Target, 0.8f, 2, -0.03f); } }; attack.Apply(); - yield return WaitSeconds(0.5f); - if (hitAnything) GeneratePrimaryResource(EvalTag(PowerKeys.ResourceGainedOnFirstHit)); } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/DemonHunter.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/DemonHunter.cs index 5440c07..b174dda 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/DemonHunter.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/DemonHunter.cs @@ -2097,8 +2097,6 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations WeaponDamage(hit, ScriptFormula(0), RuneSelect(DamageType.Physical, DamageType.Fire, DamageType.Lightning, DamageType.Poison, DamageType.Physical, DamageType.Physical)); }; } - var a = 0; - } yield break; } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Necromancer.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Necromancer.cs index 9f6e012..9ecea3c 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Necromancer.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Implementations/HeroSkills/Necromancer.cs @@ -98,7 +98,7 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations { WeaponDamage(Targets, 1.50f, DamageType.Cold); EffectActor Explosion1 = SpawnEffect(defaultEff, TargetPosition, 0, WaitSeconds(2f)); - Explosion.PlayEffect(Effect.PlayEffectGroup, 471410); + Explosion1.PlayEffect(Effect.PlayEffectGroup, 471410); foreach (var Target in Targets.Actors) AddBuff(Target, new DebuffChilled(0.4f, WaitSeconds(0.5f))); } @@ -304,7 +304,6 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations { var PowerData = (DiIiS_NA.Core.MPQ.FileFormats.Power)MPQStorage.Data.Assets[SNOGroup.Power][this.PowerSNO].Data; - bool hitAnything = false; TargetPosition = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 7f); DamageType DType = DamageType.Physical; if (Rune_E > 0) DType = DamageType.Poison; @@ -573,8 +572,6 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations attack.AddWeaponDamage(3f, DType); attack.OnHit = hit => { - int baseEffectSkill = 467461; - Effect = SpawnProxy(hit.Target.Position); Effect.AddComplexEffect(RuneSelect(467461, 467557, 467500, 467643, 469460, 469275), _beamEnd); //Effect.AddComplexEffect(baseEffectSkill, _beamEnd); @@ -805,8 +802,8 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations projectile.OnUpdate = () => { - if (!User.World.CheckLocationForFlag(projectile.Position, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowProjectile)) - ;// projectile.Destroy(); + //if (!User.World.CheckLocationForFlag(projectile.Position, DiIiS_NA.Core.MPQ.FileFormats.Scene.NavCellFlags.AllowProjectile)) + // projectile.Destroy(); }; yield return WaitSeconds(5f); @@ -1886,8 +1883,6 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Implementations if (Rune_B > 0) (User as PlayerSystem.Player).AddPercentageHP(-3); - int Count = 0; - Proxy.PlayEffectGroup(RuneSelect(465009, 465021, 465016, 465027, 465011, 465026)); foreach (var act in Flesh) { diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs index 6c27381..3d989a0 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/PowerSystem/Payloads/DeathPayload.cs @@ -152,18 +152,18 @@ namespace DiIiS_NA.GameServer.GSSystem.PowerSystem.Payloads }); ((this.Target as NecromancerSkeleton_A).Master as Player).NecroSkeletons.Remove(this.Target); } - if (this is BaseGolem || - this is IceGolem || - this is BoneGolem || - this is DecayGolem || - this is ConsumeFleshGolem || - this is BloodGolem) + if (this.Target is BaseGolem || + this.Target is IceGolem || + this.Target is BoneGolem || + this.Target is DecayGolem || + this.Target is ConsumeFleshGolem || + this.Target is BloodGolem) { - ((this.Target as NecromancerSkeleton_A).Master as Player).InGameClient.SendMessage(new MessageSystem.Message.Definitions.Pet.PetDetachMessage() + ((this.Target as Minion).Master as Player).InGameClient.SendMessage(new MessageSystem.Message.Definitions.Pet.PetDetachMessage() { PetId = this.Target.DynamicID(((this.Target as Minion).Master as Player)) }); - ((this.Target as NecromancerSkeleton_A).Master as Player).ActiveGolem = null; + ((this.Target as Minion).Master as Player).ActiveGolem = null; } if (this.Target is Player) { diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/LaunchConversationWithCutScene.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/LaunchConversationWithCutScene.cs index fa67911..3fe7fd9 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/LaunchConversationWithCutScene.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestEvents/LaunchConversationWithCutScene.cs @@ -33,7 +33,7 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem.QuestEvents if (ActorSNO != -1) plr.InGameClient.SendMessage(new MessageSystem.Message.Definitions.Camera.CameraFocusMessage() { ActorID = (int)world.GetActorBySNO(ActorSNO).DynamicID(plr), Duration = 1f, Snap = false }); foreach (var actor in world.Actors.Values) - if (actor !is ActorSystem.Gizmo) + if (actor is not ActorSystem.Gizmo) actor.Reveal(plr); } } diff --git a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestProgress.cs b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestProgress.cs index 910dcf6..d600b4d 100644 --- a/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestProgress.cs +++ b/src/DiIiS-NA/D3-GameServer/GSSystem/QuestSystem/QuestProgress.cs @@ -386,8 +386,6 @@ namespace DiIiS_NA.GameServer.GSSystem.QuestSystem NPC.ForceConversationSNO = conversation; } } - else - ;// Logger.Warn("Не удалось присвоить диалог для NPC."); } diff --git a/src/DiIiS-NA/D3-GameServer/MessageSystem/Message/Definitions/Effect/PlayEffectMessage.cs b/src/DiIiS-NA/D3-GameServer/MessageSystem/Message/Definitions/Effect/PlayEffectMessage.cs index 05ad8fe..9576415 100644 --- a/src/DiIiS-NA/D3-GameServer/MessageSystem/Message/Definitions/Effect/PlayEffectMessage.cs +++ b/src/DiIiS-NA/D3-GameServer/MessageSystem/Message/Definitions/Effect/PlayEffectMessage.cs @@ -37,8 +37,6 @@ namespace DiIiS_NA.GameServer.MessageSystem.Message.Definitions.Effect public override void Encode(GameBitBuffer buffer) { - if (Effect == Effect.ParagonLevelUp) - ; buffer.WriteUInt(32, ActorId); buffer.WriteInt(7, (int)Effect - (-1)); buffer.WriteBool(OptionalParameter.HasValue); diff --git a/src/DiIiS-NA/Program.cs b/src/DiIiS-NA/Program.cs index 0cd166a..2dea975 100644 --- a/src/DiIiS-NA/Program.cs +++ b/src/DiIiS-NA/Program.cs @@ -189,7 +189,6 @@ namespace DiIiS_NA var line = Console.ReadLine(); CommandManager.Parse(line); } - await boundChannel.CloseAsync(); } catch (Exception e) { diff --git a/src/DiIiS-NA/REST/Manager/SocketManager.cs b/src/DiIiS-NA/REST/Manager/SocketManager.cs index e90fde4..5d4a6ae 100644 --- a/src/DiIiS-NA/REST/Manager/SocketManager.cs +++ b/src/DiIiS-NA/REST/Manager/SocketManager.cs @@ -64,7 +64,7 @@ namespace DiIiS_NA.REST.Manager _threads[SelectThreadWithMinConnections()].AddSocket(newSocket); } - catch (Exception err) + catch { } diff --git a/src/DiIiS-NA/REST/Networking/AsyncAcceptor.cs b/src/DiIiS-NA/REST/Networking/AsyncAcceptor.cs index 70dfe41..c2ba38a 100644 --- a/src/DiIiS-NA/REST/Networking/AsyncAcceptor.cs +++ b/src/DiIiS-NA/REST/Networking/AsyncAcceptor.cs @@ -32,7 +32,7 @@ namespace DiIiS_NA.REST.Networking _listener = new TcpListener(bindIP, port); _listener.Start(); } - catch (SocketException ex) + catch { return false; } diff --git a/src/DiIiS-NA/REST/Networking/NetworkThread.cs b/src/DiIiS-NA/REST/Networking/NetworkThread.cs index 23aaa1e..a83ab74 100644 --- a/src/DiIiS-NA/REST/Networking/NetworkThread.cs +++ b/src/DiIiS-NA/REST/Networking/NetworkThread.cs @@ -76,8 +76,6 @@ namespace DiIiS_NA.REST.Networking { Thread.Sleep(sleepTime); - uint tickStart = 0; - AddNewSockets(); for (var i = 0; i < _Sockets.Count; ++i) diff --git a/src/DiIiSNet/bgs/protocol/InvitationTypes.cs b/src/DiIiSNet/bgs/protocol/InvitationTypes.cs index 6a6e6b2..ed8e2d5 100644 --- a/src/DiIiSNet/bgs/protocol/InvitationTypes.cs +++ b/src/DiIiSNet/bgs/protocol/InvitationTypes.cs @@ -935,12 +935,10 @@ namespace bgs.protocol public const int InvitationMessageFieldNumber = 1; private bool hasInvitationMessage; private string invitationMessage_ = ""; - [global::System.ObsoleteAttribute()] public bool HasInvitationMessage { get { return hasInvitationMessage; } } - [global::System.ObsoleteAttribute()] public string InvitationMessage { get { return invitationMessage_; } diff --git a/src/DiIiSNet/bgs/protocol/channel/v1/ChannelInvitationTypes.cs b/src/DiIiSNet/bgs/protocol/channel/v1/ChannelInvitationTypes.cs index fdb600f..275908a 100644 --- a/src/DiIiSNet/bgs/protocol/channel/v1/ChannelInvitationTypes.cs +++ b/src/DiIiSNet/bgs/protocol/channel/v1/ChannelInvitationTypes.cs @@ -373,7 +373,6 @@ namespace bgs.protocol.channel.v1 { get { return result.ServiceType; } set { SetServiceType(value); } } - [global::System.ObsoleteAttribute()] public Builder SetServiceType(uint value) { PrepareBuilder(); result.hasServiceType = true; diff --git a/src/DiIiSNet/bgs/protocol/channel/v1/ChannelService.cs b/src/DiIiSNet/bgs/protocol/channel/v1/ChannelService.cs index 8c23a0a..0f60a53 100644 --- a/src/DiIiSNet/bgs/protocol/channel/v1/ChannelService.cs +++ b/src/DiIiSNet/bgs/protocol/channel/v1/ChannelService.cs @@ -2439,7 +2439,6 @@ namespace bgs.protocol.channel.v1 { get { return result.MemberId; } set { SetMemberId(value); } } - [global::System.ObsoleteAttribute()] public Builder SetMemberId(global::bgs.protocol.EntityId value) { pb::ThrowHelper.ThrowIfNull(value, "value"); PrepareBuilder(); @@ -2447,7 +2446,6 @@ namespace bgs.protocol.channel.v1 { result.memberId_ = value; return this; } - [global::System.ObsoleteAttribute()] public Builder SetMemberId(global::bgs.protocol.EntityId.Builder builderForValue) { pb::ThrowHelper.ThrowIfNull(builderForValue, "builderForValue"); PrepareBuilder(); @@ -2455,7 +2453,6 @@ namespace bgs.protocol.channel.v1 { result.memberId_ = builderForValue.Build(); return this; } - [global::System.ObsoleteAttribute()] public Builder MergeMemberId(global::bgs.protocol.EntityId value) { pb::ThrowHelper.ThrowIfNull(value, "value"); PrepareBuilder();