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.
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"
MasterStorageUtils.cs has this as well..
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;
}
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
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: