예제 #1
0
            protected override void OnTick()
            {
                if (m_BaseHenchman == null)
                {
                    Stop();
                    return;
                }

                if (m_BaseHenchman.Deleted || !m_BaseHenchman.Alive)
                {
                    Stop();
                    return;
                }

                if (!m_BaseHenchman.Recruitable)
                {
                    Stop();
                    return;
                }

                if (m_BaseHenchman.DecayExpiration <= DateTime.UtcNow && !m_BaseHenchman.Controlled && m_BaseHenchman.TimesTamed == 0)
                {
                    Stop();
                    m_BaseHenchman.Delete();

                    return;
                }
            }
예제 #2
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That must be in your backpack for you to use it.");
                return;
            }

            Type creatureType = GetCreatureType(m_Creature);

            if (creatureType == null)
            {
                return;
            }

            BaseHenchman henchman = (BaseHenchman)Activator.CreateInstance(creatureType);

            if (henchman == null)
            {
                return;
            }

            if (DateTime.UtcNow < player.LastCombatTime + CombatDelay)
            {
                DateTime cooldown = player.LastCombatTime + CombatDelay;

                string nextActivationAllowed = Utility.CreateTimeRemainingString(DateTime.UtcNow, cooldown, false, false, false, true, true);

                player.SendMessage("You have been in combat too recently and must wait another " + nextActivationAllowed + " before you may use this.");
                henchman.Delete();

                return;
            }

            if (DateTime.UtcNow < player.LastPlayerCombatTime + CombatPvPDelay)
            {
                DateTime cooldown = player.LastPlayerCombatTime + CombatPvPDelay;

                string nextActivationAllowed = Utility.CreateTimeRemainingString(DateTime.UtcNow, cooldown, false, false, false, true, true);

                player.SendMessage("You have been in combat with another player too recently and must wait another " + nextActivationAllowed + " before you may use this.");
                henchman.Delete();

                return;
            }

            if (player.Skills.Begging.Value < henchman.MinTameSkill)
            {
                player.SendMessage("You do not have the neccessary Begging skill required to create and command that creature.");
                henchman.Delete();

                return;
            }

            if (player.Skills.Camping.Value < henchman.MinTameSkill)
            {
                player.SendMessage("You do not have the neccessary Camping skill required to create and command that creature.");
                henchman.Delete();

                return;
            }

            if (player.Followers + henchman.ControlSlots > player.FollowersMax)
            {
                player.SendMessage("You must have " + henchman.ControlSlots.ToString() + " free control slots in order to create and control that creature.");
                henchman.Delete();

                return;
            }

            henchman.MoveToWorld(player.Location, player.Map);

            Timer.DelayCall(TimeSpan.FromSeconds(.1), delegate
            {
                if (player == null)
                {
                    return;
                }
                if (player.Deleted)
                {
                    return;
                }
                if (henchman == null)
                {
                    return;
                }
                if (henchman.Deleted)
                {
                    return;
                }

                henchman.Owners.Add(player);
                henchman.TimesTamed++;
                henchman.SetControlMaster(player);
                henchman.IsBonded               = true;
                henchman.OwnerAbandonTime       = DateTime.UtcNow + henchman.AbandonDelay;
                henchman.ResurrectionsRemaining = 2;

                henchman.Experience = Experience;

                if (henchman.recruitSpeech.Length > 0)
                {
                    henchman.Say(henchman.recruitSpeech[Utility.Random(henchman.recruitSpeech.Length - 1)]);
                }

                henchman.Hits = henchman.HitsMax;
                henchman.Stam = henchman.StamMax;
                henchman.Mana = henchman.ManaMax;

                henchman.PlaySound(henchman.GetIdleSound());

                player.SendMessage("You recruit the creature and they bond to you. They may be resurrected " + henchman.ResurrectionsRemaining.ToString() + " times before they fade from creation.");
            });

            Delete();
        }