Exemple #1
0
 public static void OnLogin(LoginEventArgs e)
 {
     if (e.Mobile is PlayerMobile pm)
     {
         Timer.DelayCall(() => Caddellite.UpdateBuff(pm));
     }
 }
Exemple #2
0
        public static void UpdateBuff(Mobile m)
        {
            BaseCreature pet      = KhaldunTastyTreat.GetPetUnderEffects(m);
            Caddellite   equipped = null;
            var          item     = m.FindItemOnLayer(Layer.TwoHanded);

            if (item == null)
            {
                item = m.FindItemOnLayer(Layer.OneHanded);
            }

            if (item != null)
            {
                equipped = item.GetSocket <Caddellite>();
            }

            if (equipped == null && pet == null)
            {
                BuffInfo.RemoveBuff(m, BuffIcon.CaddelliteInfused);
            }
            else
            {
                BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.CaddelliteInfused, 1158662, 1158677,
                                                 String.Format("{0}\t{1}\t{2}\t{3}", equipped != null && equipped.Owner is BaseWeapon ? "100" : "0", equipped != null && equipped.Owner is Spellbook ? "100" : "0", pet != null ? pet.Name : "", pet != null ? "100" : "0")));
            }
        }
Exemple #3
0
        public static void OnLogin(LoginEventArgs e)
        {
            PlayerMobile pm = e.Mobile as PlayerMobile;

            if (pm != null)
            {
                Timer.DelayCall(() => Caddellite.UpdateBuff(pm));
            }
        }
Exemple #4
0
        public static void RemoveInfluence(BaseCreature bc)
        {
            if (Table != null && Table.ContainsKey(bc))
            {
                Table.Remove(bc);

                if (bc.ControlMaster != null)
                {
                    bc.ControlMaster.SendLocalizedMessage(1158687); // Your pet is no longer Caddellite infused.

                    Caddellite.UpdateBuff(bc.ControlMaster);
                }

                if (Table.Count == 0)
                {
                    Table = null;
                }
            }
        }
Exemple #5
0
        public override void OnAdded(object parent)
        {
            if (parent is Mobile)
            {
                Mobile from = (Mobile)parent;

                m_AosSkillBonuses.AddTo(from);

                int strBonus = m_AosAttributes.BonusStr;
                int dexBonus = m_AosAttributes.BonusDex;
                int intBonus = m_AosAttributes.BonusInt;

                if (strBonus != 0 || dexBonus != 0 || intBonus != 0)
                {
                    string modName = Serial.ToString();

                    if (strBonus != 0)
                    {
                        from.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
                    }

                    if (dexBonus != 0)
                    {
                        from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
                    }

                    if (intBonus != 0)
                    {
                        from.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
                    }
                }

                if (HasSocket <Caddellite>())
                {
                    Caddellite.UpdateBuff(from);
                }

                from.CheckStatTimers();
            }
        }
Exemple #6
0
        public override void OnRemoved(object parent)
        {
            if (parent is Mobile)
            {
                Mobile from = (Mobile)parent;

                m_AosSkillBonuses.Remove();

                if (HasSocket <Caddellite>())
                {
                    Caddellite.UpdateBuff(from);
                }

                string modName = Serial.ToString();

                from.RemoveStatMod(modName + "Str");
                from.RemoveStatMod(modName + "Dex");
                from.RemoveStatMod(modName + "Int");

                from.CheckStatTimers();
            }
        }
Exemple #7
0
        public bool DoEffects(Mobile owner, BaseCreature bc)
        {
            owner.SendLocalizedMessage(1158685); // Your pet is now Caddellite infused by this treat.

            bc.PlaySound(0x1EA);
            bc.FixedParticles(0x373A, 10, 15, 5018, EffectLayer.Waist);

            bc.Loyalty = BaseCreature.MaxLoyalty;

            if (Table == null)
            {
                Table = new Dictionary <BaseCreature, DateTime>();
            }

            Table.Add(bc, DateTime.UtcNow + TimeSpan.FromHours(1));
            Timer.DelayCall(TimeSpan.FromHours(Duration), RemoveInfluence, bc);

            Caddellite.UpdateBuff(owner);

            Consume();
            return(true);
        }
Exemple #8
0
        public virtual void Fill_OnTarget(Mobile from, object targ)
        {
            if (!IsEmpty || !Fillable || !ValidateUse(from, false))
            {
                return;
            }

            if (targ is BaseBeverage)
            {
                BaseBeverage bev = (BaseBeverage)targ;

                if (bev.IsEmpty || !bev.ValidateUse(from, true))
                {
                    return;
                }

                Content  = bev.Content;
                Poison   = bev.Poison;
                Poisoner = bev.Poisoner;

                if (bev.Quantity > MaxQuantity)
                {
                    Quantity      = MaxQuantity;
                    bev.Quantity -= MaxQuantity;
                }
                else
                {
                    Quantity    += bev.Quantity;
                    bev.Quantity = 0;
                }
            }
            else if (targ is BaseWaterContainer)
            {
                BaseWaterContainer bwc = targ as BaseWaterContainer;

                if (Quantity == 0 || (Content == BeverageType.Water && !IsFull))
                {
                    Content = BeverageType.Water;

                    int iNeed = Math.Min((MaxQuantity - Quantity), bwc.Quantity);

                    if (iNeed > 0 && !bwc.IsEmpty && !IsFull)
                    {
                        bwc.Quantity -= iNeed;
                        Quantity     += iNeed;

                        from.PlaySound(0x4E);
                    }
                }
            }
            else if (targ is Item)
            {
                Item         item = (Item)targ;
                IWaterSource src;

                src = (item as IWaterSource);

                if (src == null && item is AddonComponent)
                {
                    src = (((AddonComponent)item).Addon as IWaterSource);
                }

                if (src == null || src.Quantity <= 0)
                {
                    if (item.ItemID >= 0xB41 && item.ItemID <= 0xB44)
                    {
                        Caddellite.CheckWaterSource(from, this, item);
                    }

                    return;
                }

                if (from.Map != item.Map || !from.InRange(item.GetWorldLocation(), 2) || !from.InLOS(item))
                {
                    from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
                    return;
                }

                Content  = BeverageType.Water;
                Poison   = null;
                Poisoner = null;

                if (src.Quantity > MaxQuantity)
                {
                    Quantity      = MaxQuantity;
                    src.Quantity -= MaxQuantity;
                }
                else
                {
                    Quantity    += src.Quantity;
                    src.Quantity = 0;
                }

                if (!(src is WaterContainerComponent))
                {
                    from.SendLocalizedMessage(1010089); // You fill the container with water.
                }
            }
            else if (targ is Cow)
            {
                Cow cow = (Cow)targ;

                if (cow.TryMilk(from))
                {
                    Content  = BeverageType.Milk;
                    Quantity = MaxQuantity;
                    from.SendLocalizedMessage(1080197); // You fill the container with milk.
                }
            }
            else if (targ is LandTarget)
            {
                int tileID = ((LandTarget)targ).TileID;

                PlayerMobile player = from as PlayerMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (qs is WitchApprenticeQuest)
                    {
                        FindIngredientObjective obj = qs.FindObjective(typeof(FindIngredientObjective)) as FindIngredientObjective;

                        if (obj != null && !obj.Completed && obj.Ingredient == Ingredient.SwampWater)
                        {
                            bool contains = false;

                            for (int i = 0; !contains && i < m_SwampTiles.Length; i += 2)
                            {
                                contains = (tileID >= m_SwampTiles[i] && tileID <= m_SwampTiles[i + 1]);
                            }

                            if (contains)
                            {
                                Delete();

                                player.SendLocalizedMessage(1055035); // You dip the container into the disgusting swamp water, collecting enough for the Hag's vile stew.
                                obj.Complete();
                            }
                        }
                    }
                }
            }
        }