Ejemplo n.º 1
0
        public virtual bool SharedCanInteract(ICharacter character, TWorldObject worldObject, bool writeToLog)
        {
            if (!this.IsInteractableObject)
            {
                return(false);
            }

            if (character.GetPublicState <ICharacterPublicState>().IsDead ||
                IsServer && !character.ServerIsOnline)
            {
                return(false);
            }

            if (worldObject is IStaticWorldObject staticWorldObject)
            {
                if (PveSystem.SharedIsPve(clientLogErrorIfDataIsNotYetAvailable: false))
                {
                    if (!PveSystem.SharedValidateInteractionIsNotForbidden(character,
                                                                           staticWorldObject,
                                                                           writeToLog))
                    {
                        // action forbidden by PvE system
                        return(false);
                    }
                }
                else // PvP servers have newbie protection system
                {
                    if (!NewbieProtectionSystem.SharedValidateInteractionIsNotForbidden(
                            character,
                            staticWorldObject,
                            writeToLog))
                    {
                        // action forbidden by newbie protection system
                        return(false);
                    }
                }
            }

            return(this.SharedIsInsideCharacterInteractionArea(character,
                                                               worldObject,
                                                               writeToLog));
        }
Ejemplo n.º 2
0
 public override bool SharedCanInteract(ICharacter character, IStaticWorldObject worldObject, bool writeToLog)
 {
     return(PveSystem.SharedValidateInteractionIsNotForbidden(character, worldObject, writeToLog) &&
            NewbieProtectionSystem.SharedValidateInteractionIsNotForbidden(character, worldObject, writeToLog) &&
            this.SharedIsInsideCharacterInteractionArea(character, worldObject, writeToLog));
 }
Ejemplo n.º 3
0
        public virtual bool SharedCanInteract(ICharacter character, TWorldObject worldObject, bool writeToLog)
        {
            if (!this.IsInteractableObject)
            {
                return(false);
            }

            try
            {
                this.VerifyGameObject(worldObject);
            }
            catch (Exception ex)
            {
                Logger.Warning($"Interaction check failed: {ex.GetType().FullName}: {ex.Message}");
                return(false);
            }

            if (character.GetPublicState <ICharacterPublicState>().IsDead ||
                IsServer && !character.ServerIsOnline ||
                ((IsServer || character.IsCurrentClientCharacter) &&
                 PlayerCharacter.GetPrivateState(character).IsDespawned))
            {
                if (writeToLog)
                {
                    Logger.Warning(
                        $"Character cannot interact with {worldObject} - character is offline/despawned/dead.",
                        character);
                }

                return(false);
            }

            if (worldObject is IStaticWorldObject staticWorldObject)
            {
                if (PveSystem.SharedIsPve(clientLogErrorIfDataIsNotYetAvailable: false))
                {
                    if (!PveSystem.SharedValidateInteractionIsNotForbidden(character,
                                                                           staticWorldObject,
                                                                           writeToLog))
                    {
                        // action forbidden by PvE system
                        return(false);
                    }
                }
                else // PvP servers have newbie protection system
                {
                    if (!NewbieProtectionSystem.SharedValidateInteractionIsNotForbidden(
                            character,
                            staticWorldObject,
                            writeToLog))
                    {
                        // action forbidden by newbie protection system
                        return(false);
                    }
                }
            }

            return(this.SharedIsInsideCharacterInteractionArea(character,
                                                               worldObject,
                                                               writeToLog));
        }