Is there such a thing?
Post automatically merged:

C#:
using System;
using System;
using System.Collections.Generic;
using Server.Items;
using Server.Mobiles;
using Server.Network;
using Server.Factions;
using Server.Engines.Quests;

namespace Server.Items
{
    public class ChampionFlag : BaseDecayingItem
    {
     public const int OwnershipHue = 2166;
             public override int Lifespan { get { return 1800; } }
    
        [Constructable]
        public ChampionFlag()
            : base(0x1869)
        {
            this.Hue = 1157;
            this.Name = "Champion Idol";
            this.LootType = LootType.Cursed;
        }

        public ChampionFlag(Serial serial)
            : base(serial)
        {
        }

        public override double DefaultWeight
        {
            get
            {
                return 0.02;
            }
        }
        
        public override bool DropToWorld(Mobile from, Point3D p)
        {
            Delete();

            from.SendLocalizedMessage(500461); // You destroy the item.

            return true;
        }

        public override void GetProperties(ObjectPropertyList list)
        {
            base.GetProperties(list);

            list.Add(1075269); // Destroyed when dropped
        }
            
      
        private Mobile FindOwner(object parent)
        {
            if (parent is Item)
                return ((Item)parent).RootParent as Mobile;

            if (parent is Mobile)
                return (Mobile)parent;

            return null;
        }

         public override void OnAdded(object parent)
        {
            base.OnAdded(parent);

            Mobile mob = this.FindOwner(parent);

            if (mob != null)
                {
                mob.SolidHueOverride = OwnershipHue;
                mob.CriminalAction( true );
                mob.AddStatMod( new StatMod( StatType.Str, "Champion STR Flag Buff", 5, TimeSpan.FromMinutes( 0 ) ) );
                mob.AddStatMod( new StatMod( StatType.Int, "Champion INT Flag Buff", 5, TimeSpan.FromMinutes( 0 ) ) );
                mob.AddStatMod( new StatMod( StatType.Dex, "Champion DEX Flag Buff", 5, TimeSpan.FromMinutes( 0 ) ) );
                }
        }

        public override void OnRemoved(object parent)
        {
            base.OnRemoved(parent);
            {
            Mobile mob = this.FindOwner(parent);

            if (mob != null)
                mob.SolidHueOverride = -1;
            mob.AddStatMod( new StatMod( StatType.Str, "Champion STR Flag Buff", -5, TimeSpan.FromMinutes( 0 ) ) );
            mob.AddStatMod( new StatMod( StatType.Int, "Champion INT Flag Buff", -5, TimeSpan.FromMinutes( 0 ) ) );
            mob.AddStatMod( new StatMod( StatType.Dex, "Champion DEX Flag Buff", -5, TimeSpan.FromMinutes( 0 ) ) );
        }
        }
        

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }
}
Post automatically merged:

Is there a reason that once the person has the buff, stats can no longer be changed?
 
Last edited:
I don't quite understand your question.
TimeSpan.FromMinutes( 0 )
First problem is here, that all of your mods wont work, because you set effect timer = 0.
Next problem: you in both cases trying to add mods, when OnAdded methods need use AddStatMod and OnRemove - need use RemoveStatMod methods.


Fixed OnRemove method:
        public override void OnRemoved(object parent)
        {          
                Mobile mob = this.FindOwner(parent);

                if (mob != null)
                {
                    mob.SolidHueOverride = -1;));

                    mob.RemoveStatMod("Champion STR Flag Buff");
                    mob.RemoveStatMod("Champion INT Flag Buff");
                    mob.RemoveStatMod("Champion DEX Flag Buff");
                }

                 base.OnRemoved(parent);
        }
 
Back