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!

Alphas Gold Ledger 2.0 rc1

coyan

Sorceror
Working fine for me also, Using Mondian's Legacy by Callandor...

My only wish is that it would pick up gold from like 1 tile away, like if you get close it picks it up, other than that, its doing great...
 

September

Sorceror
Claim and Grab Help needed

I Tried the Claim Listed as well as merge which made them identical anyways and Still can not get the gold to go into the gold ledger upon use of the clainm and grab commands. Any advice ?

Maybe Should goldbag be changed to goldledger through out the script if we intend to only want gold going into the ledger now ??? Thanks!!!


We love this so glad it's updated!:D:D:D
 

milva

Sorceror
Still hoping that some one can help September with her above post with the gold ledger-she had merged it and gold still will not go into the ledger. The sweeper works fine.
Any help would be much appreciated, if needed she could also post the claim script
Thanks!
 

prplbeast

Sorceror
ok i think what the prob was is that i missed posting another file called claimconfig.cs i will fix the download of it. so any one who wants to use this & has not got it working plz just redownload the main file.
 
although i put in the code to fix the ledger from picking up gold that is locked down on houses it still lets people collect the gold off the house?
 

September

Sorceror
Vendor Mall Problem

We are useing The Ledger on our Server and We LOVE it! We got it all working Great,,,,,,Thank you SO Much.

BUT >>>
We have come to one problem: In Our Vendor Mall When one has a Ledger and they Buy From player Vendor The Item Is Bought But The Gold is never taken. Do you (or anyone) have any help/advice on how we may Fix this issue ??????? Thank You SO Much !
 

milva

Sorceror
To help September explain, if you buy with a check from a player vendor- the vendor gets the gold the player keeps the check :p And the player gets the item. We had our scripter check and try fixes for the Vendor Mall which he found is not the problem, so has to be the gold ledger and how checks are handled?
 

clarissa

Sorceror
Xanthos Claim

I added this last night. Was able to fix some but this just has me going in circles lol. Help please.Line 161 No overload method for check loot takes 1 arguments
Code:
#region AuthorHeader
//
//  Claim System version 1.0, by Xanthos
//
//
#endregion AuthorHeader
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Misc;
using Server.Spells;
using Server.Guilds;
using Server.Mobiles;
using Server.Targeting;
using Server.Engines.PartySystem;
using Server.Commands;

namespace Xanthos.Claim
{
	public class Claim
	{
		public static void Initialize()
		{
			if ( ClaimConfig.EnableClaim )
				CommandSystem.Register( "Claim", AccessLevel.Player, new CommandEventHandler( Claim_OnCommand ) );

			if ( ClaimConfig.EnableGrab )
				CommandSystem.Register( "Grab", AccessLevel.Player, new CommandEventHandler( Grab_OnCommand ) );
		}

		[Usage( "Claim" )]
		[Description( "Claim a corpse for Gold" )]
		public static void Claim_OnCommand( CommandEventArgs e )
		{
			e.Mobile.Target = new ClaimCmdTarget();
			e.Mobile.SendMessage( "Choose a corpse to claim for gold." );
		}

		public static void Reclaim( Mobile from )
		{
			from.Target = new ClaimCmdTarget();
			from.SendMessage( "Choose another corpse to claim." );
		}

		[Usage( "Grab" )]
		[Description( "Grab lootable items off of the ground and claim nearby corpses." )]
		public static void Grab_OnCommand( CommandEventArgs e )
		{
			Mobile from = e.Mobile;

			if ( from.Alive == false )
			{
				from.PlaySound( 1069 ); //hey
				from.SendMessage( "You cannot do that while you are dead!" );
				return;
			}
			else if ( 0 != ClaimConfig.CompetitiveGrabRadius && BlockingMobilesInRange( from, ClaimConfig.GrabRadius ))
			{
				from.PlaySound( 1069 ); //hey
				from.SendMessage( "You are too close to another player to do that!" );
				return;
			}

			ArrayList items = new ArrayList();
			ArrayList corpses = new ArrayList();

			foreach ( Item item in from.GetItemsInRange( ClaimConfig.GrabRadius ))
			{
				if ( CorpseIsLootable( from, item as Corpse ))
					corpses.Add( item );
				else if ( ((IList)(ClaimConfig.TypesToLoot)).Contains( item.GetType()) || ( ClaimConfig.LootArtifacts && ItemIsArtifact( item ) ))
					items.Add( item );
			}

			foreach ( Item item in items )
			{
				if ( item is Gold )
					DropGold( from, item as Gold );
				else
					from.Backpack.DropItem( item );
			}

			foreach ( Item item in corpses )
				ClaimCorpse( from, item as Corpse );
		}

		public static void ClaimCorpse( Mobile from , Corpse corpse )
		{
			LootCorpse( from, corpse );
			AwardGold( from, corpse );
			corpse.Delete();
			from.SendMessage( "You claim the corpse and recieve a reward." );
		}

		public static void AwardGold( Mobile from , Corpse corpse )
		{
			int amount = Math.Max(( corpse.Owner.Fame ) / ClaimConfig.FameDivisor, ClaimConfig.MinimumReward );
			DropGold( from, new Gold( amount ));
		}

		public static void DropGold( Mobile from, Gold gold )
		{
			Container goldBag = from.Backpack.FindItemByType( ClaimConfig.GoldBagType ) as Container;

			if ( null == goldBag )
				goldBag = from.Backpack;

			if ( !goldBag.TryDropItem( from, gold, false ))	// Attempt to stack it
				goldBag.DropItem( gold );

			from.PlaySound( 0x2E6 ); // drop gold sound
		}

		public static void LootCorpse(  Mobile from, Corpse corpse )
		{
			if ( null == ClaimConfig.TypesToLoot )
				return;

			ArrayList items = new ArrayList( corpse.Items.Count );

			foreach( Item item in corpse.Items )
			{
				if ( ((IList)(ClaimConfig.TypesToLoot)).Contains( item.GetType()) || ( ClaimConfig.LootArtifacts && ItemIsArtifact( item ) ))
					items.Add( item );
			}

			for( int i = 0; i < items.Count; i++ )
			{
				if ( items[ i ] is Gold )
					DropGold( from, items[ i ] as Gold );
				else
					from.AddToBackpack( (Item)items[ i ] );
			}
		}

		private static bool CorpseIsLootable( Mobile from, Corpse corpse )
		{
			if ( null == corpse )
				return false;

			bool result = false;

			if ( corpse.Owner is PlayerMobile && !ClaimConfig.LootPlayers && from != corpse.Owner )
			{
				from.PlaySound( 1074 ); // no
				from.SendMessage( "You may not loot player corpses." );
			}
			else
			{
				BaseCreature creature = corpse.Owner as BaseCreature;

				if ( null != creature && creature.IsBonded )
				{
					from.PlaySound( 1074 ); // no
					from.SendMessage( "You may not loot the corpses of bonded pets." );
				}
				else if ( null != creature && corpse.Owner.Fame <= ClaimConfig.FreelyLootableFame )
					result = true;
				else
					result = corpse.CheckLoot( from ) && !( corpse.IsCriminalAction( from ) );

			}

			return result;
		}

		public static bool BlockingMobilesInRange( Mobile from, int range )
		{
			foreach ( Mobile mobile in from.GetMobilesInRange( range ) )
			{
				if ( mobile is PlayerMobile && IsBlockingMobile( from, mobile ))
					return true;
			}
			return false;
		}


		public static bool IsBlockingMobile( Mobile looter, Mobile other )
		{
			if ( looter == other )
				return false;

			Guild looterGuild = SpellHelper.GetGuildFor( looter );
			Guild otherGuild = SpellHelper.GetGuildFor( other );

			if ( null != looterGuild && null != otherGuild && ( looterGuild == otherGuild || looterGuild.IsAlly( otherGuild )))
				return false;

			Party party = Party.Get( looter );

			return !( null != party && party.Contains( other ) );
		}

		private static bool ItemIsArtifact( Item item )
		{
			bool result = false;

			if ( item is BaseWeapon && ((BaseWeapon)item).ArtifactRarity != 0 )
				result = true;
			else if ( item is BaseArmor && ((BaseArmor)item).ArtifactRarity != 0 )
				result = true;
			else if ( item is BaseClothing && ((BaseClothing)item).ArtifactRarity != 0 )
				result = true;
			else if ( item is BaseJewel && ((BaseJewel)item).ArtifactRarity != 0 )
				result = true;

			return result;
		}


		private class ClaimCmdTarget : Target
		{
			public ClaimCmdTarget() : base( ClaimConfig.ClaimRadius, false, TargetFlags.None )
			{
			}

			protected override void OnTarget( Mobile from, object target )
			{
				Corpse corpse = target as Corpse;

				if ( from.Alive == false )
				{
					from.PlaySound( 1069 ); //hey
					from.SendMessage( "You cannot do that while you are dead!" );
				}	
				else if ( 0 != ClaimConfig.CompetitiveClaimRadius && BlockingMobilesInRange( from, ClaimConfig.CompetitiveClaimRadius ))
				{
					from.PlaySound( 1069 ); //hey
					from.SendMessage( "You are too close to another player to do that!" );
				}
				else if ( null == corpse )
				{
					from.PlaySound( 1066 ); // giggle
					from.SendMessage( "That isn't a corpse!" );
				}
				else if ( CorpseIsLootable( from, corpse ))
				{
					Claim.ClaimCorpse( from, corpse );
					Reclaim( from );
				}
			}
		}
	}
}
 

Pure Insanity

Sorceror
Helpful Mods

clarissa;848097 said:
I added this last night. Was able to fix some but this just has me going in circles lol. Help please.Line 161 No overload method for check loot takes 1 arguments
Code:
#region AuthorHeader
//
//  Claim System version 1.0, by Xanthos
//
//
#endregion AuthorHeader
using System;
using System.Collections;
using Server;
using Server.Items;
using Server.Misc;
using Server.Spells;
using Server.Guilds;
using Server.Mobiles;
using Server.Targeting;
using Server.Engines.PartySystem;
using Server.Commands;

namespace Xanthos.Claim
{
	public class Claim
	{
		public static void Initialize()
		{
			if ( ClaimConfig.EnableClaim )
				CommandSystem.Register( "Claim", AccessLevel.Player, new CommandEventHandler( Claim_OnCommand ) );

			if ( ClaimConfig.EnableGrab )
				CommandSystem.Register( "Grab", AccessLevel.Player, new CommandEventHandler( Grab_OnCommand ) );
		}

		[Usage( "Claim" )]
		[Description( "Claim a corpse for Gold" )]
		public static void Claim_OnCommand( CommandEventArgs e )
		{
			e.Mobile.Target = new ClaimCmdTarget();
			e.Mobile.SendMessage( "Choose a corpse to claim for gold." );
		}

		public static void Reclaim( Mobile from )
		{
			from.Target = new ClaimCmdTarget();
			from.SendMessage( "Choose another corpse to claim." );
		}

		[Usage( "Grab" )]
		[Description( "Grab lootable items off of the ground and claim nearby corpses." )]
		public static void Grab_OnCommand( CommandEventArgs e )
		{
			Mobile from = e.Mobile;

			if ( from.Alive == false )
			{
				from.PlaySound( 1069 ); //hey
				from.SendMessage( "You cannot do that while you are dead!" );
				return;
			}
			else if ( 0 != ClaimConfig.CompetitiveGrabRadius && BlockingMobilesInRange( from, ClaimConfig.GrabRadius ))
			{
				from.PlaySound( 1069 ); //hey
				from.SendMessage( "You are too close to another player to do that!" );
				return;
			}

			ArrayList items = new ArrayList();
			ArrayList corpses = new ArrayList();

			foreach ( Item item in from.GetItemsInRange( ClaimConfig.GrabRadius ))
			{
				if ( CorpseIsLootable( from, item as Corpse ))
					corpses.Add( item );
				else if ( ((IList)(ClaimConfig.TypesToLoot)).Contains( item.GetType()) || ( ClaimConfig.LootArtifacts && ItemIsArtifact( item ) ))
					items.Add( item );
			}

			foreach ( Item item in items )
			{
				if ( item is Gold )
					DropGold( from, item as Gold );
				else
					from.Backpack.DropItem( item );
			}

			foreach ( Item item in corpses )
				ClaimCorpse( from, item as Corpse );
		}

		public static void ClaimCorpse( Mobile from , Corpse corpse )
		{
			LootCorpse( from, corpse );
			AwardGold( from, corpse );
			corpse.Delete();
			from.SendMessage( "You claim the corpse and recieve a reward." );
		}

		public static void AwardGold( Mobile from , Corpse corpse )
		{
			int amount = Math.Max(( corpse.Owner.Fame ) / ClaimConfig.FameDivisor, ClaimConfig.MinimumReward );
			DropGold( from, new Gold( amount ));
		}

		public static void DropGold( Mobile from, Gold gold )
		{
			Container goldBag = from.Backpack.FindItemByType( ClaimConfig.GoldBagType ) as Container;

			if ( null == goldBag )
				goldBag = from.Backpack;

			if ( !goldBag.TryDropItem( from, gold, false ))	// Attempt to stack it
				goldBag.DropItem( gold );

			from.PlaySound( 0x2E6 ); // drop gold sound
		}

		public static void LootCorpse(  Mobile from, Corpse corpse )
		{
			if ( null == ClaimConfig.TypesToLoot )
				return;

			ArrayList items = new ArrayList( corpse.Items.Count );

			foreach( Item item in corpse.Items )
			{
				if ( ((IList)(ClaimConfig.TypesToLoot)).Contains( item.GetType()) || ( ClaimConfig.LootArtifacts && ItemIsArtifact( item ) ))
					items.Add( item );
			}

			for( int i = 0; i < items.Count; i++ )
			{
				if ( items[ i ] is Gold )
					DropGold( from, items[ i ] as Gold );
				else
					from.AddToBackpack( (Item)items[ i ] );
			}
		}

		private static bool CorpseIsLootable( Mobile from, Corpse corpse )
		{
			if ( null == corpse )
				return false;

			bool result = false;

			if ( corpse.Owner is PlayerMobile && !ClaimConfig.LootPlayers && from != corpse.Owner )
			{
				from.PlaySound( 1074 ); // no
				from.SendMessage( "You may not loot player corpses." );
			}
			else
			{
				BaseCreature creature = corpse.Owner as BaseCreature;

				if ( null != creature && creature.IsBonded )
				{
					from.PlaySound( 1074 ); // no
					from.SendMessage( "You may not loot the corpses of bonded pets." );
				}
				else if ( null != creature && corpse.Owner.Fame <= ClaimConfig.FreelyLootableFame )
					result = true;
				else
					result = corpse.CheckLoot( from ) && !( corpse.IsCriminalAction( from ) );

			}

			return result;
		}

		public static bool BlockingMobilesInRange( Mobile from, int range )
		{
			foreach ( Mobile mobile in from.GetMobilesInRange( range ) )
			{
				if ( mobile is PlayerMobile && IsBlockingMobile( from, mobile ))
					return true;
			}
			return false;
		}


		public static bool IsBlockingMobile( Mobile looter, Mobile other )
		{
			if ( looter == other )
				return false;

			Guild looterGuild = SpellHelper.GetGuildFor( looter );
			Guild otherGuild = SpellHelper.GetGuildFor( other );

			if ( null != looterGuild && null != otherGuild && ( looterGuild == otherGuild || looterGuild.IsAlly( otherGuild )))
				return false;

			Party party = Party.Get( looter );

			return !( null != party && party.Contains( other ) );
		}

		private static bool ItemIsArtifact( Item item )
		{
			bool result = false;

			if ( item is BaseWeapon && ((BaseWeapon)item).ArtifactRarity != 0 )
				result = true;
			else if ( item is BaseArmor && ((BaseArmor)item).ArtifactRarity != 0 )
				result = true;
			else if ( item is BaseClothing && ((BaseClothing)item).ArtifactRarity != 0 )
				result = true;
			else if ( item is BaseJewel && ((BaseJewel)item).ArtifactRarity != 0 )
				result = true;

			return result;
		}


		private class ClaimCmdTarget : Target
		{
			public ClaimCmdTarget() : base( ClaimConfig.ClaimRadius, false, TargetFlags.None )
			{
			}

			protected override void OnTarget( Mobile from, object target )
			{
				Corpse corpse = target as Corpse;

				if ( from.Alive == false )
				{
					from.PlaySound( 1069 ); //hey
					from.SendMessage( "You cannot do that while you are dead!" );
				}	
				else if ( 0 != ClaimConfig.CompetitiveClaimRadius && BlockingMobilesInRange( from, ClaimConfig.CompetitiveClaimRadius ))
				{
					from.PlaySound( 1069 ); //hey
					from.SendMessage( "You are too close to another player to do that!" );
				}
				else if ( null == corpse )
				{
					from.PlaySound( 1066 ); // giggle
					from.SendMessage( "That isn't a corpse!" );
				}
				else if ( CorpseIsLootable( from, corpse ))
				{
					Claim.ClaimCorpse( from, corpse );
					Reclaim( from );
				}
			}
		}
	}
}

Change this line.

Code:
result = corpse.CheckLoot( from ) && !( corpse.IsCriminalAction( from ) );

To this.
Code:
result = corpse.CheckLoot( from, corpse ) && !( corpse.IsCriminalAction( from ) );

The reason it's doing this is because you're running a newer SVN, this method was changed to accept another argument.

Anyways...I wasn't just necroing this thread to help this person. I did this because I recently added it back to my shard again today. But decided that there were some things I wanted changed, and these are completely optional. Just figured I'd share with the others that actually use this.

I decided that I wanted gold it's self, to be able to be double clicked. When double clicked, I wanted it to add the gold to the person's gold ledger. The way I set it up was very basic, it doesn't check to see if the gold is in the players bag. So you could actually do it to gold on the ground too. As long as the gold is movable, it will put the gold in your gold ledger. In order to get this mod working, you need to open Gold.cs

Add this block of code before the last two }'s.
Code:
          //Add it here
     }
}

Add this:
Code:
                //Mod to allow players to double click gold and add to ledger
		public override void OnDoubleClick( Mobile m )
		{
			if ( this.Movable )
			{
				Item[] items = m.Backpack.FindItemsByType( typeof( GoldLedger ) );
			
				foreach( GoldLedger ledger in items )
				{
					if ( ledger.Gold + this.Amount <= 2000000000 )
					{
						ledger.Gold = ( ledger.Gold + Amount );
						this.Delete();
						m.SendMessage( "You added {0} gold to your gold ledger.", Amount );
						break;
					}
				}
			}
		}

You may wish to add range checks on it so they can't pick up gold across the screen. I decided not to because that's not really what my players use it for, since they already have the auto sweeping ledger. They use it to double click any kind of gold in their backpack. I may mod mine in the future to make it work with gold sitting in the bank also.

But anyways, here's another useful mod I added to my shard that I figured some other people may find useful. I know there is a mod in place that makes the ledger work with every vendor, this is helpful. But a lot of people have other things such as hue stones, or the ton of other custom scripts that exist for RunUO. This mod will allow the ledger to work with anything that attempts to withdraw gold from a players bank. Almost every script I've came across uses the withdraw method on a player's bank, if they don't have enough gold in their backpack.

This mod will only work if the script attempts to withdraw gold from a players bank. If it checks the person's backpack only, then this will not work. I've adapted the code to where it will also check the player's backpack, it may sound useless. But it made sense to me at the time. I did this because it is able to use some gold in your pack, and then the rest from the gold ledger. Just for if the player does have some gold in their backpack. So if you have this mod in place, you can make all your new scripts just use the Withdraw() method that I've modded.

You need to open your Banker.cs and locate this line.

Code:
public static bool Withdraw( Mobile from, int amount )
		{

Directly after that {, add this.

Code:
#region Edit to make the bank use ledger first
			if ( from.Backpack != null )
			{
				Item item = from.Backpack.FindItemByType( typeof( GoldLedger ) );
				GoldLedger ledger = item as GoldLedger;
				Item[] item2 = from.Backpack.FindItemsByType( typeof( Gold ) );
				
				int goldint = 0;
				foreach ( Item item3 in item2 )
					goldint += item3.Amount;
				if ( from.Backpack.ConsumeTotal( typeof( Gold ), amount ) )
				{
					from.SendMessage(2125, "{0} gold has been withdrawn from your backpack.", amount.ToString( "#,0" ));
					return true;
				}
				else if ( ledger != null )
				{
					if ( ( goldint + ledger.Gold ) >= amount )
					{
						ledger.Gold -= (amount - goldint);
						from.SendMessage(2125, "{0} gold has been withdrawn from your gold ledger and/or backpack.", (amount - goldint).ToString( "#,0" ));
						from.Backpack.ConsumeTotal( typeof( Gold ), goldint );
						return true;
					}
					else if ( ledger.Gold >= amount )
					{
						ledger.Gold -= amount;
						from.SendMessage(2125, "{0} gold has been withdrawn from your gold ledger.", amount.ToString( "#,0" ));
						return true;
					}
				}
			}
			#endregion

I have not tested these mods extensively...but there's no reason they shouldn't work, they're pretty basic. Anyways, that's all from me at the moment. Have fun, and hope you enjoy the mods if you decide to use them.
 

milva

Sorceror
Thanks for sharing this, great idea! We will be testing this out in the near future- can I ask which SVN your using?
 

Pure Insanity

Sorceror
I'm using the latest ML + SA. Just decided that I'd like the gold ledger a little more feasible on my shard. Hate how some shards require you to move gold around like it's a game of chess or something.
 

milva

Sorceror
Thanks! I think this will solve the bug issue with our Player Vendor Mall, where it will remove gold from a "players bank and their gold ledger", so they would loose double amount of gold for purchase of an item. Hope! :)
 

Pure Insanity

Sorceror
Depends on which method it calls first, and how the method is called. With this mod in place, you can pretty much convert everything to use the Bankbox.Withdraw() method.
 

Pyro Man

Sorceror
Okay, i put the ledger into my customs folder and replaced the distro files and errors are popping up. I'm not on my normal computer so i cant put the errors but tomorrow ill post them. If you have an ideas, please tell me. I'm sure everyone would love something like a ledger.
Also, i have a [cleanup command. Will that work or do i need to mod the script to get it to work?
Edit : Oh, i found the fix. Turns out i just needed a gold bag, loot bag, and token bag. Does anyone know where ican get these? I just looked all over RUO and cant find them anywhere.
 

Pyro Man

Sorceror
Pyro Man;866544 said:
Really? I downloaded it and they weren't in it. I'll try it again i suppose. :confused:

I downloaded the file again and looked through it. Even looked at the ledger script. Couldn't find the bags anywhere. Can you point me in the right direction? When i put the file in my customs folder, my server errored out on me. Said that it couldn't find gold bag, token bag, and loot bag.
 
Top