Ejemplo n.º 1
0
        /// <summary>
        /// Returns TRUE if the input player is filtered by this player
        /// </summary>
        public bool Contains(WorldObject source, ChatMessageType messageType = ChatMessageType.AllChannels)
        {
            // ensure this channel can be squelched
            if (messageType != ChatMessageType.AllChannels && !SquelchManager.IsLegalChannel(messageType))
            {
                return(false);
            }

            var squelchMask = messageType.ToMask();

            if (source is Player player)
            {
                // check account squelches

                // the client forces account squelches to be AllMessages,
                // so for these, channel mask is not required

                if (Accounts.ContainsKey(player.Session.Account))
                {
                    return(true);
                }

                // check character squelches
                Characters.TryGetValue(player.Guid.Full, out var squelchInfo);

                if (squelchInfo != null && squelchInfo.Filters[0].HasFlag(squelchMask))
                {
                    return(true);
                }
            }

            // check global squelches
            if (Globals.Filters.Count > 0 && Globals.Filters[0].HasFlag(squelchMask))
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public void PlayerEnterWorld()
        {
            PlayerManager.SwitchPlayerFromOfflineToOnline(this);

            // Save the the LoginTimestamp
            var lastLoginTimestamp = Time.GetUnixTime();

            SetProperty(PropertyInt.LoginTimestamp, (int)lastLoginTimestamp);

            Character.LastLoginTimestamp = lastLoginTimestamp;
            Character.TotalLogins++;
            CharacterChangesDetected = true;

            Sequences.SetSequence(SequenceType.ObjectInstance, new UShortSequence((ushort)Character.TotalLogins));

            if (BarberActive)
            {
                BarberActive = false;
            }

            if (AllegianceNode != null)
            {
                AllegianceRank = (int)AllegianceNode.Rank;
            }
            else
            {
                AllegianceRank = null;
            }

            // SendSelf will trigger the entrance into portal space
            SendSelf();

            // Init the client with the chat channel ID's, and then notify the player that they've choined the associated channels.
            UpdateChatChannels();

            var general  = new GameEventWeenieErrorWithString(Session, WeenieErrorWithString.YouHaveEnteredThe_Channel, "General");
            var trade    = new GameEventWeenieErrorWithString(Session, WeenieErrorWithString.YouHaveEnteredThe_Channel, "Trade");
            var lfg      = new GameEventWeenieErrorWithString(Session, WeenieErrorWithString.YouHaveEnteredThe_Channel, "LFG");
            var roleplay = new GameEventWeenieErrorWithString(Session, WeenieErrorWithString.YouHaveEnteredThe_Channel, "Roleplay");

            Session.Network.EnqueueSend(general, trade, lfg, roleplay);

            // check if vassals earned XP while offline
            HandleAllegianceOnLogin();
            HandleHouseOnLogin();

            // retail appeared to send the squelch list very early,
            // even before the CreatePlayer, but doing it here
            if (SquelchManager.HasSquelches)
            {
                SquelchManager.SendSquelchDB();
            }

            AuditItemSpells();

            if (PlayerKillerStatus == PlayerKillerStatus.PKLite && !PropertyManager.GetBool("pkl_server").Item)
            {
                var actionChain = new ActionChain();
                actionChain.AddDelaySeconds(3.0f);
                actionChain.AddAction(this, () =>
                {
                    UpdateProperty(this, PropertyInt.PlayerKillerStatus, (int)PlayerKillerStatus.NPK, true);

                    Session.Network.EnqueueSend(new GameEventWeenieError(Session, WeenieError.YouAreNonPKAgain));
                });
                actionChain.EnqueueChain();
            }

            HandleDBUpdates();
        }
Ejemplo n.º 3
0
        public void PlayerEnterWorld()
        {
            PlayerManager.SwitchPlayerFromOfflineToOnline(this);
            Teleporting = true;

            // Save the the LoginTimestamp
            var lastLoginTimestamp = Time.GetUnixTime();

            LoginTimestamp             = lastLoginTimestamp;
            LastTeleportStartTimestamp = lastLoginTimestamp;

            Character.LastLoginTimestamp = lastLoginTimestamp;
            Character.TotalLogins++;
            CharacterChangesDetected = true;

            Sequences.SetSequence(SequenceType.ObjectInstance, new UShortSequence((ushort)Character.TotalLogins));

            if (BarberActive)
            {
                BarberActive = false;
            }

            if (AllegianceNode != null)
            {
                AllegianceRank = (int)AllegianceNode.Rank;
            }
            else
            {
                AllegianceRank = null;
            }

            if (!Account15Days)
            {
                var accountTimeSpan = DateTime.UtcNow - Account.CreateTime;
                if (accountTimeSpan.TotalDays >= 15)
                {
                    Account15Days = true;
                }
            }

            // SendSelf will trigger the entrance into portal space
            SendSelf();

            // Update or override certain properties sent to client.

            // bugged: do not send this here, or else a freshly loaded acclient will overrwrite the values
            // wait until first enter world is completed

            //SendPropertyUpdatesAndOverrides();

            // Init the client with the chat channel ID's, and then notify the player that they've choined the associated channels.
            UpdateChatChannels();

            var general  = new GameEventWeenieErrorWithString(Session, WeenieErrorWithString.YouHaveEnteredThe_Channel, "General");
            var trade    = new GameEventWeenieErrorWithString(Session, WeenieErrorWithString.YouHaveEnteredThe_Channel, "Trade");
            var lfg      = new GameEventWeenieErrorWithString(Session, WeenieErrorWithString.YouHaveEnteredThe_Channel, "LFG");
            var roleplay = new GameEventWeenieErrorWithString(Session, WeenieErrorWithString.YouHaveEnteredThe_Channel, "Roleplay");

            Session.Network.EnqueueSend(general, trade, lfg, roleplay);

            // check if vassals earned XP while offline
            HandleAllegianceOnLogin();
            HandleHouseOnLogin();

            // retail appeared to send the squelch list very early,
            // even before the CreatePlayer, but doing it here
            if (SquelchManager.HasSquelches)
            {
                SquelchManager.SendSquelchDB();
            }

            AuditItemSpells();

            HandleMissingXp();
            HandleSkillCreditRefund();

            if (PlayerKillerStatus == PlayerKillerStatus.PKLite && !PropertyManager.GetBool("pkl_server").Item)
            {
                var actionChain = new ActionChain();
                actionChain.AddDelaySeconds(3.0f);
                actionChain.AddAction(this, () =>
                {
                    UpdateProperty(this, PropertyInt.PlayerKillerStatus, (int)PlayerKillerStatus.NPK, true);

                    Session.Network.EnqueueSend(new GameEventWeenieError(Session, WeenieError.YouAreNonPKAgain));
                });
                actionChain.EnqueueChain();
            }

            HandleDBUpdates();
        }
Ejemplo n.º 4
0
        private void SetEphemeralValues()
        {
            ObjectDescriptionFlags |= ObjectDescriptionFlag.Player;

            // This is the default send upon log in and the most common. Anything with a velocity will need to add that flag.
            // This should be handled automatically...
            //PositionFlags |= PositionFlags.OrientationHasNoX | PositionFlags.OrientationHasNoY | PositionFlags.IsGrounded | PositionFlags.HasPlacementID;

            FirstEnterWorldDone = false;

            SetStance(MotionStance.NonCombat, false);

            // radius for object updates
            ListeningRadius = 5f;

            if (Session != null && Common.ConfigManager.Config.Server.Accounts.OverrideCharacterPermissions)
            {
                if (Session.AccessLevel == AccessLevel.Admin)
                {
                    IsAdmin = true;
                }
                if (Session.AccessLevel == AccessLevel.Developer)
                {
                    IsArch = true;
                }
                if (Session.AccessLevel == AccessLevel.Envoy || Session.AccessLevel == AccessLevel.Sentinel)
                {
                    IsSentinel = true;
                }
                if (Session.AccessLevel == AccessLevel.Advocate)
                {
                    IsAdvocate = true;
                }
            }

            ContainerCapacity = (byte)(7 + AugmentationExtraPackSlot);

            if (Session != null && AdvocateQuest && IsAdvocate) // Advocate permissions are per character regardless of override
            {
                if (Session.AccessLevel == AccessLevel.Player)
                {
                    Session.SetAccessLevel(AccessLevel.Advocate); // Elevate to Advocate permissions
                }
                if (AdvocateLevel > 4)
                {
                    IsPsr = true; // Enable AdvocateTeleport via MapClick
                }
            }

            CombatTable = DatManager.PortalDat.ReadFromDat <CombatManeuverTable>(CombatTableDID.Value);

            _questManager = new QuestManager(this);

            ContractManager = new ContractManager(this);

            ConfirmationManager = new ConfirmationManager(this);

            LootPermission = new Dictionary <ObjectGuid, DateTime>();

            SquelchManager = new SquelchManager(this);

            MagicState = new MagicState(this);

            RecordCast = new RecordCast(this);

            AttackQueue = new AttackQueue(this);

            return; // todo

            // =======================================
            // This code was taken from the old Load()
            // =======================================

            /*AceCharacter character;
             *
             * if (Common.ConfigManager.Config.Server.Accounts.OverrideCharacterPermissions)
             * {
             *  if (Session.AccessLevel == AccessLevel.Admin)
             *      character.IsAdmin = true;
             *  if (Session.AccessLevel == AccessLevel.Developer)
             *      character.IsArch = true;
             *  if (Session.AccessLevel == AccessLevel.Envoy)
             *      character.IsEnvoy = true;
             *  // TODO: Need to setup and account properly for IsSentinel and IsAdvocate.
             *  // if (Session.AccessLevel == AccessLevel.Sentinel)
             *  //    character.IsSentinel = true;
             *  // if (Session.AccessLevel == AccessLevel.Advocate)
             *  //    character.IsAdvocate= true;
             * }*/

            // FirstEnterWorldDone = false;

            // IsAlive = true;
        }
Ejemplo n.º 5
0
        public void PlayerEnterWorld()
        {
            PlayerManager.SwitchPlayerFromOfflineToOnline(this);
            Teleporting = true;

            // Save the the LoginTimestamp
            var lastLoginTimestamp = Time.GetUnixTime();

            LoginTimestamp             = lastLoginTimestamp;
            LastTeleportStartTimestamp = lastLoginTimestamp;

            Character.LastLoginTimestamp = lastLoginTimestamp;
            Character.TotalLogins++;
            CharacterChangesDetected = true;

            Sequences.SetSequence(SequenceType.ObjectInstance, new UShortSequence((ushort)Character.TotalLogins));

            if (BarberActive)
            {
                BarberActive = false;
            }

            if (AllegianceNode != null)
            {
                AllegianceRank = (int)AllegianceNode.Rank;
            }
            else
            {
                AllegianceRank = null;
            }

            if (!Account15Days)
            {
                var accountTimeSpan = DateTime.UtcNow - Account.CreateTime;
                if (accountTimeSpan.TotalDays >= 15)
                {
                    Account15Days = true;
                }
            }

            if (PlayerKillerStatus == PlayerKillerStatus.PKLite && !PropertyManager.GetBool("pkl_server").Item)
            {
                PlayerKillerStatus = PlayerKillerStatus.NPK;

                var actionChain = new ActionChain();
                actionChain.AddDelaySeconds(3.0f);
                actionChain.AddAction(this, () =>
                {
                    Session.Network.EnqueueSend(new GameEventWeenieError(Session, WeenieError.YouAreNonPKAgain));
                });
                actionChain.EnqueueChain();
            }

            // SendSelf will trigger the entrance into portal space
            SendSelf();

            // Update or override certain properties sent to client.

            // bugged: do not send this here, or else a freshly loaded acclient will overrwrite the values
            // wait until first enter world is completed

            //SendPropertyUpdatesAndOverrides();

            if (PropertyManager.GetBool("use_turbine_chat").Item)
            {
                // Init the client with the chat channel ID's, and then notify the player that they've joined the associated channels.
                Session.Network.EnqueueSend(new GameEventWeenieError(Session, WeenieError.TurbineChatIsEnabled));

                if (GetCharacterOption(CharacterOption.ListenToAllegianceChat) && Allegiance != null)
                {
                    JoinTurbineChatChannel("Allegiance");
                }
                if (GetCharacterOption(CharacterOption.ListenToGeneralChat))
                {
                    JoinTurbineChatChannel("General");
                }
                if (GetCharacterOption(CharacterOption.ListenToTradeChat))
                {
                    JoinTurbineChatChannel("Trade");
                }
                if (GetCharacterOption(CharacterOption.ListenToLFGChat))
                {
                    JoinTurbineChatChannel("LFG");
                }
                if (GetCharacterOption(CharacterOption.ListenToRoleplayChat))
                {
                    JoinTurbineChatChannel("Roleplay");
                }
                if (GetCharacterOption(CharacterOption.ListenToSocietyChat) && Society != FactionBits.None)
                {
                    JoinTurbineChatChannel("Society");
                }
            }

            // check if vassals earned XP while offline
            HandleAllegianceOnLogin();
            HandleHouseOnLogin();

            // retail appeared to send the squelch list very early,
            // even before the CreatePlayer, but doing it here
            if (SquelchManager.HasSquelches)
            {
                SquelchManager.SendSquelchDB();
            }

            AuditItemSpells();
            AuditEquippedItems();

            HandleMissingXp();
            HandleSkillCreditRefund();
            HandleSkillTemplesReset();
            HandleSkillSpecCreditRefund();
            HandleFreeSkillResetRenewal();
            HandleFreeAttributeResetRenewal();

            HandleDBUpdates();

            if (ServerManager.ShutdownInitiated)
            {
                var actionChain = new ActionChain();
                actionChain.AddDelaySeconds(10.0f);
                actionChain.AddAction(this, () =>
                {
                    SendMessage(ServerManager.ShutdownNoticeText(), ChatMessageType.WorldBroadcast);
                });
                actionChain.EnqueueChain();
            }
        }