View Single Post
Old 12-04-2008, 04:53 PM   #1 (permalink)
DarkViper2006
Forum Novice
 
Join Date: Mar 2007
Age: 21
Posts: 266
Default ConsumeType.Half / Felluca resource banks.

hello again.

i got two questions again.

First:

In CraftItem, there is a possibility to use consumeType.Half or All.

where exectly do i have to make this check?

PlayerMobile plm = (PlayerMobile) from;
if( plm.HalfResourcesRequired == true )
consumetype = ConsumeType.Half
else
ConsumeType consumeType = ( UseAllRes ? ConsumeType.Half : ConsumeType.All );

I tried this:

Code:
			}
			else if ( !allRequiredSkills )
			{
				if ( tool != null && !tool.Deleted && tool.UsesRemaining > 0 )
					from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) );
				else
					from.SendLocalizedMessage( 1044153 ); // You don't have the required skills to attempt this item.
			}
			else
			{
				PlayerMobile plm = (PlayerMobile)from;
				if( plm.HalfResourcesRequired == true )
					consumeType = ConsumeType.Half;
				else
					ConsumeType consumeType = ( UseAllRes ? ConsumeType.Half : ConsumeType.All );

				int resHue = 0;
				int maxAmount = 0;

				object message = null;
but throws me this error:

Code:
RunUO - [www.runuo.com] Version 2.0, Build 2959.20979
Core: Running on .NET Framework Version 2.0.50727
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
 + Engines/Craft/Core/CraftItem.cs:
    CS1023: Line 1176: Embedded statement cannot be a declaration or labeled sta
tement
Scripts: One or more scripts failed to compile or no script files were found.
 - Press return to exit, or R to try again.


And


in HarvestSystem, i found this:

Code:
				if ( type != null )
				{
					Item item = Construct( type, from );

					if ( item == null )
					{
						type = null;
					}
					else
					{
						//The whole harvest system is kludgy and I'm sure this is just adding to it.
						if ( item.Stackable )
						{
							int amount = def.ConsumedPerHarvest;
							int feluccaAmount = def.ConsumedPerFeluccaHarvest;

							int racialAmount = (int)Math.Ceiling( amount * 1.1 );
							int feluccaRacialAmount = (int)Math.Ceiling( feluccaAmount * 1.1 );

							bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human );
							bool inFelucca = (map == Map.Felucca);

							if( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount )
								item.Amount = feluccaRacialAmount;
							else if( inFelucca && bank.Current >= feluccaAmount )
								item.Amount = feluccaAmount;
							else if( eligableForRacialBonus && bank.Current >= racialAmount )
								item.Amount = racialAmount;
							else
								item.Amount = amount;
						}

						bank.Consume( item.Amount, from );

						if ( Give( from, item, def.PlaceAtFeetIfFull ) )
						{
							SendSuccessTo( from, item, resource );
						}
						else
						{
							SendPackFullTo( from, item, def, resource );
							item.Delete();
						}

						BonusHarvestResource bonus = def.GetBonusResource();

						if ( bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill )
						{
							Item bonusItem = Construct( bonus.Type, from );

							if ( Give( from, bonusItem, true ) )	//Bonuses always allow placing at feet, even if pack is full irregrdless of def
							{
								bonus.SendSuccessTo( from );
							}
							else
							{
								item.Delete();
							}
						}
Tho, where exactly do i have to make the check that if from.TripleResources == true, it triples the gained item, tho, does not affect the harvest bank?


thanks in advance

Last edited by DarkViper2006; 12-04-2008 at 04:56 PM.
DarkViper2006 is offline   Reply With Quote