Esempio n. 1
0
        public void SetHeldState(EHeldState newState)
        {
            HeldState = newState;

            switch (HeldState)
            {
            case EHeldState.Carried:
                if (_glowObject != null && _glowObject.IsActive)
                {
                    _glowObject.IsActive = false;
                }
                IsActive = false;
                if (HoldResetTimeSeconds > 0)
                {
                    _holdResetTime = TCPManager.GetTimeStampMS() + HoldResetTimeSeconds * 1000;
                    CapturingPlayer?.SendClientMessage($"You may hold this object for up to {HoldResetTimeSeconds / 60} minutes before it will reset.");
                    CapturingPlayer?.SendClientMessage($"You may hold this object for up to {HoldResetTimeSeconds / 60} minutes before it will reset.", ChatLogFilters.CHATLOGFILTERS_C_WHITE);
                }
                break;

            case EHeldState.Ground:
                _holdResetTime = 0;
                if (_glowObject != null && _glowObject.IsActive)
                {
                    _glowObject.IsActive = false;
                }
                IsActive = true;
                break;

            case EHeldState.Home:
                _holdResetTime = 0;
                if (_glowObject != null && !_glowObject.IsActive)
                {
                    _glowObject.IsActive = true;
                }
                IsActive = true;
                break;

            case EHeldState.Inactive:
                _holdResetTime = 0;
                if (_glowObject != null && !_glowObject.IsActive)
                {
                    _glowObject.IsActive = true;
                }
                IsActive = false;
                break;
            }
        }
Esempio n. 2
0
        public void ResetTo(EHeldState newState)
        {
            if (MyBuff != null)
            {
                MyBuff.BuffHasExpired = true;
                MyBuff = null;
            }

            if (HeldState == newState)
            {
                return;
            }

            SetHeldState(newState);

            if (Holder == null)
            {
                ClearRange();
            }

            X = Zone.CalculPin((uint)HomePosition.X, true);
            Y = Zone.CalculPin((uint)HomePosition.Y, false);
            Z = HomePosition.Z;

            WorldPosition.X = HomePosition.X;
            WorldPosition.Y = HomePosition.Y;
            WorldPosition.Z = HomePosition.Z;

            SetOffset((ushort)(WorldPosition.X >> 12), (ushort)(WorldPosition.Y >> 12));

            Region.UpdateRange(this, true);

            OnResetAction?.Invoke(this);

            Holder = null;
        }