decay rates

thecapitan2003

Well-Known Member
Jul 14, 2014
58
4
41
Shard Name
bigdaddy's world
i am trying to set items so nothing decays how would i go about doing this?
 

Tasanar

Moderator
ServUO Developer
Oct 16, 2014
4,546
123
32
trueuo.com
Shard Name
Heritage
Donate
Donate money to this user
Will take a core item.

From just doing a quick search this seems like a promising place to start.

Looking in Items.cs in the Server file

Code:
private static TimeSpan m_DDT = TimeSpan.FromHours(1.0);

        public static TimeSpan DefaultDecayTime { get { return m_DDT; } set { m_DDT = value; } }

        [CommandProperty(AccessLevel.Decorator)]
        public virtual TimeSpan DecayTime { get { return m_DDT; } }

        [CommandProperty(AccessLevel.Decorator)]
        public virtual bool Decays
        {
            get
            {
                // TODO: Make item decay an option on the spawner
                return (Movable && Visible /* && Spawner == null*/);
            }
        }
 

Tasanar

Moderator
ServUO Developer
Oct 16, 2014
4,546
123
32
trueuo.com
Shard Name
Heritage
Donate
Donate money to this user
So based on this basic items are set to decay after 1 hour of being discarded.
 

Tasanar

Moderator
ServUO Developer
Oct 16, 2014
4,546
123
32
trueuo.com
Shard Name
Heritage
Donate
Donate money to this user
Yeah there may be other ways to return a value of never but not quite sure.
 

PyrO

Well-Known Member
Jan 27, 2015
1,152
92
I think setting the decay this way should solve it
Code:
[CommandProperty(AccessLevel.Decorator)]
public virtual bool Decays
{
	get
	{
		return false;
	}
}
 
  • Like
Reactions: IanE

thecapitan2003

Well-Known Member
Jul 14, 2014
58
4
41
Shard Name
bigdaddy's world
I think setting the decay this way should solve it
Code:
[CommandProperty(AccessLevel.Decorator)]
public virtual bool Decays
{
	get
	{
		return false;
	}
}
thnx so i just put that instead of the calc that is in the file...ill try it tonight, my server is a lan shard i only play with my kids so i dont worry about item counts.....
 

Lokai

Moderator
ServUO Developer
Dec 4, 2014
1,265
211
Western New York State
Shard Name
Test Center
Donate
Donate money to this user
Some notes about this idea.

1. If you change Item.cs, it will affect every item in the world. (see below for exceptions)
2. If you change Item.cs, you will need to recompile your server before continuing. (run the .BAT file)
3. If you change Item.cs, you might NOT actually affect EVERY item in the world, if that item overrides the same method.

Meaning, in Item.cs, it is "public virtual bool Decays { get { return Visible && Movable; } }" You can change that to "... { get { return false; } }"

However, let's say there is an item someone created, and they wanted to make sure it would decay even if it was invisible.

It might say this:

Code:
public override bool Decays { get { return Movable; } }
This would override your setting in item.cs. You could do a Search through the code for the words "public override bool Decays" and see if any scripts override it, and change each one manually.