RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RUO 2.0] (Command) Wipe Duplicate Items

Vorspire

Knight
[RUO 2.0] (Command) Wipe Duplicate Items


Information:
  • Provides an in-game command that can be used to wipe duplicate Items in the World.
  • Duplicate Items are Items of the same Type that have the same in-game Location and Map.
  • All messages associated with this command are logged to the command logs and are also displayed in the console window.
  • This command runs in it's own Thread, so if your server has a lot of items to check, the process won't interrupt Player's game-play.
  • Tested with an area of 10x10 tiles (200 MarbleFloor tiles on the same Z-axis) - 100 were successfully deleted with no error.

Automation:
  • This command also supports automation, you can use the [WipeDupesRepeater <double minutes> command to set the interval at which the wiping process starts.
  • The WipeDupesCMDRepeater class uses a default interval of 60.0 minutes.
  • Setting this value lower than 1.0 will disable the automated wipe process.

To initialize a manual wipe process, simply use the command [WipeDupes

Enjoy :)
 

Attachments

  • WipeDupes.cs
    9.2 KB · Views: 93
sounds great, will come in handy

2 questions
does it check for the possiblility of frozen items with duplicate over it?

does it ignore items that are part of an addon or in a house region? (incase a player places 2 chests right over each other or something stupid like that)
or in a pack, chest, etc also being stored?
 

Vorspire

Knight
It checks every single World Item on each Map.

The only requirements for an item to be classed as a duplicate are;
  • Item A Type == Item B Type
  • Item A Location == Item B Location
  • Item A Map == Item B Map

There is no advanced support for specific items.

If Location A Z-axis is 10 and Location B Z-axis is 11, the item will not be classed as a duplicate, so player's stacking items ontop of each other will not matter :)

It doesn't matter how many items are duplicated on a specific location, only one will remain after the wipe process.
 
but they can stack and use decorator to make same z

and in pack many many items are same x,y,z (is is almost always 0 in a pack/chest/etc)

may want to make an additional check that rootparententity == null and not in a house region
 

Vorspire

Knight
It is highly unlikely that this will happen, as the Item.Location variable is updated to reflect the location of the item within the Backpack.

However, there is still a chance it may happen, so I will update the script with these changes;
  • Items that are stored in Containers or Equipped will not be included in the wipe. This is based on Item.Parent being null.
  • Items created more recently than their dupes will not be included in the wipe. This is based on Serial.Value
  • Items within HouseRegions are not included in the wipe.
 

Vorspire

Knight
I would assume it works with both.

It depends on if the StaticItem class inherits the Item class. ( http://runuo.com/docs/types/Static.html )
It seems that it does inherit the Item class, so any unfrozen Static Items will definately be included in the wipe.

This system runs on the basis of the Item class.
 

Kamron

Knight
I dunno how I missed this one, but this is a great idea!

I haven't looked at it yet, but as I was reading I was visualizing using it similar to [batch so that arguments and restrictions could be placed on the items being searched for.

Any plans on something like this?
 

RavonTUS

Sorceror
Greetings,

I had problems with this script removing my custom "add-ons".

I'm usting Addon Generator by CEO 12OCT2007. Sorry, Vorspire, I don't have more info to help you troubleshoot it right now.

I will enclose a copy of my addon that was deleted and maybe it will help.

Code:
////////////////////////////////////////////////
//                                             //
// Automatically generated by the              //
// AddonGenerator script by Arya               //
//                                             //
/////////////////////////////////////////////////
using System;
using Server;
using Server.Items;

namespace Server.Items
{
	public class AG_WayGateNorthAddon : BaseAddon
	{
		public override BaseAddonDeed Deed
		{
			get
			{
				return new AG_WayGateNorthAddonDeed();
			}
		}

		[ Constructable ]
		public AG_WayGateNorthAddon()
		{
			AddonComponent ac;
			ac = new AddonComponent( 476 );
			AddComponent( ac, 0, 0, 0 );
			ac = new AddonComponent( 466 );
			AddComponent( ac, -1, 0, 0 );
			ac = new AddonComponent( 474 );
			AddComponent( ac, -1, 0, 15 );
			ac = new AddonComponent( 3255 );
			AddComponent( ac, -1, 1, 0 );
			ac = new AddonComponent( 6958 );
			AddComponent( ac, 0, 1, 0 );
			ac = new AddonComponent( 6961 );
			AddComponent( ac, -1, 1, 0 );
			ac = new AddonComponent( 6967 );
			AddComponent( ac, 0, 0, 0 );
			ac = new AddonComponent( 14201 );
			AddComponent( ac, 0, 0, 0 );
			ac = new AddonComponent( 477 );
			AddComponent( ac, 1, 0, 0 );
			ac = new AddonComponent( 481 );
			AddComponent( ac, 1, 1, 0 );
			ac = new AddonComponent( 480 );
			AddComponent( ac, 2, 0, 0 );
			ac = new AddonComponent( 9036 );
			AddComponent( ac, 2, 1, 0 );
			ac = new AddonComponent( 6955 );
			AddComponent( ac, 1, 1, 0 );
			ac = new AddonComponent( 6968 );
			AddComponent( ac, 1, 0, 0 );
			ac = new AddonComponent( 3025 );
			AddComponent( ac, 1, 1, 10 );

		}

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}

	public class AG_WayGateNorthAddonDeed : BaseAddonDeed
	{
		public override BaseAddon Addon
		{
			get
			{
				return new AG_WayGateNorthAddon();
			}
		}

		[Constructable]
		public AG_WayGateNorthAddonDeed()
		{
			Name = "AG_WayGateNorth";
		}

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void	Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}

-Ravon
 

Vorspire

Knight
RavonTUS;822900 said:
Greetings,

I had problems with this script removing my custom "add-ons".

I'm usting Addon Generator by CEO 12OCT2007. Sorry, Vorspire, I don't have more info to help you troubleshoot it right now.

I will enclose a copy of my addon that was deleted and maybe it will help.

Code:
////////////////////////////////////////////////
//                                             //
// Automatically generated by the              //
// AddonGenerator script by Arya               //
//                                             //
/////////////////////////////////////////////////
using System;
using Server;
using Server.Items;

namespace Server.Items
{
	public class AG_WayGateNorthAddon : BaseAddon
	{
		public override BaseAddonDeed Deed
		{
			get
			{
				return new AG_WayGateNorthAddonDeed();
			}
		}

		[ Constructable ]
		public AG_WayGateNorthAddon()
		{
			AddonComponent ac;
			ac = new AddonComponent( 476 );
			AddComponent( ac, 0, 0, 0 );
			ac = new AddonComponent( 466 );
			AddComponent( ac, -1, 0, 0 );
			ac = new AddonComponent( 474 );
			AddComponent( ac, -1, 0, 15 );
			ac = new AddonComponent( 3255 );
			AddComponent( ac, -1, 1, 0 );
			ac = new AddonComponent( 6958 );
			AddComponent( ac, 0, 1, 0 );
			ac = new AddonComponent( 6961 );
			AddComponent( ac, -1, 1, 0 );
			ac = new AddonComponent( 6967 );
			AddComponent( ac, 0, 0, 0 );
			ac = new AddonComponent( 14201 );
			AddComponent( ac, 0, 0, 0 );
			ac = new AddonComponent( 477 );
			AddComponent( ac, 1, 0, 0 );
			ac = new AddonComponent( 481 );
			AddComponent( ac, 1, 1, 0 );
			ac = new AddonComponent( 480 );
			AddComponent( ac, 2, 0, 0 );
			ac = new AddonComponent( 9036 );
			AddComponent( ac, 2, 1, 0 );
			ac = new AddonComponent( 6955 );
			AddComponent( ac, 1, 1, 0 );
			ac = new AddonComponent( 6968 );
			AddComponent( ac, 1, 0, 0 );
			ac = new AddonComponent( 3025 );
			AddComponent( ac, 1, 1, 10 );

		}

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}

	public class AG_WayGateNorthAddonDeed : BaseAddonDeed
	{
		public override BaseAddon Addon
		{
			get
			{
				return new AG_WayGateNorthAddon();
			}
		}

		[Constructable]
		public AG_WayGateNorthAddonDeed()
		{
			Name = "AG_WayGateNorth";
		}

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

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( 0 ); // Version
		}

		public override void	Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}

-Ravon

If your custom addons contain any Components that are duplicated, those Components will be included in the wipe unfortunately.
If you delete one Component of an Addon, it deletes the whole addon, so this may be the problem.
 

Shinaro

Sorceror
It doesn't work correctly

Fore some reason construction items are randomly wiped. Holes in flores, roofs and walls are the consequences.

 
Top