/// <summary> /// Sends NewPlayerMessage to players when a new player joins the game. /// </summary> /// <param name="target">Target player to send the message.</param> /// <param name="joinedPlayer">The new joined player.</param> private void SendNewPlayerMessage(Player target, Player joinedPlayer) { target.InGameClient.SendMessage(new NewPlayerMessage { PlayerIndex = joinedPlayer.PlayerIndex, // player index ToonId = new EntityId() { High = (long)joinedPlayer.Toon.D3EntityID.IdHigh, Low = (long)joinedPlayer.Toon.D3EntityID.IdLow }, //Toon GameAccountId = new EntityId() { High = (long)joinedPlayer.Toon.GameAccount.BnetEntityId.High, Low = (long)joinedPlayer.Toon.GameAccount.BnetEntityId.Low }, //GameAccount ToonName = joinedPlayer.Toon.Name, Field3 = 0x00000002, //party frame class Field4 = target != joinedPlayer ? 0x2 : 0x4, //party frame level /boyc - may mean something different /raist. snoActorPortrait = joinedPlayer.ClassSNO, //party frame portrait Level = joinedPlayer.Toon.Level, AltLevel = 0, StateData = joinedPlayer.GetStateData(), Field8 = this.Players.Count != 1, //announce party join Field9 = 0x00000001, ActorID = joinedPlayer.DynamicID, }); var dbArtisans = DBSessions.AccountSession.Get <DBArtisansOfToon>(joinedPlayer.Toon.PersistentID); target.InGameClient.SendMessage(joinedPlayer.GetPlayerBanner()); // send player banner proto - D3.GameMessage.PlayerBanner if (target.Toon.MaximumQuest != -1 & target.Toon.MaximumQuest != 87000 & target.Toon.MaximumQuest != 72095 & target.Toon.MaximumQuest != 72221) { target.InGameClient.SendMessage(joinedPlayer.GetBlacksmithData(dbArtisans)); // Modded by AiDiEvE } else { target.InGameClient.SendMessage(joinedPlayer.GetBlacksmithDataFixInt(0)); StartingWorld.Leave(StartingWorld.GetActorBySNO(56947)); //Кузнец StartingWorld.Leave(StartingWorld.GetActorBySNO(4062)); //Чародейка StartingWorld.Leave(StartingWorld.GetActorBySNO(4644)); //Хитрожопый) StartingWorld.Leave(StartingWorld.GetActorBySNO(4538)); //Храмовник } target.InGameClient.SendMessage(joinedPlayer.GetJewelerData(dbArtisans)); target.InGameClient.SendMessage(joinedPlayer.GetMysticData(dbArtisans)); DBSessions.AccountSession.Flush(); }
} // for possile future messages consumed by game. /raist. #endregion #region player-handling /// <summary> /// Allows a player to join the game. /// </summary> /// <param name="joinedPlayer">The new player.</param> public void Enter(Player joinedPlayer) { this.Players.TryAdd(joinedPlayer.InGameClient, joinedPlayer); // send all players in the game to new player that just joined (including him) foreach (var pair in this.Players) { this.SendNewPlayerMessage(joinedPlayer, pair.Value); } // notify other players about our new player too. foreach (var pair in this.Players.Where(pair => pair.Value != joinedPlayer)) { this.SendNewPlayerMessage(pair.Value, joinedPlayer); } var GameData = new GameSyncedData() { Field0 = 0x0, NowAct = 0x0, Field2 = 0x0, Field3 = 0x0, Field4 = 0x0, Field5 = 0x0, Field6 = 0x0, //Field7 = 0x0, Field7 = new[] { 0x0, 0x0 }, Field8 = new[] { 0x0, 0x0 }, //Field9 = new[] { 0x0, 0x0 }, //Field10 = new[] { 0x0, 0x0 }, //Field11 = new EntityId { High = 0,Low = 0 }, }; switch (joinedPlayer.Toon.ActiveAct) { case 100: GameData.NowAct = 100; break; case 200: GameData.NowAct = 200; break; case 300: GameData.NowAct = 300; break; } joinedPlayer.InGameClient.SendMessage(new GameSyncedDataMessage { Field0 = GameData }); #region Загрузка лора игроков string LoreVar = joinedPlayer.Toon.LoreCollected; if (LoreVar != null & LoreVar != "") { string[] parts = LoreVar.Split(new char[] { '|' }); foreach (var part in parts) { joinedPlayer.AddLoreFromBase(Convert.ToInt32(part)); } } #endregion if (joinedPlayer.PlayerIndex == 0) { if (joinedPlayer.Toon.ActiveAct == 0) { #region Акт 1 Квест 1 if (joinedPlayer.Toon.ActiveQuest == 87700 & joinedPlayer.Toon.StepIDofQuest > 0) { StartingWorld.Leave(StartingWorld.GetActorByDynamicId(72)); //3739 - Rumford var Capitan = StartingWorld.GetActorBySNO(3739); Capitan.Attributes[Net.GS.Message.GameAttribute.MinimapActive] = true; (Capitan as Core.GS.Actors.InteractiveNPC).Conversations.Clear(); (Capitan as Core.GS.Actors.InteractiveNPC).Conversations.Add(new Core.GS.Actors.Interactions.ConversationInteraction(198503)); Capitan.Attributes[Net.GS.Message.GameAttribute.Conversation_Icon, 0] = 1; Capitan.Attributes.BroadcastChangedIfRevealed(); } #endregion #region Акт 1 Квест 2 - Наследие декарда каина else if (joinedPlayer.Toon.ActiveQuest == 72095) { StartingWorld.Leave(StartingWorld.GetActorByDynamicId(72)); #region Перемотка ко второму квесту for (int Rem = 0; Rem < 8; Rem++) { StartingWorld.Game.Quests.Advance(87700); } StartingWorld.Game.Quests.NotifyQuest(87700, NullD.Common.MPQ.FileFormats.QuestStepObjectiveType.InteractWithActor, 192164); StartingWorld.Game.Quests.NotifyQuest(87700, NullD.Common.MPQ.FileFormats.QuestStepObjectiveType.HadConversation, 198521); #endregion //Берем нужную Лию =) var LeahBrains = StartingWorld.GetActorByDynamicId(83); Player MasterPlayer = joinedPlayer; if (LeahBrains != null) { Logger.Debug("Вышибаем SNO {0}, мир содершит {1} ", LeahBrains.ActorSNO, StartingWorld.GetActorsBySNO(3739).Count); StartingWorld.Leave(LeahBrains); } if (joinedPlayer.Toon.StepIDofQuest == -1 || joinedPlayer.Toon.StepIDofQuest == 28) { try { Hireling LeahFriend = new LeahParty(StartingWorld, LeahBrains.ActorSNO.Id, LeahBrains.Tags); //LeahFriend.Brain = new HirelingBrain(LeahFriend); LeahFriend.GBHandle.Type = 4; LeahFriend.GBHandle.GBID = 717705071; LeahFriend.Attributes[GameAttribute.Pet_Creator] = joinedPlayer.PlayerIndex; LeahFriend.Attributes[GameAttribute.Pet_Type] = 0x8; LeahFriend.Attributes[GameAttribute.Hitpoints_Max] = 100f; LeahFriend.Attributes[GameAttribute.Hitpoints_Cur] = 80f; LeahFriend.Attributes[GameAttribute.Attacks_Per_Second] = 1.6f; LeahFriend.Attributes[GameAttribute.Pet_Owner] = joinedPlayer.PlayerIndex; LeahFriend.Attributes[GameAttribute.Untargetable] = false; LeahFriend.Position = joinedPlayer.Position; LeahFriend.RotationW = LeahBrains.RotationW; LeahFriend.RotationAxis = LeahBrains.RotationAxis; LeahFriend.EnterWorld(LeahBrains.Position); LeahFriend.Attributes[GameAttribute.Level]++; joinedPlayer.ActiveHireling = LeahFriend; LeahFriend.Brain.Activate(); MasterPlayer = joinedPlayer; StartingWorld.Leave(LeahBrains); var NewTristramPortal = StartingWorld.GetActorBySNO(223757); var ListenerUsePortalTask = Task <bool> .Factory.StartNew(() => OnUseTeleporterListener(NewTristramPortal.DynamicID, StartingWorld)); ListenerUsePortalTask.ContinueWith(delegate //Once killed: { Logger.Debug(" Waypoint_NewTristram Objective done "); // Waypoint_NewTristram }); var ListenerEnterToOldTristram = Task <bool> .Factory.StartNew(() => OnListenerToEnter(joinedPlayer, StartingWorld)); ListenerEnterToOldTristram.ContinueWith(delegate //Once killed: { Logger.Debug("Enter to Road Objective done "); // Waypoint_OldTristram var ListenerEnterToAdriaEnter = Task <bool> .Factory.StartNew(() => OnListenerToAndriaEnter(joinedPlayer, StartingWorld)); }); } catch { Logger.Warn("Ошибка создания спутника"); var NewTristramPortal = StartingWorld.GetActorBySNO(223757); var ListenerUsePortalTask = Task <bool> .Factory.StartNew(() => OnUseTeleporterListener(NewTristramPortal.DynamicID, StartingWorld)); ListenerUsePortalTask.ContinueWith(delegate //Once killed: { Logger.Debug(" Waypoint_NewTristram Objective done "); // Waypoint_NewTristram }); var ListenerEnterToOldTristram = Task <bool> .Factory.StartNew(() => OnListenerToEnter(joinedPlayer, StartingWorld)); ListenerEnterToOldTristram.ContinueWith(delegate //Once killed: { Logger.Debug("Enter to Road Objective done "); // Waypoint_OldTristram var ListenerEnterToAdriaEnter = Task <bool> .Factory.StartNew(() => OnListenerToAndriaEnter(joinedPlayer, StartingWorld)); }); } } else if (joinedPlayer.Toon.StepIDofQuest == 51) { joinedPlayer.Toon.StepOfQuest = 6; var Gate = StartingWorld.GetActorBySNO(108466); Gate.Destroy(); StartingWorld.Leave(LeahBrains); } else { StartingWorld.Leave(LeahBrains); LeahBrains.EnterWorld(LeahBrains.Position); } } #endregion } } #region Прохождение игры 2.0 и Хард Фиксы if (joinedPlayer.Toon.ActiveQuest != -1) { if (joinedPlayer.Toon.ActiveAct == 0) { joinedPlayer.EnterWorld(StartingWorld.StartingPoints.First().Position); if (joinedPlayer.Toon.ActiveQuest != 87700) { #region Нижнии ворота тристрама var DownGate = StartingWorld.GetActorBySNO(90419); DownGate.Attributes[GameAttribute.Gizmo_State] = 1; DownGate.Attributes[GameAttribute.Untargetable] = true; DownGate.Attributes.BroadcastChangedIfRevealed(); StartingWorld.BroadcastIfRevealed(new Net.GS.Message.Definitions.Animation.SetIdleAnimationMessage { ActorID = DownGate.DynamicID, AnimationSNO = Core.GS.Common.Types.TagMap.AnimationSetKeys.Open.ID }, DownGate); #endregion //Убираем телегу var FactorToShoot = StartingWorld.GetActorBySNO(81699); FactorToShoot.Destroy(); } #region Убираем телегу или делаем её нормальной. if (joinedPlayer.Toon.ActiveQuest != 87700 && joinedPlayer.Toon.ActiveQuest != 72095 && joinedPlayer.Toon.ActiveQuest != -1) { var TELEGAS = StartingWorld.GetActorsBySNO(112131); foreach (var TELEGA in TELEGAS) { TELEGA.Destroy(); } } else { var TELEGAS = StartingWorld.GetActorsBySNO(112131); foreach (var TELEGA in TELEGAS) { TELEGA.Field2 = 0; } } #endregion if (joinedPlayer.Toon.StepIDofQuest != -1) { StartingWorld.Game.Quests[joinedPlayer.Toon.ActiveQuest].SwitchToStep(joinedPlayer.Toon.ActiveQuest, joinedPlayer.Toon.StepIDofQuest); } else { StartingWorld.Game.Quests[joinedPlayer.Toon.ActiveQuest].Advance(); } if (joinedPlayer.Toon.ActiveQuest == 72546) { if (joinedPlayer.Toon.StepIDofQuest == 36) { joinedPlayer.Toon.StepOfQuest = 10; } } if (joinedPlayer.Toon.ActiveQuest == 72061) { if (joinedPlayer.Toon.StepIDofQuest == 44) { StartingWorld.Game.Quests.NotifyQuest(72061, NullD.Common.MPQ.FileFormats.QuestStepObjectiveType.EnterWorld, 50585); } } } } else { joinedPlayer.EnterWorld(this.StartingWorld.StartingPoints.Find(x => x.ActorSNO.Name == "Start_Location_Team_0").Position); bool questConversation = true; var Capitan = this.StartingWorld.GetActorBySNO(3739); Capitan.Attributes[Net.GS.Message.GameAttribute.MinimapActive] = true; (Capitan as Core.GS.Actors.InteractiveNPC).Conversations.Clear(); (Capitan as Core.GS.Actors.InteractiveNPC).Conversations.Add(new Core.GS.Actors.Interactions.ConversationInteraction(151087)); Capitan.Attributes[Net.GS.Message.GameAttribute.Conversation_Icon, 0] = questConversation ? 1 : 0; Capitan.Attributes.BroadcastChangedIfRevealed(); //Убираем эту заразу) wretchedMother StartingWorld.Leave(StartingWorld.GetActorBySNO(176889)); } joinedPlayer.Toon.Side_StepOfQuest = 0; #endregion //Запуск игры joinedPlayer.InGameClient.TickingEnabled = true; // it seems bnet-servers only start ticking after player is completely in-game. /raist }