Hi,

When harvesting with a Razor Macro, the out of resource message, for example "There is not enough wood here to harvest" does not get picked up as a SysMsg by Razor (I just use the word "enough" when playing on UOSA which works fine, but on UO Ren and on my own shard this does not work). It seems to be sent differently in the harvest system to other messages.

It appears that normally the system uses the localized message number to send the message like this in Lumberjacking.cs, if you try to chop the wrong thing with your axe:

Code:
 else if ( toHarvest is Targeting.StaticTarget || toHarvest is Targeting.LandTarget )
 from.SendLocalizedMessage( 500489 ); // You can't use an axe on that.
 else
 from.SendLocalizedMessage( 1005213 ); // You can't do that


But if the tree is out of resources, again in Lumberjacking.cs, the message number is picked up here in line 122

Code:
 lumber.NoResourcesMessage = 500493; // There's not enough wood here to harvest.

and in HavestSystem.cs is shown here in line 57 which I am guessing is the command to display the message to the user.

Code:
 public virtual bool CheckResources( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, bool timed )
 {
 HarvestBank bank = def.GetBank( map, loc.X, loc.Y );
 bool available = ( bank != null && bank.Current >= def.ConsumedPerHarvest );
 if ( !available )
 def.SendMessageTo( from, timed ? def.DoubleHarvestMessage : def.NoResourcesMessage );
 return available;
 }

Am I right in thinking that changing this to use the SendLocalizedMessage that this will then be detected in Razor as a SysMsg? If so, how would I change that bit of code (assuming that's the right bit!) to use SendLocalizedMessage?

I am using RunUO SVN but the code fragments would appear to be identical to ServUO.

Thanks

FB
 
Back