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!

[RunUO 2.0 RC1] Xanthos Shrink System

Reddwulf

Wanderer
Awesome man, totally awesome. I am new at the runuo thing, I got my world working and have very few custom scripts in place. I put this in with the utilities like it says, and it worked perfectly. So nice job, Im gonna try evo next.

Reddwulf
 

Devinc07

Sorceror
i need some help. i downloaded the file but for some reason when i unzip it i am not getting anything? idk whats going on. i just downloaded the .rar file of the utilities from an earlier post in this thread and got everything from that unlike when i downloaded the .zip fill of utilites. can anyone put the file on here in a .rar file possibly? thank you for your help
I got it from another thread. took a while but wanted to let yall know. don't need to post as a rar on here.
 

Paradyme

Page
Hiya, i have a shrink potion script that is quite old and was wondering how i can update it so it uses this shrinking method?

Here is the code:

Code:
using System;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
using Server.Network;
using Server;
namespace Server.Items
{
	public class ShrinkPotion : BasePotion
	{

		#region Constructors
		public ShrinkPotion( Serial serial ) : base( serial )
		{
		}
		[Constructable]
		public ShrinkPotion() : base( 0xF09, PotionEffect.Shrink )
		{
			Name="shrink potion";
			Hue = 2315;
		}
		#endregion

		public override void Drink( Mobile from )  //OnDoubleClick( Mobile from )
		{
			if ( !Movable )
				return;
			else if( from.InRange( this.GetWorldLocation(), 2 ) == false )
			{
				from.SendLocalizedMessage( 500486 );	//That is too far away.
				return;
			}

			Container pack = from.Backpack;

			if ( !(Parent == from || ( pack != null && Parent == pack )) ) //If not in pack.
			{
				from.SendLocalizedMessage( 1042001 );	//That must be in your pack to use it.
				return;
			}
			from.Target=new ShrinkPotionTarget( this );
			from.SendMessage( "What do you wish to shrink?" );
		}


		private class ShrinkPotionTarget : Target
		{
			private ShrinkPotion m_Potion;

			public ShrinkPotionTarget( Item i ) : base( 3, false, TargetFlags.None )
			{
				m_Potion=(ShrinkPotion)i;
			}
			
			protected override void OnTarget( Mobile from, object targ )
			{
				if ( !(m_Potion.Deleted) )
				{
					if ( ShrinkFunctions.Shrink( from, targ ) )
					{
BasePotion.PlayDrinkEffect( from );
						m_Potion.Consume();
					}
				}

				return;
			}
		}


		#region Serialization
		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();
		} 
		#endregion
	}
}

Currently ive had to include both systems so i can serialize my save, but i would like to eventually be able to remove the old system and replace it with this.
 

ironworker

Sorceror
Hello , wondering if someone could place the Pet Leash script for me plz. i would like to give the Xanthos Shrink system a try. thnx
 

tass23

Page
Hi Xanthos,
Love the script, I've used it on other free shards before. I'm trying to add it to the shard I have now, but I'm running into some compiling errors. Can you, or anyone else give me a hand here:

Errors:
+Customs/Xanthos/Shrink System/ShrinkCommand.cs
CS1502: Line 141: The best overloaded method match for 'Server.ISpawner.Remove<Server.ISpawnable>' has some invalid arguments
CS1503: Line 141: Argument '1' : cannot convert from 'Xanthos.ShrinkSystem.ShrinkTarget' to 'Server.ISpawnable'

I'm using the only free shard configuration I could get to work, SA-Project svn. If I'm not a complete idiot, and that IS possible, the ISpawner its referring to is from one, or both of the Spawners I'm using; XML Spawner2 and Mega Spawner. Thanks in advance for any help on this.

Edit: Somehow.....some way....when I installed your Evo Pet package, it corrected this problem. Strange, but hey, it's working! I'm still getting pets that say "A shrunken pet" and half of them are solid black, but changing the IDs in shrink.cfg and such should fix that.
 

tass23

Page
Well I made the changes in the proper places, but it didn't help. Pet are still showing up as "A shrunken pet" with no stats, other than the weight, and half of them are solid black when shrunk. I tried dding the body ID to the shrink.cfg file, but it didn't help. An example of this issue is with Hiryus that are colored, all of them turn solid black when shrunk.
Here is the ShrinkItem.cs
Code:
#region AuthorHeader
//
// Shrink System version 2.0, by Xanthos
//
//
#endregion AuthorHeader
using System;
using Server;
using Server.Items;
using Server.Mobiles;
using Server.Targeting;
using System.Collections;
using System.Collections.Generic;
using Server.ContextMenus;
using Xanthos.Utilities;
using Xanthos.Interfaces;
using Server.Regions;
namespace Xanthos.ShrinkSystem
{
 public class ShrinkItem : Item, IShrinkItem
 {
  // Persisted
  private bool m_IsStatuette;
  private bool m_Locked;
  private Mobile m_Owner;
  private BaseCreature m_Pet;
  // Not persisted; lazy loaded.
  private bool m_PropsLoaded;
  private string m_Breed;
  private string m_Gender;
  private bool m_IsBonded;
  private string m_Name;
  private int m_RawStr;
  private int m_RawDex;
  private int m_RawInt;
  private double m_Wrestling;
  private double m_Tactics;
  private double m_Anatomy;
  private double m_Poisoning;
  private double m_Magery;
  private double m_EvalInt;
  private double m_MagicResist;
  private double m_Meditation;
  private double m_Archery;
  private double m_Fencing;
  private double m_Macing;
  private double m_Swords;
  private double m_Parry;
  private int m_EvoEp;
  private int m_EvoStage;
  private bool m_IgnoreLockDown; // Is only ever changed by staff
  [CommandProperty( AccessLevel.GameMaster )]
  public bool IsStatuette
  {
   get { return m_IsStatuette; }
   set
   {
    if ( null == ShrunkenPet )
    {
     ItemID = 0xFAA;
     Name = "unlinked shrink item!";
    }
    else if ( m_IsStatuette = value )
    {
     ItemID = ShrinkTable.Lookup( m_Pet );
     Name = m_Name + "a shrunken pet";
    }
    else
    {
     ItemID = 0x14EF;
     Name = "a pet deed";
    }
   }
  }
  [CommandProperty( AccessLevel.GameMaster )]
  public bool IgnoreLockDown
  {
   get { return m_IgnoreLockDown; }
   set { m_IgnoreLockDown = value; InvalidateProperties(); }
  }
  [CommandProperty( AccessLevel.GameMaster )]
  public bool Locked
  {
   get { return m_Locked; }
   set { m_Locked = value; InvalidateProperties(); }
  }
  [CommandProperty( AccessLevel.GameMaster )]
  public Mobile Owner
  {
   get { return m_Owner; }
   set { m_Owner = value; InvalidateProperties(); }
  }
  [CommandProperty( AccessLevel.GameMaster )]
  public BaseCreature ShrunkenPet
  {
   get { return m_Pet; }
   set { m_Pet = value; InvalidateProperties(); }
  }
  public ShrinkItem() : base()
  {
  }
  public ShrinkItem( Serial serial ) : base( serial )
  {
  }
  public ShrinkItem( BaseCreature pet ) : this()
  {
   ShrinkPet( pet );
   IsStatuette = ShrinkConfig.PetAsStatuette;
   m_IgnoreLockDown = false; // This is only used to allow GMs to bypass the lockdown, one pet at a time.
   Weight = ShrinkConfig.ShrunkenWeight;
   if ( !(m_Pet is IEvoCreature) || ((IEvoCreature)m_Pet).CanHue )
    Hue = m_Pet.Hue;
  }
  public override void OnDoubleClick( Mobile from )
  {
   if ( !m_PropsLoaded )
    PreloadProperties();
   if ( !IsChildOf( from.Backpack ) )
    from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
   else if ( m_Pet == null || m_Pet.Deleted || ItemID == 0xFAA )
    from.SendMessage( "Due to unforseen circumstances your pet is lost forever." );
   else if ( m_Locked && m_Owner != from )
   {
    from.SendMessage( "This is locked and only the owner can claim this pet while locked." );
    from.SendMessage( "This item is now being returned to its owner." );
    m_Owner.AddToBackpack( this );
    m_Owner.SendMessage( "Your pet {0} has been returned to you because it was locked and {1} was trying to claim it.", m_Breed, from.Name );
   }
   else if ( from.Followers + m_Pet.ControlSlots > from.FollowersMax )
    from.SendMessage( "You have to many followers to claim this pet." );
   else if ( Server.Spells.SpellHelper.CheckCombat( from ) )
    from.SendMessage( "You cannot reclaim your pet while your fighting." );
   else if ( ShrinkCommands.LockDown == true && !m_IgnoreLockDown )
    from.SendMessage( 54, "The server is on a shrinkitem lockdown. You cannot unshrink your pet at this time." );
   else if ( !m_Pet.CanBeControlledBy( from ))
    from.SendMessage( "You do not have the required skills to control this pet.");
   else
    UnshrinkPet( from );
  }
  private void ShrinkPet( BaseCreature pet )
  {
   m_Pet = pet;
   m_Owner = pet.ControlMaster;
    
   if ( ShrinkConfig.LootStatus == ShrinkConfig.BlessStatus.All
    || ( m_Pet.IsBonded && ShrinkConfig.LootStatus == ShrinkConfig.BlessStatus.BondedOnly ))
    LootType = LootType.Blessed;
   else
    LootType = LootType.Regular;
   m_Pet.Internalize();
   m_Pet.SetControlMaster( null );
   m_Pet.ControlOrder = OrderType.Stay;
   m_Pet.SummonMaster = null;
   m_Pet.IsStabled = true;
   if ( pet is IEvoCreature )
    ((IEvoCreature)m_Pet).OnShrink( this );
  }
  private void UnshrinkPet( Mobile from )
  {
   m_Pet.SetControlMaster( from );
   m_Pet.IsStabled = false;
   m_Pet.MoveToWorld( from.Location, from.Map );
   if ( from != m_Owner )
    m_Pet.IsBonded = false;
   m_Pet = null;
   this.Delete();
  }
  // Summoning ball was used so dispose of the shrink item
  public void OnPetSummoned()
  {
   m_Pet = null;
   Delete();
  }
  public override void Delete()
  {
   if ( m_Pet != null ) // Don't orphan pets on the internal map
    m_Pet.Delete();
   base.Delete();
  }
  public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
  {
   base.GetContextMenuEntries( from, list );
   if (( ShrinkConfig.AllowLocking || m_Locked == true ) && from.Alive && m_Owner == from )
   {
    if ( m_Locked == false )
     list.Add( new LockShrinkItem( from, this ) );
    else
     list.Add( new UnLockShrinkItem( from, this ) );
   }
  }
  public override void AddNameProperties( ObjectPropertyList list )
  {
   base.AddNameProperties( list );
   if ( null == m_Pet || m_Pet.Deleted )
    return;
   if ( !m_PropsLoaded )
    PreloadProperties();
   if ( m_IsBonded && ShrinkConfig.BlessStatus.None == ShrinkConfig.LootStatus ) // Only show bonded when the item is not blessed
    list.Add( 1049608 );
   if ( ShrinkConfig.AllowLocking || m_Locked ) // Only show lock status when locking enabled or already locked
    list.Add( 1049644, ( m_Locked == true ) ? "Locked" : "Unlocked" );
  
   if ( ShrinkConfig.ShowPetDetails )
   {
    list.Add( 1060663, "Name\t{0} Bonded: {1} Breed: {2} Gender: {3}", m_Name,m_IsBonded, m_Breed, m_Gender );
    list.Add( 1061640, ( null == m_Owner ) ? "nobody (WILD)" : m_Owner.Name ); // Owner: ~1_OWNER~
    list.Add( 1060659, "Stats\tStrength {0}, Dexterity {1}, Intelligence {2}", m_RawStr, m_RawDex, m_RawInt );
    list.Add( 1060660, "Combat Skills\tWrestling {0}, Tactics {1}, Anatomy {2}, Poisoning {3}", m_Wrestling, m_Tactics, m_Anatomy, m_Poisoning );
    list.Add( 1060661, "Magic Skills\tMagery {0}, Eval Intel {1}, Magic Resist {2}, Meditation {3}", m_Magery, m_EvalInt, m_MagicResist, m_Meditation );
    if ( !( 0 == m_Parry && 0 == m_Archery ))
     list.Add( 1060661, "Weapon Skills\tArchery {0}, Fencing {1}, Macing {2}, Parry {3}, Swords {4}", m_Archery, m_Fencing, m_Macing, m_Parry, m_Swords );
    if ( m_EvoEp > 0 )
     list.Add( 1060662, "EP\t{0}, Stage: {1}", m_EvoEp, m_EvoStage + 1 );
   }
  }
  private void PreloadProperties()
  {
   if ( null == m_Pet )
    return;
   m_IsBonded = m_Pet.IsBonded;
   m_Name = m_Pet.Name;
   
   m_Gender = (m_Pet.Female ? "Female" : "Male");
   m_Breed = Xanthos.Utilities.Misc.GetFriendlyClassName( m_Pet.GetType().Name );
   m_RawStr = m_Pet.RawStr;
   m_RawDex = m_Pet.RawDex;
   m_RawInt = m_Pet.RawInt;
   m_Wrestling = m_Pet.Skills[SkillName.Wrestling].Base;
   m_Tactics = m_Pet.Skills[SkillName.Tactics].Base;
   m_Anatomy = m_Pet.Skills[SkillName.Anatomy].Base;
   m_Poisoning = m_Pet.Skills[SkillName.Poisoning].Base;
   m_Magery = m_Pet.Skills[SkillName.Magery].Base;
   m_EvalInt = m_Pet.Skills[SkillName.EvalInt].Base;
   m_MagicResist = m_Pet.Skills[SkillName.MagicResist].Base;
   m_Meditation = m_Pet.Skills[SkillName.Meditation].Base;
   m_Parry = m_Pet.Skills[SkillName.Parry].Base;
   m_Archery = m_Pet.Skills[SkillName.Archery].Base;
   m_Fencing = m_Pet.Skills[SkillName.Fencing].Base;
   m_Swords = m_Pet.Skills[SkillName.Swords].Base;
   m_Macing = m_Pet.Skills[SkillName.Macing].Base;
   IEvoCreature evo = m_Pet as IEvoCreature;
   if ( null != evo )
   {
    m_EvoEp = evo.Ep;
    m_EvoStage = evo.Stage;
   }
   m_PropsLoaded = true;
  }
  public static bool IsPackAnimal( BaseCreature pet )
  {
   if ( null == pet || pet.Deleted )
    return false;
   Type breed = pet.GetType();
   foreach ( Type packBreed in ShrinkConfig.PackAnimals )
    if ( packBreed == breed )
     return true;
 
   return false;
  }
  public override void Serialize( GenericWriter writer )
  {
   base.Serialize( writer );
   writer.Write( (int)0 ); // version
   writer.Write( m_IsStatuette );
   writer.Write( m_Locked );
   writer.Write( (Mobile)m_Owner );
   writer.Write( (Mobile)m_Pet );
  }
  public override void Deserialize( GenericReader reader )
  {
   base.Deserialize( reader );
   switch ( reader.ReadInt() )
   {
    case 0:
    {
     m_IsStatuette = reader.ReadBool();
     m_Locked = reader.ReadBool();
     m_Owner = (PlayerMobile)reader.ReadMobile();
     m_Pet = (BaseCreature)reader.ReadMobile();
     if (null != m_Pet )
      m_Pet.IsStabled = true;
     break;
    }
   }
  }
 }
 public class LockShrinkItem : ContextMenuEntry
 {
  private Mobile m_From;
  private ShrinkItem m_ShrinkItem;
  public LockShrinkItem( Mobile from, ShrinkItem shrink ) : base( 2029, 5 )
  {
   m_From = from;
   m_ShrinkItem = shrink;
  }
  public override void OnClick()
  {
   m_ShrinkItem.Locked = true;
   m_From.SendMessage( 38, "You have locked this shrunken pet so only you can reclaim it." );
  }
 }
 public class UnLockShrinkItem : ContextMenuEntry
 {
  private Mobile m_From;
  private ShrinkItem m_ShrinkItem;
  public UnLockShrinkItem( Mobile from, ShrinkItem shrink ) : base( 2033, 5 )
  {
   m_From = from;
   m_ShrinkItem = shrink;
  }
  public override void OnClick()
  {
   m_ShrinkItem.Locked = false;
   m_From.SendMessage( 38, "You have unlocked this shrunken pet, now anyone can reclaim it as theirs." );
  }
 }
}

Here is the ShrinkConfig.cs
Code:
#region AuthorHeader
//
// Shrink System version 2.0, by Xanthos
//
//
#endregion AuthorHeader
using System;
using System.IO;  
using System.Xml;
using System.Text;
using System.Collections;
using System.Collections.Specialized;
using Xanthos.Utilities;
namespace Xanthos.ShrinkSystem
{
 // This file is for configuration of the Shrink System.  It is advised
 // that you DO NOT edit this file, instead place ShrinkConfig.xml in the 
 // RunUO/Data directory and modify the values there to configure the system
 // without changing code.  This allows you to take updates to the system
 // without losing your specific configuration settings.
 public class ShrinkConfig
 {
  public enum BlessStatus
  {
   All,  // All shrink items are blessed
   BondedOnly, // Only shrink items for bonded pets are blessed
   None  // No shrink items are blessed
  }
  public static bool PetAsStatuette = true;  // Deed or statuette form
  public static bool AllowLocking = false;  // Allow players to lock the shrunken pet or not
  public static bool ShowPetDetails = true;  // Show stats and skills on the properties of the shrunken pet
  public static double ShrunkenWeight = 10.0;
  public static bool BlessedLeash = true;
  public static BlessStatus LootStatus = BlessStatus.None; // How the shruken pet should be as loot
  public static double TamingRequired = 0;  // set to zero for no skill requirement to use shrink tools
  public static int ShrinkCharges = -1;   // set to -1 for infinite uses
  public static Type[] PackAnimals = new Type []
  {
   typeof(Server.Mobiles.PackHorse),
   typeof(Server.Mobiles.PackLlama),
   typeof(Server.Mobiles.Beetle),
  };
  private const string kConfigFile = @"Data/ShrinkConfig.xml";
  private const string kConfigName = "ShrinkSystem";
  public static void Initialize()
  {
   Element element = ConfigParser.GetConfig( kConfigFile, kConfigName );
   if ( null == element || element.ChildElements.Count <= 0 )
    return;
   double tempDouble;
   bool tempBool;
   int tempInt;
   Type[] tempTypeArray;
   foreach( Element child in element.ChildElements ) 
   {
    if ( child.TagName == "PetAsStatuette" && child.GetBoolValue( out tempBool ))
     PetAsStatuette = tempBool;
    
    else if ( child.TagName == "AllowLocking" && child.GetBoolValue( out tempBool ))
     AllowLocking = tempBool;
    
    else if ( child.TagName == "ShowPetDetails" && child.GetBoolValue( out tempBool ))
     ShowPetDetails = tempBool;
    
    else if ( child.TagName == "ShrunkenWeight" && child.GetDoubleValue( out tempDouble ))
     ShrunkenWeight = tempDouble;
    
    else if ( child.TagName == "BlessedLeash" && child.GetBoolValue( out tempBool ))
     ShowPetDetails = tempBool;
    
    else if ( child.TagName == "LootStatus" && null != child.Text && "" != child.Text )
    {
     if ( "BlessStatus.All" == child.Text )
      LootStatus = BlessStatus.All;
     else if ( "BlessStatus.BondedOnly" == child.Text )
      LootStatus = BlessStatus.BondedOnly;
     else if ( "BlessStatus.None" == child.Text )
      LootStatus = BlessStatus.None;
    }
    else if ( child.TagName == "TamingRequired" && child.GetIntValue( out tempInt ))
     TamingRequired = tempInt;
    
    else if ( child.TagName == "ShrinkCharges" && child.GetIntValue( out tempInt ))
     ShrinkCharges = tempInt;
    
    else if ( child.TagName == "PackAnimals" && child.GetArray( out tempTypeArray ))
     PackAnimals = tempTypeArray;
   }
  }
 }
}

And finally here is the ShrinkConfig.xml
Code:
<?xml version='1.0' ?>
<!--
 This file enables configuration of the Xanthos Shrink System module without code changes
 You may only change the values between the '>' and '<' characters to set the configuratoin
 parameters.  The type attribute is ignored and is only provided as a documentary guide to
 the user. Array element names are also meaningless.  Values may be left empty, with the
 exception of individual array elements, so that the value in the code is used.
 
 For example: to change the foo configuration from 50 to 100 one would change
  <foo type="int">50</foo>
   to
  <foo type="int">100</foo>
-->
<Xanthos>
 <ShrinkSystem version='2.0'>
  <PetAsStatuette type="bool">true</PetAsStatuette> <!-- Deed or statuette form -->
  <AllowLocking type="bool">false</AllowLocking>  <!-- Allow players to lock the shrunken pet so it can only be unshrunk by the owner -->
  <ShowPetDetails type="bool">true</ShowPetDetails> <!-- Show stats and skills on the properties of the shrunken pet -->
  <ShrunkenWeight type="double">10.0</ShrunkenWeight> <!-- Weight of the shrunken pet -->
  <BlessedLeash type="bool">false</BlessedLeash>  <!-- Loot type of the pet leash -->
  <!--
    Loot type of the shrunken pet (use one of three values):
   BlessStatus.All   - All shrunken pets  are blessed
   BlessStatus.BondedOnly - Only shrink items for bonded pets are blessed
   BlessStatus.None  - No shrink items are blessed
  -->
  <LootStatus>BlessStatus.All</LootStatus>
  
  <TamingRequired type="int">50</TamingRequired>  <!-- set to zero for no skill requirement to use shrink tools -->
  <ShrinkCharges type="int">-1</ShrinkCharges>  <!-- number of uses; set to -1 for infinite uses -->
  <PackAnimals type="array">       <!-- To prevent pack exploits, add all pack animals for your server -->
   <a type="string">Server.Mobiles.PackHorse</a>
   <a type="string">Server.Mobiles.PackLlama</a>
   <a type="string">Server.Mobiles.Beetle</a>
  </PackAnimals>
 </ShrinkSystem> 
</Xanthos>
[CODE]
 
any idea how to fix this lil minor error ?? it worked great till i switched to the svn ML ?


Errors:
+Customs/Xanthos/Shrink System/ShrinkCommand.cs
CS1502: Line 141: The best overloaded method match for 'Server.ISpawner.Remove<Server.ISpawnable>' has some invalid arguments
CS1503: Line 141: Argument '1' : cannot convert from 'Xanthos.ShrinkSystem.ShrinkTarget' to 'Server.ISpawnable'
 
thanks tass i dont see why it says it said something about ISpawner that wasnt even like that on the line the line read like this
line 141 pet.Spawner.Remove( this ); so really doesnt make sence but ill try that so far u been right on the money with the fixes :) thanks again guy
 

Dodger-b

Sorceror
i just want to know how to make it so when pets are shrunk it says something besides "A SHRUNKEN PET" ive tried everything all the scripts says show stats
 

tass23

Page
You're not the only one Dodger-b, I tried all the fixes that have been suggested and nothing is working. All my players are running around with shrunken pets that say "a shrunked pet".
 

Dodger-b

Sorceror
ok i thought i would try something i downloaded the zip at beggining of this thread. looked at the shrinkconfig it says "Shrink System version 2.1, by Xanthos" mine were "Shrink System version 2.0, by Xanthos" so i made a backup of ShrinkCommand.cs,ShrinkConfigure.cs,and ShrinkItem.cs and replaced those three scripts with the ones from what i downloaded this morning. nothing else was changed and i logged in and all my pets now display properly hope it works for you
 

tass23

Page
That didn't even work for me. When I tried to install the 2.1, I started getting errors, just never got around to fixing them yet.
 

moet

Wanderer
Heya! I have this script running and i think it is definitely the bee's knee's, can someone maybe help me with making it so that players can also shrink pets? do they use the [shrink command too? Im pretty sure im just being n00bish here but any help would be greatly appreciated!
 
Top