public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (m_Player != null)
            {
                if (m_Player != player)
                {
                    from.SendMessage("That item may only be used by " + m_Player.Name + ".");
                    return;
                }
            }

            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.UndeadUpgradePoints, 1, true);
            player.SendSound(UOACZSystem.earnCorruptionSound);

            UOACZSystem.RefreshAllGumps(player);

            Delete();
        }
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            if (!UOACZPersistance.Enabled)
            {
                from.SendMessage("UOACZ system currently disabled.");
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (m_Player != null)
            {
                Account ownerAccount  = m_Player.Account as Account;
                Account playerAccount = player.Account as Account;

                if (ownerAccount != null && playerAccount != null && ownerAccount != playerAccount)
                {
                    from.SendMessage("That item may only be used by " + m_Player.Name + ".");
                    return;
                }
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            UOACZSystem.ChangeStat(player, UOACZSystem.UOACZStatType.SurvivalPoints, 1, true);
            player.SendSound(UOACZSystem.earnSurvivalSound);

            UOACZSystem.RefreshAllGumps(player);

            Delete();
        }
Beispiel #3
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);

            PlayerMobile player = from as PlayerMobile;

            if (player == null)
            {
                return;
            }

            UOACZPersistance.CheckAndCreateUOACZAccountEntry(player);

            if (!UOACZSystem.IsUOACZValidMobile(player))
            {
                return;
            }

            if (player.IsUOACZHuman)
            {
                player.SendMessage("You decide against consuming this.");
                return;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendMessage("That item must be in your pack in order to use it.");
                return;
            }

            if (DateTime.UtcNow < player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed)
            {
                string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed, false, false, false, true, true);
                player.SendMessage("You may not use another undead item for " + timeRemaining + ".");

                return;
            }

            player.m_UOACZAccountEntry.UndeadProfile.NextUndeadItemAllowed = DateTime.UtcNow + TimeSpan.FromSeconds(UOACZSystem.UndeadItemCooldownSeconds);

            player.PlaySound(Utility.RandomList(0x5DA, 0x5A9, 0x5AB, 0x03A, 0x03B, 0x03C));

            TypeOfBrain brainType = m_BrainType;

            Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate
            {
                switch (brainType)
                {
                case TypeOfBrain.Healing:
                    int hitsRegained = (int)(Math.Round((double)player.HitsMax * .33));
                    player.Heal(hitsRegained);

                    player.FixedParticles(0x376A, 9, 32, 5030, 0, 0, EffectLayer.Waist);
                    player.PlaySound(0x202);
                    break;

                case TypeOfBrain.Mana:
                    int manaRegained = (int)(Math.Round((double)player.ManaMax * .66));
                    player.Mana     += manaRegained;

                    player.FixedParticles(0x376A, 9, 32, 5030, 1364, 0, EffectLayer.Waist);
                    player.PlaySound(0x1EB);
                    break;

                case TypeOfBrain.SwarmHeal:
                    Queue m_Queue = new Queue();

                    foreach (BaseCreature follower in player.AllFollowers)
                    {
                        if (!UOACZSystem.IsUOACZValidMobile(follower))
                        {
                            continue;
                        }
                        if (Utility.GetDistance(player.Location, follower.Location) > 12)
                        {
                            continue;
                        }
                        if (follower.Hits == follower.HitsMax)
                        {
                            continue;
                        }

                        m_Queue.Enqueue(follower);
                    }

                    while (m_Queue.Count > 0)
                    {
                        BaseCreature follower = (BaseCreature)m_Queue.Dequeue();

                        int healingAmount = (int)(Math.Round((double)follower.HitsMax * .25));

                        follower.Heal(healingAmount);

                        follower.FixedParticles(0x376A, 9, 32, 5030, 0, 0, EffectLayer.Waist);
                        follower.PlaySound(0x202);
                    }
                    break;

                case TypeOfBrain.CooldownReduction:
                    player.FixedParticles(0x373A, 10, 15, 5036, EffectLayer.Head);
                    player.PlaySound(0x3BD);

                    foreach (UOACZUndeadAbilityEntry abilityEntry in player.m_UOACZAccountEntry.UndeadProfile.m_Abilities)
                    {
                        DateTime cooldown = abilityEntry.m_NextUsageAllowed;

                        double cooldownReduction = abilityEntry.m_CooldownMinutes * .20;

                        abilityEntry.m_NextUsageAllowed = abilityEntry.m_NextUsageAllowed.Subtract(TimeSpan.FromMinutes(cooldownReduction));
                    }

                    UOACZSystem.RefreshAllGumps(player);
                    break;
                }
            });

            Delete();
        }