コード例 #1
0
        public override bool AddToWorld()
        {
            //foreman fogo doesn't leave the room.
            TetherRange = 1000;

            Position        = new Vector3(49293, 42208, 27562);
            Heading         = 2057;
            CurrentRegionID = 245;

            Flags = 0;

            Level = 56;
            Model = 2249; //undead Minotaur
            Name  = "Forge Foreman Fogo";
            Size  = 65;

            //get the relic by its ID, and lock it!
            Relic = MinotaurRelicManager.GetRelic(1);
            LockRelic();



            TempProperties.setProperty(ALREADY_GOT_HELP, false);

            return(base.AddToWorld());
        }
コード例 #2
0
ファイル: GameKeepGuard.cs プロジェクト: andyhebear/DOLSharp
        /// <summary>
        /// We only attack if we have LOS
        /// </summary>
        /// <param name="player"></param>
        /// <param name="response"></param>
        /// <param name="targetOID"></param>
        public void GuardStartAttackCheckLOS(GamePlayer player, ushort response, ushort targetOID)
        {
            lock (LOS_LOCK)
            {
                int count = TempProperties.getProperty <int>(NUM_LOS_CHECKS_INPROGRESS, 0);
                count--;
                TempProperties.setProperty(NUM_LOS_CHECKS_INPROGRESS, Math.Max(0, count));
            }

            if ((response & 0x100) == 0x100)
            {
                if (this is GuardArcher || this is GuardLord)
                {
                    if (ActiveWeaponSlot != eActiveWeaponSlot.Distance)
                    {
                        if (CanUseRanged)
                        {
                            SwitchToRanged(TargetObject);
                        }
                    }
                }

                base.StartAttack(TargetObject);
            }
            else if (TargetObject != null && TargetObject is GameLiving)
            {
                (this.Brain as KeepGuardBrain).RemoveFromAggroList(TargetObject as GameLiving);
            }
        }
コード例 #3
0
        public override void Delete()
        {
            if (HookPoint != null && Component != null)
            {
                Component.Keep.Guards.Remove(m_templateID);                 //Remove(this.ObjectID); LoadFromPosition() uses position.TemplateID as the insertion key
            }
            TempProperties.removeAllProperties();

            base.Delete();
        }
コード例 #4
0
ファイル: GameKeepGuard.cs プロジェクト: andyhebear/DOLSharp
        public override void Delete()
        {
            if (HookPoint != null && Component != null)
            {
                Component.AbstractKeep.Guards.Remove(this.ObjectID);
            }

            TempProperties.removeAllProperties();

            base.Delete();
        }
コード例 #5
0
        public override void Die(GameObject killer)
        {
            base.Die(killer);

            TempProperties.setProperty(ALREADY_GOT_HELP, false);

            //when the protector is dead, the relic should be unlocked!
            UnlockRelic();

            //another thing is that most of these mobs drop 1 time drops
            //i haven't added support for this, but someone will eventually.
        }
コード例 #6
0
        public void DeleteObject()
        {
            if (Component != null)
            {
                if (Component.Keep != null)
                {
                    string skey = m_dataObjectID;
                    if (Component.Keep.Guards.ContainsKey(skey))
                    {
                        Component.Keep.Guards.Remove(skey);
                    }
                    else if (log.IsWarnEnabled)
                    {
                        log.Warn($"Can't find {Position.ClassType} with dataObjectId {m_dataObjectID} in Component InternalID {Component.InternalID} Guard list.");
                    }
                }
                else if (log.IsWarnEnabled)
                {
                    log.Warn($"Keep is null on delete of guard {Name} with dataObjectId {m_dataObjectID}");
                }

                Component.Delete();
            }
            else if (log.IsWarnEnabled)
            {
                log.Warn($"Component is null on delete of guard {Name} with dataObjectId {m_dataObjectID}");
            }

            HookPoint = null;
            Component = null;
            if (Inventory != null)
            {
                Inventory.ClearInventory();
            }
            Inventory = null;
            Position  = null;
            TempProperties.removeAllProperties();

            base.Delete();

            SetOwnBrain(null);
            CurrentRegion = null;

            GameEventMgr.RemoveAllHandlersForObject(this);
        }
コード例 #7
0
        public override void StartAttack(GameObject target)
        {
            base.StartAttack(target);

            if (!TempProperties.getProperty <bool>(ALREADY_GOT_HELP))
            {
                foreach (GameNPC npc in GetNPCsInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    //on initial attack, all fireborn in range add!
                    if (npc.Name == "minotaur fireborn")
                    {
                        npc.StartAttack(target);
                    }
                }

                TempProperties.setProperty(ALREADY_GOT_HELP, true);
            }
        }
コード例 #8
0
        public void DeleteObject()
        {
            if (Component != null)
            {
                if (Component.AbstractKeep != null)
                {
                    if (Component.AbstractKeep.Guards.ContainsKey(m_dataObjectID))
                    {
                        Component.AbstractKeep.Guards.Remove(m_dataObjectID);
                    }
                    else
                    {
                        log.Warn("Can't find " + Name + " in Component Guard list.");
                    }
                }
                else
                {
                    log.Warn("Keep is null on delete of guard " + Name + ".");
                }

                Component.Delete();
            }

            HookPoint = null;
            Component = null;
            if (Inventory != null)
            {
                Inventory.ClearInventory();
            }

            Inventory = null;
            Position  = null;
            TempProperties.removeAllProperties();

            base.Delete();

            SetOwnBrain(null);
            CurrentRegion = null;

            GameEventMgr.RemoveAllHandlersForObject(this);
        }
コード例 #9
0
        public override bool AddToWorld()
        {
            // foreman fogo doesn't leave the room.
            TetherRange     = 1000;
            X               = 49293;
            Y               = 42208;
            Z               = 27562;
            Heading         = 2057;
            CurrentRegionID = 245;
            Flags           = 0;
            Level           = 56;
            Model           = 2249; // undead Minotaur
            Name            = "Forge Foreman Fogo";
            Size            = 65;

            // get the relic by its ID, and lock it!
            Relic = MinotaurRelicManager.GetRelic(1);
            LockRelic();

            TempProperties.setProperty(AlreadyGotHelp, false);

            return(base.AddToWorld());
        }
コード例 #10
0
ファイル: GameKeepGuard.cs プロジェクト: andyhebear/DOLSharp
        /// <summary>
        /// Override for StartAttack which chooses Ranged or Melee attack
        /// </summary>
        /// <param name="attackTarget"></param>
        public override void StartAttack(GameObject attackTarget)
        {
            if (IsPortalKeepGuard)
            {
                base.StartAttack(attackTarget);
                return;
            }

            if (AttackState || CurrentSpellHandler != null)
            {
                return;
            }

            if (attackTarget is GameLiving == false)
            {
                return;
            }
            GameLiving target = attackTarget as GameLiving;

            if (target == null || target.IsAlive == false)
            {
                return;
            }

            //we dont send LOS checks for people we cant attack
            if (!GameServer.ServerRules.IsAllowedToAttack(this, target, true))
            {
                return;
            }

            //Prevent spam for LOS to same target multiple times

            GameObject lastTarget = (GameObject)this.TempProperties.getProperty <object>(LAST_LOS_TARGET_PROPERTY, null);
            long       lastTick   = this.TempProperties.getProperty <long>(LAST_LOS_TICK_PROPERTY);

            if (lastTarget != null && lastTarget == attackTarget)
            {
                if (lastTick != 0 && CurrentRegion.Time - lastTick < ServerProperties.Properties.KEEP_GUARD_LOS_CHECK_TIME * 1000)
                {
                    return;
                }
            }

            GamePlayer LOSChecker = null;

            if (attackTarget is GamePlayer)
            {
                LOSChecker = attackTarget as GamePlayer;
            }
            else if (attackTarget is GameNPC && (attackTarget as GameNPC).Brain is IControlledBrain)
            {
                LOSChecker = ((attackTarget as GameNPC).Brain as IControlledBrain).GetPlayerOwner();
            }
            else
            {
                // try to find another player to use for checking line of site
                foreach (GamePlayer player in this.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE))
                {
                    LOSChecker = player;
                    break;
                }
            }

            if (LOSChecker == null)
            {
                return;
            }

            lock (LOS_LOCK)
            {
                int count = TempProperties.getProperty <int>(NUM_LOS_CHECKS_INPROGRESS, 0);

                if (count > 10)
                {
                    log.DebugFormat("{0} LOS count check exceeds 10, aborting LOS check!", Name);

                    // Now do a safety check.  If it's been a while since we sent any check we should clear count
                    if (lastTick == 0 || CurrentRegion.Time - lastTick > ServerProperties.Properties.LOS_PLAYER_CHECK_FREQUENCY * 1000)
                    {
                        log.Debug("LOS count reset!");
                        TempProperties.setProperty(NUM_LOS_CHECKS_INPROGRESS, 0);
                    }

                    return;
                }

                count++;
                TempProperties.setProperty(NUM_LOS_CHECKS_INPROGRESS, count);

                TempProperties.setProperty(LAST_LOS_TARGET_PROPERTY, attackTarget);
                TempProperties.setProperty(LAST_LOS_TICK_PROPERTY, CurrentRegion.Time);
                TargetObject = attackTarget;
            }

            LOSChecker.Out.SendCheckLOS(this, attackTarget, new CheckLOSResponse(this.GuardStartAttackCheckLOS));
        }