コード例 #1
0
        protected static void IncreaseIngotsCreatedForMetal(Collecting skill, RockGemMetal metal)
        {
            if (!skill.mMetalData.ContainsKey(metal))
            {
                skill.mMetalData.Add(metal, new Collecting.MetalStats(0));
            }

            skill.IncreaseIngotsCreatedForMetal(metal);
        }
コード例 #2
0
ファイル: CommonSocials.cs プロジェクト: yakoder/NRaas
        public static IGameObject FetchRandomOccultTreat(OccultTypes type, bool isAlien)
        {
            if (isAlien)
            {
                InteractionDefinition      instance  = RabbitHole.StealSpaceRocks.Singleton;
                RabbitHole.StealSpaceRocks instance2 = instance as RabbitHole.StealSpaceRocks;
                if (instance2 != null)
                {
                    RabbitHole.StealSpaceRocks.SpaceRockSize weightedIndex = (RabbitHole.StealSpaceRocks.SpaceRockSize)RandomUtil.GetWeightedIndex(instance2.SSRTuning.SpaceRockWeights);
                    RockGemMetal spaceRockSize = RockGemMetal.SpaceRockSmall;
                    switch (weightedIndex)
                    {
                    case RabbitHole.StealSpaceRocks.SpaceRockSize.Small:
                        spaceRockSize = RockGemMetal.SpaceRockSmall;
                        break;

                    case RabbitHole.StealSpaceRocks.SpaceRockSize.Medium:
                        spaceRockSize = RockGemMetal.SpaceRockMedium;
                        break;

                    case RabbitHole.StealSpaceRocks.SpaceRockSize.Large:
                        spaceRockSize = RockGemMetal.SpaceRockLarge;
                        break;
                    }

                    return(RockGemMetalBase.Make(spaceRockSize, false));
                }
            }

            switch (type)
            {
            case OccultTypes.Fairy:
                PlantRarity      rarity  = (PlantRarity)RandomUtil.GetInt(0, 3);
                Quality          quality = (Quality)RandomUtil.GetInt(4, 9);
                PlayerDisclosure playerKnowledgeOfPlantableType = (rarity == PlantRarity.Common) ? PlayerDisclosure.Exposed : PlayerDisclosure.Concealed;
                IGameObject      seed = PlantHelper.CreateRandomPlantable(rarity, quality, true, playerKnowledgeOfPlantableType);

                return(seed);

            case OccultTypes.Frankenstein:
                ScrapInitParameters initData = new ScrapInitParameters(1);
                IGameObject         scrap    = GlobalFunctions.CreateObjectOutOfWorld("scrapPile", ProductVersion.EP2, null, initData);
                return(scrap);

            case OccultTypes.Genie:
                IGameObject lamp = GlobalFunctions.CreateObjectOutOfWorld("GenieLamp", ProductVersion.EP6);
                return(lamp);

            case OccultTypes.Mermaid:
                IGameObject kelp = MermadicKelp.MakeMermadicKelp(RandomUtil.CoinFlip());
                return(kelp);

            case OccultTypes.PlantSim:
                string     randomHerb = RandomUtil.GetRandomObjectFromList <string>(new List <string>(Herb.sIngredientToHerbDataMap.Keys));
                Ingredient herb       = Ingredient.Create(IngredientData.NameToDataMap[randomHerb]);
                return(herb as IGameObject);

            case OccultTypes.Robot:
                TraitChipStaticData data = RandomUtil.GetRandomObjectFromDictionary <ulong, TraitChipStaticData>(GenericManager <TraitChipName, TraitChipStaticData, TraitChip> .sDictionary);
                if (data != null)
                {
                    TraitChip chip = TraitChipManager.CreateTraitChip(data.Guid);
                    return(chip);
                }
                return(null);

            case OccultTypes.Vampire:
                IGameObject vampireTreat = null;
                if (!GameUtils.IsInstalled(ProductVersion.EP3))
                {
                    vampireTreat = Recipe.NameToRecipeHash["VampireJuiceEP7"].CreateFinishedFood(Recipe.MealQuantity.Single, Quality.Perfect);
                }
                else
                {
                    bool coinToss = RandomUtil.CoinFlip();
                    if (coinToss)
                    {
                        vampireTreat = Recipe.NameToRecipeHash["VampireJuice"].CreateFinishedFood(Recipe.MealQuantity.Single, Quality.Perfect);
                    }
                    else
                    {
                        vampireTreat = Ingredient.Create(IngredientData.NameToDataMap["VampireFruit"]);
                    }
                }
                return(vampireTreat);

            case OccultTypes.Werewolf:
                List <FishType> fish    = new List <FishType>();
                List <float>    weights = new List <float>(fish.Count);
                foreach (FishType fishType in Fish.sFishData.Keys)
                {
                    FishData data2 = Fish.sFishData[fishType];
                    if (((data2.IngredientData != null) && data2.IngredientData.CanBuyFromStore) && (data2.Level >= 0))
                    {
                        fish.Add(fishType);
                        weights.Add(1f);
                    }
                }
                int  weightedIndexFish = RandomUtil.GetWeightedIndex(weights.ToArray());
                Fish obj2 = Fish.CreateFishOfRandomWeight(fish[weightedIndexFish]);
                return(obj2 as IGameObject);

            case OccultTypes.Witch:
                if (RandomUtil.CoinFlip())
                {
                    ISoloInteractionDefinition  cdef     = TraitFunctions.ConjureApple.Singleton;
                    TraitFunctions.ConjureApple appleDef = cdef as TraitFunctions.ConjureApple;
                    if (appleDef != null)
                    {
                        return(appleDef.CreateAppleForInventory(RandomUtil.CoinFlip(), Quality.Perfect));
                    }
                }
                else
                {
                    AlchemyPotion potion = AlchemyPotion.CreateARandomPotion(RandomUtil.CoinFlip(), 0);
                    return(potion as IGameObject);
                }
                return(null);

            case OccultTypes.None:
            default:
                return(null);
            }
        }