I have part of this issue fixed, but it creates an exploit. The original issue is that you couldnt fire arrows or bolts that were stored in the Woodworker Storage. I have that part working.. been killing Orcs with no arrows in my pack, just in the Woodworker Storage. Now the exploit.... it doesnt update the totals/consume the ammo. 1 arrow & 1 bolt are all thats needed to shoot all day long. So its only a "little" exploit... And by little, I mean kinda huge. Anywho, heres the area in BaseRanged.cs where I added the coding that got it firing.

Code:
		public virtual bool OnFired( Mobile attacker, Mobile defender )
		{
			if ( attacker.Player )
			{
				BaseQuiver quiver = attacker.FindItemOnLayer( Layer.Cloak ) as BaseQuiver;
                MasterStorage backpack = attacker.FindItemOnLayer(Layer.Backpack) as MasterStorage; // My Edit
				Container pack = attacker.Backpack;
 
				if ( quiver == null || Utility.Random( 100 ) >= quiver.LowerAmmoCost )
				{
					// consume ammo
					if ( quiver != null && quiver.ConsumeTotal( AmmoType, 1 ) )
						quiver.InvalidateWeight();
 
                    else if (backpack != null && backpack.ConsumeTotal(AmmoType, 1 ) ) // My Edit
 
                    if ( pack == null || !pack.ConsumeTotal( AmmoType, 1 ) )  // Removed "else" to make it work
						return false;
				}
				else if ( quiver.FindItemByType( AmmoType ) == null && ( pack == null || pack.FindItemByType( AmmoType ) == null ) )
 
                if (backpack.FindItemByType(AmmoType) == null && (pack == null || pack.FindItemByType(AmmoType) == null)) // My Edit
				{
					// lower ammo cost should not work when we have no ammo at all
					return false;
				}
			}
 
			attacker.MovingEffect( defender, EffectID, 18, 1, false, false );
 
			return true;
		}
BaseQuiver.cs has an UpdateTotal & GetTotal, but I cant get them to work in Woodworker Storage.. gives me the old favorite of "No suitable method found to override"
Code:
		public override BaseStorage GetStorage() { return WoodworkerStorage.Storage; } // Original coding
 
        public override void UpdateTotal(Item sender, TotalType type, int delta)
        {
            InvalidateProperties();
 
            base.UpdateTotal(sender, type, delta);
        }
 
        public override int GetTotal(TotalType type)
        {
            int total = base.GetTotal(type);
 
            return total;
        }
 
	}
	public class WoodworkerStorageDeed : BaseStorageDeed  // Original coding
Code:
Customs/MasterStorage/Storage/WoodworkerStorage.cs:
    CS0115: Line 51: 'daat99.WoodworkerStorage.UpdateTotal(Server.Item, Server.T
otalType, int)': no suitable method found to override
    CS0115: Line 58: 'daat99.WoodworkerStorage.GetTotal(Server.TotalType)': no s
uitable method found to override
MasterStorageUtils.cs has this as well..
Code:
		public static ulong GetPlayersStorageItemCount(PlayerMobile player, Type type)
		{
			MasterStorage backpack = GetMasterStorage(player);
			if (backpack != null)
				return backpack.GetStoredItemAmount(type);
			return 0;
		}
               public static bool ConsumePlayersStorageItem(PlayerMobile player, Type type, int amount)
		{
			MasterStorage backpack = GetMasterStorage(player);
			if (backpack != null)
				return backpack.TryConsume(type, amount);
			return false;
		}
		public static bool ConsumePlayersStorageItems(PlayerMobile player, Type[] types, int[] amounts)
		{
			MasterStorage backpack = GetMasterStorage(player);
			if (backpack != null)
				return backpack.TryConsume(types, amounts);
			return false;
		}
 
Last edited:
If your Storage is a Container, then it should have an "UpdateTotals()" method. Anyway, this OnFired method should do pretty well for you:

Code:
        public virtual bool OnFired(Mobile attacker, Mobile defender, bool duplicate)
        {
            if (attacker.Player)
            {
                bool consumed = false;
                BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
                MasterStorage storage = attacker.FindItemOnLayer(Layer.Backpack) as MasterStorage; // My Edit
                Container pack = attacker.Backpack;

                if (quiver == null || Utility.Random(100) >= quiver.LowerAmmoCost)
                {
                    // consume ammo
                    if (quiver != null && quiver.ConsumeTotal(AmmoType, 1)) // Consume from quiver first
                    {
                        consumed = true;
                        quiver.InvalidateWeight();
                    }

                    else if (storage != null && storage.ConsumeTotal(AmmoType, 1)) // Consume from storage second
                    {
                        consumed = true;
                        storage.UpdateTotals();
                    }

                    if (consumed || (pack != null && pack.ConsumeTotal(AmmoType, 1))) // Consume from pack third
                    {
                        return true;
                    }
                }
                else if (quiver.FindItemByType(AmmoType) == null &&
                        (pack == null || pack.FindItemByType(AmmoType) == null)
                        && (storage == null || storage.FindItemByType(AmmoType) == null))
                {
                    // lower ammo cost should not work when we have no ammo at all
                    return false;
                }
            }

            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);

            return true;
        }
 
Unfortunately, it didnt work. I'm wondering if an UpdateTotal of some sort wouldnt be a good idea in the MasterStorageUtils.cs. It has the Consume coding already there, listed right at the bottom of the script.
 
Sorry I missed that the Storage contained this method:

public static bool ConsumePlayersStorageItem(PlayerMobile player, Type type, int amount)

Try this one:

Code:
        public virtual bool OnFired(Mobile attacker, Mobile defender, bool duplicate)
        {
            if (attacker.Player)
            {
                bool consumed = false;
                BaseQuiver quiver = attacker.FindItemOnLayer(Layer.Cloak) as BaseQuiver;
                MasterStorage storage = attacker.FindItemOnLayer(Layer.Backpack) as MasterStorage; // My Edit
                Container pack = attacker.Backpack;
                if (quiver == null || Utility.Random(100) >= quiver.LowerAmmoCost)
                {
                    // consume ammo
                    if (quiver != null && quiver.ConsumeTotal(AmmoType, 1)) // Consume from quiver first
                    {
                        consumed = true;
                        quiver.InvalidateWeight();
                    }
                    else if (storage != null && attacker is PlayerMobile &&
						storage.ConsumePlayersStorageItem((PlayerMobile)attacker, AmmoType, 1)) // Consume from storage second
                    {
                        consumed = true;
                        storage.UpdateTotals();
                    }
                    if (consumed || (pack != null && pack.ConsumeTotal(AmmoType, 1))) // Consume from pack third
                    {
                        return true;
                    }
                }
                else if (quiver.FindItemByType(AmmoType) == null &&
                        (pack == null || pack.FindItemByType(AmmoType) == null)
                        && (storage == null || storage.FindItemByType(AmmoType) == null))
                {
                    // lower ammo cost should not work when we have no ammo at all
                    return false;
                }
            }
            attacker.MovingEffect(defender, EffectID, 18, 1, false, false);
            return true;
        }
 
*grumble*
Code:
Errors:
+ Items/Weapons/Ranged/BaseRanged.cs:
    CS1501: Line 90: No overload for method 'OnFired' takes '2' arguments
    CS0117: Line 191: 'daat99.MasterStorage' does not contain a definition for '
ConsumePlayersStorageItem'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
Line 90
public virtual bool OnFired(Mobile attacker, Mobile defender, bool duplicate)

Line 191
storage.ConsumePlayersStorageItem((PlayerMobile)attacker, AmmoType, 1)) // Consume from storage second

MasterStorage has a TryConsume, but no ConsumePlayersStorageItem, but the MasterStorageUtilis.cs does

This is from MasterStorageUtilis.cs
Code:
		public static bool ConsumePlayersStorageItem(PlayerMobile player, Type type, int amount)
		{
			MasterStorage backpack = GetMasterStorage(player);
			if (backpack != null)
				return backpack.TryConsume(type, amount);
			return false;
		}
		public static bool ConsumePlayersStorageItems(PlayerMobile player, Type[] types, int[] amounts)
		{
			MasterStorage backpack = GetMasterStorage(player);
			if (backpack != null)
				return backpack.TryConsume(types, amounts);
			return false;
		}
 
Just discovered a real nasty thing... this is apparently breaking the BaseRanged in such a way that you dont even need ammo or the MasterStorage to fire.. Completely empty pack & I'm shooting orcs. Just need a bow. :(
 
The edits for MasterStorage that I had planned to help the BardStorage issue may effect your solution here. When I get to writing code for it I'll see about updating the totals/consume when using ammo from MasterStorage, but I might need to know your changes that you made for this so far.
 
That would be none on changes as of this time. I had only made changes to BaseRanged.cs & returned that back to default once I discovered the breakage. So WoodworkerStorage.cs is "virgin" so to speak... :D
 
I read somewhere that Hammerhand was all over fixin up OWLTR
Am I right in thinking this work is going toward a public release for ServUO Pub 54 if so:

Just wanna say I've been checking for progress everyday for a couple weeks now & am really looking forward to it. TY

your the man
Hammerhand ViWinfii Lokai & anyone else Im not aware of

dont make me setup a runuo server:eek: please dont lol :D
 
Yea I found the post where he said that's what he was doing i just read so many posts i lose track I really cant wait for this I just need Owltr
& get Ultima Live to work right & I have all the cores I want zip up a copy of the server for backups and start map & quest work (Im This,........., Close)
 
Back