Exemplo n.º 1
0
        public static List <string> getProfessionDescription(int whichProfession)
        {
            List <string> expr_05 = new List <string>();

            LuckLevelUpMenu.addProfessionDescriptions(expr_05, LuckLevelUpMenu.getProfessionName(whichProfession));
            return(expr_05);
        }
Exemplo n.º 2
0
 public static string getProfessionTitleFromNumber(int whichProfession)
 {
     if (whichProfession == Mod.PROFESSION_DAILY_LUCK || whichProfession == Mod.PROFESSION_A1 || whichProfession == Mod.PROFESSION_A2 ||
         whichProfession == Mod.PROFESSION_MOREQUESTS || whichProfession == Mod.PROFESSION_NIGHTLY_EVENTS || whichProfession == Mod.PROFESSION_B2)
     {
         return(getProfessionName(whichProfession));
     }
     return(Game1.content.LoadString("Strings\\UI:LevelUp_ProfessionName_" + LuckLevelUpMenu.getProfessionName(whichProfession), new object[0]));
 }
Exemplo n.º 3
0
        private void initLuckSkill(SkillsPage skills)
        {
            // Bunch of stuff from the constructor
            int num2 = 0;
            int num3 = skills.xPositionOnScreen + IClickableMenu.borderWidth + IClickableMenu.spaceToClearTopBorder + 4 * Game1.tileSize - Game1.pixelZoom;
            int num4 = skills.yPositionOnScreen + IClickableMenu.spaceToClearTopBorder + IClickableMenu.borderWidth - Game1.pixelZoom * 3;

            for (int i = 4; i < 10; i += 5)
            {
                int j = 5;

                string text  = "";
                string text2 = "";
                bool   flag  = false;
                int    num5  = -1;

                flag = (Game1.player.LuckLevel > i);
                num5 = getLuckProfessionForSkill(i + 1);  //Game1.player.getProfessionForSkill(5, i + 1);
                object[] args = new object[] { text, text2, LuckLevelUpMenu.getProfessionDescription(num5) };
                Helper.Reflection.GetMethod(skills, "parseProfessionDescription").Invoke(args);
                text  = (string)args[0];
                text2 = (string)args[1];

                if (flag && (i + 1) % 5 == 0)
                {
                    var skillBars = Helper.Reflection.GetField <List <ClickableTextureComponent> >(skills, "skillBars").GetValue();
                    skillBars.Add(new ClickableTextureComponent(string.Concat(num5), new Rectangle(num2 + num3 - Game1.pixelZoom + i * (Game1.tileSize / 2 + Game1.pixelZoom), num4 + j * (Game1.tileSize / 2 + Game1.pixelZoom * 6), 14 * Game1.pixelZoom, 9 * Game1.pixelZoom), null, text, Game1.mouseCursors, new Rectangle(159, 338, 14, 9), (float)Game1.pixelZoom, true));
                }
                num2 += Game1.pixelZoom * 6;
            }
            int k    = 5;
            int num6 = k;

            if (num6 == 1)
            {
                num6 = 3;
            }
            else if (num6 == 3)
            {
                num6 = 1;
            }
            string text3 = "";

            if (Game1.player.LuckLevel > 0)
            {
                text3 = "Luck Increased";
            }
            var skillAreas = Helper.Reflection.GetField <List <ClickableTextureComponent> >(skills, "skillAreas").GetValue();

            skillAreas.Add(new ClickableTextureComponent(string.Concat(num6), new Rectangle(num3 - Game1.tileSize * 2 - Game1.tileSize * 3 / 4, num4 + k * (Game1.tileSize / 2 + Game1.pixelZoom * 6), Game1.tileSize * 2 + Game1.pixelZoom * 5, 9 * Game1.pixelZoom), string.Concat(num6), text3, null, Rectangle.Empty, 1f, false));
        }
Exemplo n.º 4
0
        public LuckLevelUpMenu(int skill, int level)
            : base(Game1.viewport.Width / 2 - 384, Game1.viewport.Height / 2 - 256, 768, 512, false)
        {
            this.timerBeforeStart = 250;
            this.isActive         = true;
            this.width            = Game1.tileSize * 12;
            this.height           = Game1.tileSize * 8;
            this.okButton         = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width + 4, this.yPositionOnScreen + this.height - Game1.tileSize - IClickableMenu.borderWidth, Game1.tileSize, Game1.tileSize), Game1.mouseCursors, Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, 46, -1, -1), 1f, false);
            this.newCraftingRecipes.Clear();
            this.extraInfoForLevel.Clear();
            Game1.player.completelyStopAnimatingOrDoingAction();
            this.informationUp       = true;
            this.isProfessionChooser = false;
            this.currentLevel        = level;
            this.currentSkill        = skill;
            if (level == 10)
            {
                Game1.getSteamAchievement("Achievement_SingularTalent");
                if (Game1.player.farmingLevel.Value == 10 && Game1.player.miningLevel.Value == 10 && Game1.player.fishingLevel.Value == 10 && Game1.player.foragingLevel.Value == 10 && Game1.player.combatLevel.Value == 10)
                {
                    Game1.getSteamAchievement("Achievement_MasterOfTheFiveWays");
                }
            }
            this.title = string.Concat(new object[]
            {
                "Level ",
                this.currentLevel,
                " ",
                SFarmer.getSkillNameFromIndex(this.currentSkill)
            });
            this.extraInfoForLevel = this.getExtraInfoForLevel(this.currentSkill, this.currentLevel);
            switch (this.currentSkill)
            {
            case 0:
                this.sourceRectForLevelIcon = new Rectangle(0, 0, 16, 16);
                break;

            case 1:
                this.sourceRectForLevelIcon = new Rectangle(16, 0, 16, 16);
                break;

            case 2:
                this.sourceRectForLevelIcon = new Rectangle(80, 0, 16, 16);
                break;

            case 3:
                this.sourceRectForLevelIcon = new Rectangle(32, 0, 16, 16);
                break;

            case 4:
                this.sourceRectForLevelIcon = new Rectangle(128, 16, 16, 16);
                break;

            case 5:
                this.sourceRectForLevelIcon = new Rectangle(64, 0, 16, 16);
                break;
            }
            if ((this.currentLevel == 5 || this.currentLevel == 10) /*&& this.currentSkill != 5*/)
            {
                this.professionsToChoose.Clear();
                this.isProfessionChooser = true;
                if (this.currentLevel == 5)
                {
                    this.professionsToChoose.Add(this.currentSkill * 6);
                    this.professionsToChoose.Add(this.currentSkill * 6 + 1);
                }
                else if (Game1.player.professions.Contains(this.currentSkill * 6))
                {
                    this.professionsToChoose.Add(this.currentSkill * 6 + 2);
                    this.professionsToChoose.Add(this.currentSkill * 6 + 3);
                }
                else
                {
                    this.professionsToChoose.Add(this.currentSkill * 6 + 4);
                    this.professionsToChoose.Add(this.currentSkill * 6 + 5);
                }
                this.leftProfessionDescription  = LuckLevelUpMenu.getProfessionDescription(this.professionsToChoose[0]);
                this.rightProfessionDescription = LuckLevelUpMenu.getProfessionDescription(this.professionsToChoose[1]);
            }
            int num = 0;

            foreach (KeyValuePair <string, string> current in CraftingRecipe.craftingRecipes)
            {
                string text = current.Value.Split(new char[]
                {
                    '/'
                })[4];
                if (text.Contains(SFarmer.getSkillNameFromIndex(this.currentSkill)) && text.Contains(string.Concat(this.currentLevel)))
                {
                    this.newCraftingRecipes.Add(new CraftingRecipe(current.Key, false));
                    if (!Game1.player.craftingRecipes.ContainsKey(current.Key))
                    {
                        Game1.player.craftingRecipes.Add(current.Key, 0);
                    }
                    num += (this.newCraftingRecipes.Last <CraftingRecipe>().bigCraftable ? (Game1.tileSize * 2) : Game1.tileSize);
                }
            }
            foreach (KeyValuePair <string, string> current2 in CraftingRecipe.cookingRecipes)
            {
                string text2 = current2.Value.Split(new char[]
                {
                    '/'
                })[3];
                if (text2.Contains(SFarmer.getSkillNameFromIndex(this.currentSkill)) && text2.Contains(string.Concat(this.currentLevel)))
                {
                    this.newCraftingRecipes.Add(new CraftingRecipe(current2.Key, true));
                    if (!Game1.player.cookingRecipes.ContainsKey(current2.Key))
                    {
                        Game1.player.cookingRecipes.Add(current2.Key, 0);
                        if (!Game1.player.hasOrWillReceiveMail("robinKitchenLetter"))
                        {
                            Game1.mailbox.Add("robinKitchenLetter");
                        }
                    }
                    num += (this.newCraftingRecipes.Last <CraftingRecipe>().bigCraftable ? (Game1.tileSize * 2) : Game1.tileSize);
                }
            }
            this.height = num + Game1.tileSize * 4 + this.extraInfoForLevel.Count <string>() * Game1.tileSize * 3 / 4;
            Game1.player.freezePause = 100;
            this.gameWindowSizeChanged(Rectangle.Empty, Rectangle.Empty);
        }
Exemplo n.º 5
0
        public override void update(GameTime time)
        {
            if (!this.isActive)
            {
                base.exitThisMenu(true);
                return;
            }
            for (int i = this.littleStars.Count - 1; i >= 0; i--)
            {
                if (this.littleStars[i].update(time))
                {
                    this.littleStars.RemoveAt(i);
                }
            }
            if (Game1.random.NextDouble() < 0.03)
            {
                Vector2 position = new Vector2(0f, (float)(Game1.random.Next(this.yPositionOnScreen - Game1.tileSize * 2, this.yPositionOnScreen - Game1.pixelZoom) / (Game1.pixelZoom * 5) * Game1.pixelZoom * 5 + Game1.tileSize / 2));
                if (Game1.random.NextDouble() < 0.5)
                {
                    position.X = (float)Game1.random.Next(this.xPositionOnScreen + this.width / 2 - 57 * Game1.pixelZoom, this.xPositionOnScreen + this.width / 2 - 33 * Game1.pixelZoom);
                }
                else
                {
                    position.X = (float)Game1.random.Next(this.xPositionOnScreen + this.width / 2 + 29 * Game1.pixelZoom, this.xPositionOnScreen + this.width - 40 * Game1.pixelZoom);
                }
                if (position.Y < (float)(this.yPositionOnScreen - Game1.tileSize - Game1.pixelZoom * 2))
                {
                    position.X = (float)Game1.random.Next(this.xPositionOnScreen + this.width / 2 - 29 * Game1.pixelZoom, this.xPositionOnScreen + this.width / 2 + 29 * Game1.pixelZoom);
                }
                position.X = position.X / (float)(Game1.pixelZoom * 5) * (float)Game1.pixelZoom * 5f;
                this.littleStars.Add(new TemporaryAnimatedSprite(Game1.mouseCursorsName, new Rectangle(364, 79, 5, 5), 80f, 7, 1, position, false, false, 1f, 0f, Color.White, (float)Game1.pixelZoom, 0f, 0f, 0f, false)
                {
                    local = true
                });
            }
            if (this.timerBeforeStart > 0)
            {
                this.timerBeforeStart -= time.ElapsedGameTime.Milliseconds;
                return;
            }
            if (this.isActive && this.isProfessionChooser)
            {
                this.leftProfessionColor  = Game1.textColor;
                this.rightProfessionColor = Game1.textColor;
                Game1.player.completelyStopAnimatingOrDoingAction();
                Game1.player.freezePause = 100;
                if (Game1.getMouseY() > this.yPositionOnScreen + Game1.tileSize * 3 && Game1.getMouseY() < this.yPositionOnScreen + this.height)
                {
                    if (Game1.getMouseX() > this.xPositionOnScreen && Game1.getMouseX() < this.xPositionOnScreen + this.width / 2)
                    {
                        this.leftProfessionColor = Color.Green;
                        if (((Mouse.GetState().LeftButton == ButtonState.Pressed && this.oldMouseState.LeftButton == ButtonState.Released) || (Game1.options.gamepadControls && GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A) && !Game1.oldPadState.IsButtonDown(Buttons.A))) && this.readyToClose())
                        {
                            Game1.player.professions.Add(this.professionsToChoose[0]);
                            this.getImmediateProfessionPerk(this.professionsToChoose[0]);
                            this.isActive            = false;
                            this.informationUp       = false;
                            this.isProfessionChooser = false;
                        }
                    }
                    else if (Game1.getMouseX() > this.xPositionOnScreen + this.width / 2 && Game1.getMouseX() < this.xPositionOnScreen + this.width)
                    {
                        this.rightProfessionColor = Color.Green;
                        if (((Mouse.GetState().LeftButton == ButtonState.Pressed && this.oldMouseState.LeftButton == ButtonState.Released) || (Game1.options.gamepadControls && GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A) && !Game1.oldPadState.IsButtonDown(Buttons.A))) && this.readyToClose())
                        {
                            Game1.player.professions.Add(this.professionsToChoose[1]);
                            this.getImmediateProfessionPerk(this.professionsToChoose[1]);
                            this.isActive            = false;
                            this.informationUp       = false;
                            this.isProfessionChooser = false;
                        }
                    }
                }
                this.height = Game1.tileSize * 8;
            }
            this.oldMouseState = Mouse.GetState();
            if (this.isActive && !this.informationUp && this.starIcon != null)
            {
                if (this.starIcon.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()))
                {
                    this.starIcon.sourceRect.X = 294;
                }
                else
                {
                    this.starIcon.sourceRect.X = 310;
                }
            }
            if (this.isActive && this.starIcon != null && !this.informationUp && (this.oldMouseState.LeftButton == ButtonState.Pressed || (Game1.options.gamepadControls && Game1.oldPadState.IsButtonDown(Buttons.A))) && this.starIcon.containsPoint(this.oldMouseState.X, this.oldMouseState.Y))
            {
                this.newCraftingRecipes.Clear();
                this.extraInfoForLevel.Clear();
                Game1.player.completelyStopAnimatingOrDoingAction();
                Game1.playSound("bigSelect");
                this.informationUp       = true;
                this.isProfessionChooser = false;
                this.currentLevel        = Game1.player.newLevels.First <Point>().Y;
                this.currentSkill        = Game1.player.newLevels.First <Point>().X;
                this.title = Game1.content.LoadString("Strings\\UI:LevelUp_Title", new object[]
                {
                    this.currentLevel,
                    SFarmer.getSkillNameFromIndex(this.currentSkill)
                });
                this.extraInfoForLevel = this.getExtraInfoForLevel(this.currentSkill, this.currentLevel);
                switch (this.currentSkill)
                {
                case 0:
                    this.sourceRectForLevelIcon = new Rectangle(0, 0, 16, 16);
                    break;

                case 1:
                    this.sourceRectForLevelIcon = new Rectangle(16, 0, 16, 16);
                    break;

                case 2:
                    this.sourceRectForLevelIcon = new Rectangle(80, 0, 16, 16);
                    break;

                case 3:
                    this.sourceRectForLevelIcon = new Rectangle(32, 0, 16, 16);
                    break;

                case 4:
                    this.sourceRectForLevelIcon = new Rectangle(128, 16, 16, 16);
                    break;

                case 5:
                    this.sourceRectForLevelIcon = new Rectangle(64, 0, 16, 16);
                    break;
                }
                if ((this.currentLevel == 5 || this.currentLevel == 10) /*&& this.currentSkill != 5*/)
                {
                    this.professionsToChoose.Clear();
                    this.isProfessionChooser = true;
                    if (this.currentLevel == 5)
                    {
                        this.professionsToChoose.Add(this.currentSkill * 6);
                        this.professionsToChoose.Add(this.currentSkill * 6 + 1);
                    }
                    else if (Game1.player.professions.Contains(this.currentSkill * 6))
                    {
                        this.professionsToChoose.Add(this.currentSkill * 6 + 2);
                        this.professionsToChoose.Add(this.currentSkill * 6 + 3);
                    }
                    else
                    {
                        this.professionsToChoose.Add(this.currentSkill * 6 + 4);
                        this.professionsToChoose.Add(this.currentSkill * 6 + 5);
                    }
                    this.leftProfessionDescription  = LuckLevelUpMenu.getProfessionDescription(this.professionsToChoose[0]);
                    this.rightProfessionDescription = LuckLevelUpMenu.getProfessionDescription(this.professionsToChoose[1]);
                }
                int num = 0;
                foreach (KeyValuePair <string, string> current in CraftingRecipe.craftingRecipes)
                {
                    string text = current.Value.Split(new char[]
                    {
                        '/'
                    })[4];
                    if (text.Contains(SFarmer.getSkillNameFromIndex(this.currentSkill)) && text.Contains(string.Concat(this.currentLevel)))
                    {
                        this.newCraftingRecipes.Add(new CraftingRecipe(current.Key, false));
                        if (!Game1.player.craftingRecipes.ContainsKey(current.Key))
                        {
                            Game1.player.craftingRecipes.Add(current.Key, 0);
                        }
                        num += (this.newCraftingRecipes.Last <CraftingRecipe>().bigCraftable ? (Game1.tileSize * 2) : Game1.tileSize);
                    }
                }
                foreach (KeyValuePair <string, string> current2 in CraftingRecipe.cookingRecipes)
                {
                    string text2 = current2.Value.Split(new char[]
                    {
                        '/'
                    })[3];
                    if (text2.Contains(SFarmer.getSkillNameFromIndex(this.currentSkill)) && text2.Contains(string.Concat(this.currentLevel)))
                    {
                        this.newCraftingRecipes.Add(new CraftingRecipe(current2.Key, true));
                        if (!Game1.player.cookingRecipes.ContainsKey(current2.Key))
                        {
                            Game1.player.cookingRecipes.Add(current2.Key, 0);
                        }
                        num += (this.newCraftingRecipes.Last <CraftingRecipe>().bigCraftable ? (Game1.tileSize * 2) : Game1.tileSize);
                    }
                }
                this.height = num + Game1.tileSize * 4 + this.extraInfoForLevel.Count <string>() * Game1.tileSize * 3 / 4;
                Game1.player.freezePause = 100;
            }
            if (this.isActive && this.informationUp)
            {
                Game1.player.completelyStopAnimatingOrDoingAction();
                if (this.okButton.containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()) && !this.isProfessionChooser)
                {
                    this.okButton.scale = Math.Min(1.1f, this.okButton.scale + 0.05f);
                    if ((this.oldMouseState.LeftButton == ButtonState.Pressed || (Game1.options.gamepadControls && Game1.oldPadState.IsButtonDown(Buttons.A))) && this.readyToClose())
                    {
                        this.getLevelPerk(this.currentSkill, this.currentLevel);
                        this.isActive      = false;
                        this.informationUp = false;
                    }
                }
                else
                {
                    this.okButton.scale = Math.Max(1f, this.okButton.scale - 0.05f);
                }
                Game1.player.freezePause = 100;
            }
        }