demented

Member
Hello All,

I am working on a new Custom OWLTR release and am finding myself a bit stuck atm...
What I am attempting to do Like Daat's OWLTR is make it so the Player..Mines or Lumberjaxes Different Resources from a Harvest Vien Via the Harvest system.. So this way a player cant just sit and camp out on a Harvest Vein..In Daat's System he makes the option to Have it available or Not..I'm attempting to Make It Already Built in..so it just does it..Not the Option to Do it...So far this is what i have Figured out...

With Daat's System He Has This:
Code:
           			//daat99 OWLTR start - daat99 harvesting
			type = GetResourceType(from, tool, def, map, loc, resource);
			bool daatHarvesting = false;
			if (daat99.OWLTROptionsManager.IsEnabled(daat99.OWLTROptionsManager.OPTIONS_ENUM.DAAT99_MINING) && (type.IsSubclassOf(typeof(BaseOre)) || type.IsSubclassOf(typeof(BaseGranite))))
				daatHarvesting = true;
			else if (daat99.OWLTROptionsManager.IsEnabled(daat99.OWLTROptionsManager.OPTIONS_ENUM.DAAT99_LUMBERJACKING) && type.IsSubclassOf(typeof(BaseLog)))
				daatHarvesting = true;
			if ( daatHarvesting || (skillBase >= resource.ReqSkill && from.CheckSkill( def.Skill, resource.MinSkill, resource.MaxSkill )) )
			{
				type = GetResourceType( from, tool, def, map, loc, resource );

				if ( type != null )
					type = MutateType( type, from, tool, def, map, loc, resource );
				if (daatHarvesting)
				{
					type = ResourceHelper.GetDaat99HarvestedType(type, bank.Vein.IsProspected, skillValue);
					from.CheckSkill(def.Skill, 0.0, from.Skills[def.Skill].Cap + (vein.IsProspected?10.0:0.0));
				}
				//daat99 OWLTR end - daat99 harvesting

This seems to Check the players Skill and if the vein is Prospected..and using OOP Design "daatHarvesting" which calls to the resource Helper file and then there is this line :

Code:
                       						//daat99 OWLTR start - custom harvesting
						CraftResource craftResourceFromType = CraftResources.GetFromType(type);
						string s_Type = "UNKNOWN";
						int i_Tokens = 1;
						if (craftResourceFromType != CraftResource.None)
						{
							s_Type = CraftResources.GetInfo(craftResourceFromType).Name;
							i_Tokens = CraftResources.GetIndex(craftResourceFromType) + 1;
						}
						if (craftResourceFromType != CraftResource.None && daat99.OWLTROptionsManager.IsEnabled(daat99.OWLTROptionsManager.OPTIONS_ENUM.DAAT99_MINING) && def.Skill == SkillName.Mining && (type.IsSubclassOf(typeof(Server.Items.BaseOre)) || type.IsSubclassOf(typeof(Server.Items.BaseGranite))))
						{
							if (type.IsSubclassOf(typeof(Server.Items.BaseOre)))
							{
								if ( Give( from, item, def.PlaceAtFeetIfFull ) )
									from.SendMessage("You dig some {0} ore and placed it in your backpack.", s_Type);
								else
								{
									from.SendMessage("Your backpack is full, so the ore you mined is lost.");
									item.Delete();
								}
							}
							else
							{
								if ( Give( from, item, def.PlaceAtFeetIfFull ) )
									from.SendMessage("You carefully extract some workable stone from the ore vein.");
								else
								{
									from.SendMessage("Your backpack is full, so the ore you mined is lost.");
									item.Delete();
								}
							}
						}
						else if (craftResourceFromType != CraftResource.None && OWLTROptionsManager.IsEnabled(OWLTROptionsManager.OPTIONS_ENUM.DAAT99_LUMBERJACKING) && def.Skill == SkillName.Lumberjacking)
						{
							if ( Give( from, item, def.PlaceAtFeetIfFull ) )
								from.SendMessage("You placed some {0} logs in your backpack.", s_Type);
							else
							{
								from.SendMessage("You can't place any wood into your backpack!");
								item.Delete();
							}
						}
						else
						{
						//daat99 OWLTR end - custom harvesting
                        if (this.Give(from, item, def.PlaceAtFeetIfFull))
                        {
                            this.SendSuccessTo(from, item, resource);
                        }
                        else
                        {
                            this.SendPackFullTo(from, item, def, resource);
                            item.Delete();
                        }
						//daat99 OWLTR start - custom harvesting

This Part am Not 100% Sure but seems to Mine the ore and Lumber and if packs Full places at your feet
what i have done is this....

Code:
                        //daat99 OWLTR start - custom harvesting
						CraftResource craftResourceFromType = CraftResources.GetFromType(type);
						string s_Type = "UNKNOWN";
						
						if (craftResourceFromType != CraftResource.None)
						{
							s_Type = CraftResources.GetInfo(craftResourceFromType).Name;
							CraftResources.GetIndex(craftResourceFromType);
						}
						if (craftResourceFromType != CraftResource.None && def.Skill == SkillName.Mining && (type.IsSubclassOf(typeof(Server.Items.BaseOre)) || type.IsSubclassOf(typeof(Server.Items.BaseGranite))))
						{
							if (type.IsSubclassOf(typeof(Server.Items.BaseOre)))
							{
								if ( Give( from, item, def.PlaceAtFeetIfFull ) )
									from.SendMessage("You dig some {0} ore and placed it in your backpack.", s_Type);
								else
								{
									from.SendMessage("Your backpack is full, so the ore you mined is lost.");
									item.Delete();
								}
							}
							else
							{
								if ( Give( from, item, def.PlaceAtFeetIfFull ) )
									from.SendMessage("You carefully extract some workable stone from the ore vein.");
								else
								{
									from.SendMessage("Your backpack is full, so the ore you mined is lost.");
									item.Delete();
								}
							}
						}
						else if (craftResourceFromType != CraftResource.None && def.Skill == SkillName.Lumberjacking)
						{
							if ( Give( from, item, def.PlaceAtFeetIfFull ) )
								from.SendMessage("You placed some {0} logs in your backpack.", s_Type);
							else
							{
								from.SendMessage("You can't place any wood into your backpack!");
								item.Delete();
							}
						}
						else
						{
						//daat99 OWLTR end - custom harvesting
But after Testing I only seem to Get Normal Resource Like Iron or Log and what ever other Resources it gives..Like sometime it Shadow Iron or sometimes its Copper Or Like with Lumber the same thing...

Do i also need to Add the Skill Check and what Else am i missing to make the Ore/Lumber more random for the Different resources.

Any Help Would Be Greatly Appreciated...
Oh and dont know if this Matters ..but I basicly almost re-wrote all of the Lumberjacking System to work like the Mining System heh....
 
I may be wrong but dont you just want to use the default mining system with
Code:
oreAndStone.RandomizeVeins = Core.ML;
set to be enabled ? (mining cs line ~135)
 
Yes and no...I dont want the possibilty of Camping resources veins ...but what i went ahead and did was incorperate some of Daat's Options as a part of this new OWLTR..got it all compiling and running cept for this NullReference Crash i am getting When you mine or Lumberjack ...still havent gottent to the Bod Stuff yet hehe..

Anyways here is the error i am getting after running in Debug Mode:

Code:
Server Crash Report
===================

RunUO Version 0.5, Build 5949.7997
Operating System: Microsoft Windows NT 6.1.7600.0
.NET Framework: 4.0.30319.34209
Time: 4/30/2016 4:02:56 AM
Mobiles: 3481
Items: 109468
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
   at daat99.ResourceHelper.GetDaat99HarvestedType(Type originalType, Boolean prospected, Double skill) in c:\Users\Demented\Downloads\DreamScape\ServUO-master\Scripts\Customs\OWLTR\New\Core\Resource Helper.cs:line 70
   at Server.Engines.Harvest.HarvestSystem.FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, Object toHarvest, Object locked) in c:\Users\Demented\Downloads\DreamScape\ServUO-master\Scripts\Customs\OWLTR\Distros\Serices\Harvest\Core\HarvestSystem.cs:line 169
   at Server.Engines.Harvest.HarvestSoundTimer.OnTick() in c:\Users\Demented\Downloads\DreamScape\ServUO-master\Scripts\Services\Harvest\Core\HarvestSoundTimer.cs:line 31
   at Server.Timer.Slice() in c:\Users\Demented\Downloads\DreamScape\ServUO-master\Server\Timer.cs:line 409
   at Server.Core.Main(String[] args) in c:\Users\Demented\Downloads\DreamScape\ServUO-master\Server\Main.cs:line 576

Clients:
- Count: 1
+ 127.0.0.1: (account = Demented) (mobile = 0x349 'Demented')

Here is Line 70 of ResourcesHelper.cs:
Code:
			}
			CraftResourceInfo info = CraftResources.GetInfo(resultCraftResource);
            if (originalType.IsSubclassOf(typeof(BaseGranite)) && info.ResourceTypes.Length > 2)
                return info.ResourceTypes[2];
			if (info.ResourceTypes.Length > 1)
				return info.ResourceTypes[1];
			return info.ResourceTypes[0];
		}

Am not 100% sure but was thinking if i tried switching the above too
:
Code:
			}
			CraftResourceInfo info = CraftResources.GetInfo(resultCraftResource);
            if (originalType.IsSubclassOf(typeof(BaseGranite)) && info.ResourceTypes.Length > 2)
			{
		               return info.ResourceTypes[2];
			{
			else 	if (info.ResourceTypes.Length > 1)
			{
					return info.ResourceTypes[1];
			{
			else
			{
				return info.ResourceTypes[0];
			}
	}

That the above may fix the issue..But I could be wrong...Not had much Experience running into this type of error. So any help would be greatly appreciated...
 
Well something you are using there is not set to anything.
So make sure everything is not null.

Also I dont see how you could camp the veins when it is set to be random.
Btw it would also be the same in lumberjacking if you would go with that.
 
I may be wrong but dont you just want to use the default mining system with
Code:
oreAndStone.RandomizeVeins = Core.ML;
set to be enabled ? (mining cs line ~135)
isnt this already enabled? for some reason it didnt seem to be working if so...What i was getting was Iron and Copper...from like 1 vein nothing else anything different..so a person Looking for copper could had stay at that one spot and just kept getting the Iron and Copper over and over again...

Thats what i was trying to prevent hehe
 
Well if it is active it should give you a random ore type. But that doesnt change until it gets refilled.

So once you mine the vein is determined in that case :p (on refill its will be random)
 
Well if it is active it should give you a random ore type. But that doesnt change until it gets refilled.

So once you mine the vein is determined in that case :p (on refill its will be random)

Will give it another go...see what happens ,,Honestly i'd rather go that route then adding Daat's ..But its always good to have a back up plan =)
 
Hmm ..seems to be working now..almost removed all the Daat stuff....finish removing it and tackle the Bod stuff hehe..
anyhow Thankx Pyro for the help...
 
no problem :) just felt using the existing one may proof easier ;) good luck with your other removals
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back