public static GraphicAsset LookupAsset(int itemId) { GraphicAsset asset = null; if (MasterHarvestableAssetlookup.ContainsKey(itemId)) { asset = MasterHarvestableAssetlookup[itemId]; } return(asset); }
public virtual List <Item> ReapBonusResources(int hue, Mobile from) { return(GraphicAsset.ReapBonusResources(hue, from, BonusResourceBaseAmount, BonusResources)); }
public bool Harvest(Mobile from, int itemId, Point3D harvestTargetLocation, Map map, ref MapOperationSeries operationSeries) { Point3D trunkLocation = LookupOriginLocation(harvestTargetLocation, itemId); List <KeyValuePair <int, GraphicAsset> > phasePiecesRemoved = null; //If the next phase is not null, tear it all down and construct the next phase if (NextHarvestPhase != null) { phasePiecesRemoved = RemoveAssets(map, trunkLocation, ref operationSeries, BaseAssetSets); int constructedTreeHue = 0; if (MasterHarvestablePhaseLookupByTypeList.ContainsKey(NextHarvestPhase)) { constructedTreeHue = MasterHarvestablePhaseLookupByTypeList[NextHarvestPhase].Construct(trunkLocation, map, ref operationSeries); } if (operationSeries != null) { RecordTreeLocationAndGraphic(map.MapID, BaseAssetSets[0][0].ItemID, trunkLocation); if (AddStump) { operationSeries.Add(new AddStatic(map.MapID, StumpGraphic, trunkLocation.Z, trunkLocation.X, trunkLocation.Y, constructedTreeHue)); } } } else //the next phase is not null, so destroy one asset at a time { GraphicAsset asset = LookupAsset(itemId); List <GraphicAsset[]> assetsToRemove = new List <GraphicAsset[]>(); assetsToRemove.Add(new GraphicAsset[] { asset }); phasePiecesRemoved = RemoveAssets(map, trunkLocation, ref operationSeries, assetsToRemove); } int hue = 0; //give out phase resource for each graphic asset removed foreach (KeyValuePair <int, GraphicAsset> assetPair in phasePiecesRemoved) { hue = assetPair.Key; Item itm = this.ReapResource(assetPair.Key, from, assetPair.Value.HarvestResourceBaseAmount); if (itm != null) { from.AddToBackpack(itm); } } //give out asset bonus resources foreach (Item itm in this.ReapBonusResources(hue, from)) { from.AddToBackpack(itm); } bool returnValue = false; if (operationSeries != null) { returnValue = true; } return(returnValue); }