示例#1
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (m_Deed.Deleted || m_Deed.RootParent != from)
                {
                    return;
                }

                PlayerMobile pm_From = from as PlayerMobile;

                if (pm_From == null)
                {
                    return;
                }

                if (!m_Deed.IsChildOf(pm_From.Backpack))
                {
                    pm_From.SendMessage("The henchman recruitment deed is no longer in your backpack.");
                    return;
                }

                BaseHenchman henchman = target as BaseHenchman;

                if (henchman != null)
                {
                    if (henchman.Deleted || !henchman.Alive)
                    {
                        return;
                    }

                    if (!henchman.Recruitable)
                    {
                        pm_From.SendMessage("That individual can not be recruited in this manner.");
                        return;
                    }

                    if (henchman.Controlled)
                    {
                        pm_From.SendMessage("That individual already has an employer.");
                        return;
                    }

                    if (pm_From.Skills.Begging.Value < henchman.MinTameSkill)
                    {
                        pm_From.SendMessage("You do not have the neccessary Begging skill required to recruit and command that individual.");
                        return;
                    }

                    if (pm_From.Skills.Camping.Value < henchman.MinTameSkill)
                    {
                        pm_From.SendMessage("You do not have the neccessary Camping skill required to recruit and command that individual.");
                        return;
                    }

                    if (pm_From.Followers + henchman.ControlSlots > pm_From.FollowersMax)
                    {
                        pm_From.SendMessage("You do not have enough control slots available to recruit that individual.");
                        return;
                    }

                    if (henchman.ControlSlots > m_Deed.SlotsRemaining)
                    {
                        pm_From.SendMessage("This deed does not have enough control slots remaining to recruit that individual.");
                        return;
                    }

                    if (henchman.m_XMLSpawner != null)
                    {
                        if (!henchman.m_XMLSpawner.Deleted && henchman.m_XMLSpawner.InfluenceMarker != null)
                        {
                            if (!henchman.m_XMLSpawner.InfluenceMarker.Deleted)
                            {
                                InfluenceMarker influenceMarker = henchman.m_XMLSpawner.InfluenceMarker;

                                int prestigeLevel   = 0;
                                int investmentLevel = 0;

                                influenceMarker.GetPlayerLevels(pm_From, out prestigeLevel, out investmentLevel);

                                if (prestigeLevel + investmentLevel < 5)
                                {
                                    pm_From.SendMessage("You must have at least 5 total Influence at this building in order to recruit individuals here. You may increase your Influence in this building through accessing the building's influence marker.");
                                    return;
                                }
                            }
                        }
                    }

                    henchman.Blessed = false;

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

                    henchman.Experience = m_Deed.m_Experience;

                    henchman.Animate(33, 5, 1, true, false, 0);

                    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.Animate(33, 5, 1, true, false, 0);

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

                    m_Deed.m_SlotsRemaining -= henchman.ControlSlots;

                    if (m_Deed.m_SlotsRemaining <= 0)
                    {
                        m_Deed.Delete();
                    }
                }

                else
                {
                    pm_From.SendMessage("That is not a recruitable individual.");
                    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();
        }