Exemplo n.º 1
0
 public void Harvested(Quality quality, PlantDefinition def)
 {
     if (mHarvestCounts == null)
     {
         mHarvestCounts = new Dictionary <string, PlantInfo>();
     }
     if (!mHarvestCounts.TryGetValue(def.PlantName, out PlantInfo value))
     {
         value = new PlantInfo();
         value.HarvestablesCount = 1;
         value.BestQuality       = quality;
         mHarvestCounts.Add(def.PlantName, value);
     }
     else
     {
         value.HarvestablesCount++;
         if (quality > value.BestQuality)
         {
             value.BestQuality = quality;
         }
     }
     if (quality > mBestQualityHarvested)
     {
         mBestQualityHarvested = quality;
     }
     mNumberThingsHarvested++;
     TestForNewLifetimeOpp();
 }
Exemplo n.º 2
0
 public void UpdateSkillJournal(PlantDefinition harvestPlantDef, List <GameObject> objectsHarvested)
 {
     foreach (GameObject item in objectsHarvested)
     {
         Harvested(Plant.GetQuality(item.Plantable.QualityLevel), harvestPlantDef);
     }
 }
Exemplo n.º 3
0
		public static Plant CreatePlantFromSeed(IGameObject seedObj, Soil soil, Sim planter)
		{
			PlantDefinition plantDefinition = PlantHelper.GetPlantDefinition(seedObj);
			if (plantDefinition == null)
			{
				return null;
			}
			float num = seedObj.Plantable.QualityLevel;
			if (planter != null)
			{
				//int num2 = planter.SkillManager.GetSkillLevel(SkillNames.Gardening);
				//if (num2 == -1)
				//{
				//	num2 = 0;
				//}
				//num *= Sims3.Gameplay.Skills.Gardening.QualityMultiplier[(int)plantDefinition.Rarity, num2];
				//if (planter.HasTrait(TraitNames.SuperGreenThumb))
				//{
				//	num *= TraitTuning.SuperGreenThumbPlantQualityMultiplier;
				//}
			}
			PlantInitParameters initParams = new PlantInitParameters(seedObj, num, plantDefinition, soil);
			Plant plant = Plant.DoCreatePlantFromSeed(plantDefinition, soil, initParams, Plant.IsMushroom(seedObj));
			plant?.AddSimWhoHelpedGrow(planter);
			return plant;
		}
Exemplo n.º 4
0
 public static void UpdateGardeningSkillJournal(MoneyTree ths, Gardening gardeningSkill, PlantDefinition harvestPlantDef, List<GameObject> objectsHarvested)
 {
     foreach (GameObject obj2 in objectsHarvested)
     {
         HarvestMoneyBag bag = obj2 as HarvestMoneyBag;
         if (bag != null)
         {
             gardeningSkill.MoneyBagHarvested(bag.Value, harvestPlantDef);
         }
     }
 }
Exemplo n.º 5
0
    protected void OnActorPlaced(Vector3 cellPosition, bool multiple = false)
    {
        pickedActor.transform.position = cellPosition;

        pickedActor.Mesh.transform.position = cellPosition;
        pickedActor.SetLayerForHighlight(false);

        if (pickedActor is Plant)
        {
            PlantDefinition         def      = pickedActor.Definition as PlantDefinition;
            ItemDefinition.ItemType itemType = def.Seed;

            if (StorageManager.Instance.Stock.TryGetValue(itemType, out StorageItem storageItem))
            {
                if (storageItem.Quantity > 0)
                {
                    Accounts.Instance.BuyItem(storageItem.Definition.Cost);
                    int remainingQuantity = 0;
                    StorageManager.Instance.RemoveStorageItem(itemType, 1, ref remainingQuantity);
                }
                else
                {
                    Debug.Log("No storage stock of " + storageItem.Definition.DescriptiveName);
                }
            }
            else
            {
                Debug.Log("No storage key stock of " + itemType.ToString());
            }
        }
        else
        {
            Accounts.Instance.BuyItem(pickedActor.Definition.Cost); // TODO: Need to add in a solution for if the player can't afford to buy
        }


        pickedActor.OnPlaced();
        pickedActor.Picked = false;


        if (multiple)
        {
            SpawnDuplicateActor(pickedActor);
        }
        else
        {
            pickedActor = null;

            previousActorRotation = 0f;
            actorRotation         = 0f;
            appliedRotationY      = 0f;
        }
    }
Exemplo n.º 6
0
 // From HarvestPlant
 protected static void UpdateGardeningSkillJournal(HarvestPlant ths, Gardening gardeningSkill, PlantDefinition harvestPlantDef, List<GameObject> objectsHarvested)
 {
     foreach (GameObject obj2 in objectsHarvested)
     {
         gardeningSkill.Harvested(Plant.GetQuality(obj2.Plantable.QualityLevel), harvestPlantDef);
         if (Plant.IsMushroom(ths.Seed))
         {
             Collecting collecting = gardeningSkill.SkillOwner.SkillManager.AddElement(SkillNames.Collecting) as Collecting;
             if (collecting != null)
             {
                 bool flag;
                 collecting.Collected(obj2 as Ingredient, out flag);
             }
         }
     }
 }
Exemplo n.º 7
0
    protected void SpawnPlant(string name)
    {
        PlantDefinition pDef = PlantManifest.GetPlantDefinition(name);

        if (pDef == null)
        {
            return; // If the PlantDefinition is null, we just return here. We will have already logged an error in PlantManifest's function which will have our stack trace.
        }
        Plant p = Instantiate(pDef.Actor, inputPosition,
                              Quaternion.identity, transform);

        Plants.Add(p);

        p.Definition = pDef;
        p.Picked     = true;

        pickedActor = p;
        pickedActor.transform.position   = inputPosition;
        pickedActor.transform.localScale = new Vector3(1f, 1f, 1f);
    }
Exemplo n.º 8
0
 // From HarvestPlant
 protected static void UpdateGardeningSkillJournal(HarvestPlant ths, Gardening gardeningSkill, PlantDefinition harvestPlantDef, List <GameObject> objectsHarvested)
 {
     foreach (GameObject obj2 in objectsHarvested)
     {
         gardeningSkill.Harvested(Plant.GetQuality(obj2.Plantable.QualityLevel), harvestPlantDef);
         if (Plant.IsMushroom(ths.Seed))
         {
             Collecting collecting = gardeningSkill.SkillOwner.SkillManager.AddElement(SkillNames.Collecting) as Collecting;
             if (collecting != null)
             {
                 bool flag;
                 collecting.Collected(obj2 as Ingredient, out flag);
             }
         }
     }
 }
Exemplo n.º 9
0
        public override void OnStartupApp()
        {
            Overwatch.Log("LoadStoreData");

            XmlDbData data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("buffs_store"), 0xdd3223a7, 0), false);

            if (data != null)
            {
                try
                {
                    BuffManager.ParseBuffData(data, true);

                    Overwatch.Log(" buffs_store");
                }
                catch (Exception e)
                {
                    Common.DebugException("buffs_store", e);
                }
            }

            data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("skills_store"), 0xa8d58be5, 0), false);
            if (data != null)
            {
                try
                {
                    SkillManager.ParseSkillData(data, true);

                    Overwatch.Log(" skills_store");
                }
                catch (Exception e)
                {
                    Common.DebugException("skills_store", e);
                }
            }

            data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("Ingredients_store"), 0xe5105066, 0), false);
            if (data != null)
            {
                try
                {
                    IngredientData.LoadIngredientData(data, true);

                    Overwatch.Log(" Ingredients_store");
                }
                catch (Exception e)
                {
                    Common.DebugException("Ingredients_store", e);
                }
            }

            data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("Plants_store"), 0xe5105068, 0), false);
            if (data != null)
            {
                try
                {
                    PlantDefinition.ParsePlantDefinitionData(data, true);

                    Overwatch.Log(" Plants_store");
                }
                catch (Exception e)
                {
                    Common.DebugException("Plants_store", e);
                }
            }

            data = XmlDbData.ReadData(new ResourceKey(ResourceUtils.HashString64("RecipeMasterList_store"), 0xe5105067, 0), false);
            if (data != null)
            {
                try
                {
                    Recipe.LoadRecipeData(data, true);

                    Overwatch.Log(" RecipeMasterList_store");
                }
                catch (Exception e)
                {
                    Common.DebugException("RecipeMasterList_store", e);
                }
            }
        }
Exemplo n.º 10
0
 public static void UpdateGardeningSkillJournal(MoneyTree ths, Gardening gardeningSkill, PlantDefinition harvestPlantDef, List <GameObject> objectsHarvested)
 {
     foreach (GameObject obj2 in objectsHarvested)
     {
         HarvestMoneyBag bag = obj2 as HarvestMoneyBag;
         if (bag != null)
         {
             gardeningSkill.MoneyBagHarvested(bag.Value, harvestPlantDef);
         }
     }
 }