예제 #1
0
        protected override void OnLockStateChanged(Lock @lock)
        {
            base.OnLockStateChanged(@lock);

            if (@lock is UnitLock u)
            {
                var player = u.Target as Player;
                player?.Session.CancelLogout();

                if (@lock.State == LockState.Locked)
                {
                    //  !!
                    //  this will enqueue primary, secondary, and will also fire if a primary is converted to secondary
                    //  !!

                    var npc = u.Target as Npc;

                    if (npc != null)
                    {
                        MissionHandler.EnqueueMissionEventInfo(new LockUnitEventInfo(this, npc, npc.CurrentPosition));
                        MissionHandler.SignalParticipationByLocking(npc.GetMissionGuid());
                    }
                }
            }

            if (@lock.State == LockState.Inprogress && EffectHandler.ContainsEffect(EffectType.effect_invulnerable))
            {
                EffectHandler.RemoveEffectsByType(EffectType.effect_invulnerable);
            }
        }
예제 #2
0
        public ErrorCodes CheckPvp()
        {
            var zone = Zone;

            Debug.Assert(zone != null);

            if (!HasPvpEffect && (zone.Configuration.Protected || EffectHandler.ContainsEffect(EffectType.effect_syndicate_area)))
            {
                return(ErrorCodes.PvpIsNotAllowed);
            }

            return(ErrorCodes.NoError);
        }
        public void ApplyCurrentEffect()
        {
            if (EffectHandler.ContainsEffect(CurrentEffectType))
            {
                return;
            }

            var builder = NewEffectBuilder().SetType(CurrentEffectType)
                          .SetOwnerToSource()
                          .EnableModifiers(false)
                          .WithTargetSelector(zone => GetTargetUnits());

            OnApplyEffect(builder);
            ApplyEffect(builder);
        }